refactor: 优化token过期提示框

This commit is contained in:
fit2cloud-chenyw 2021-08-03 11:12:35 +08:00
parent cbf8c94fc7
commit b09bf1ca54
4 changed files with 27 additions and 226 deletions

View File

@ -127,7 +127,7 @@ export default {
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' login_again: 'Login again'
}, },
commons: { commons: {
no_target_permission: 'No permission', no_target_permission: 'No permission',
@ -752,7 +752,6 @@ export default {
chart_funnel: 'Funnel', chart_funnel: 'Funnel',
chart_radar: 'Radar', chart_radar: 'Radar',
chart_gauge: 'Gauge', chart_gauge: 'Gauge',
chart_map: 'Map',
dateStyle: 'Date Style', dateStyle: 'Date Style',
datePattern: 'Date Format', datePattern: 'Date Format',
y: 'Year', y: 'Year',
@ -821,11 +820,6 @@ export default {
drag_block_funnel_split: 'Funnel Split', drag_block_funnel_split: 'Funnel Split',
drag_block_radar_length: 'Branch Length', drag_block_radar_length: 'Branch Length',
drag_block_radar_label: 'Branch Label', drag_block_radar_label: 'Branch Label',
stack_item: 'Stack Item',
map_range: 'Map range',
select_map_range: 'Please select map range',
area: 'Area',
placeholder_field: 'Drag Field To Here',
axis_label_rotate: 'Label Rotate' axis_label_rotate: 'Label Rotate'
}, },
dataset: { dataset: {
@ -980,19 +974,7 @@ export default {
right_join: 'RIGHT JOIN', right_join: 'RIGHT JOIN',
inner_join: 'INNER JOIN', inner_join: 'INNER JOIN',
full_join: 'FULL JOIN', full_join: 'FULL JOIN',
can_not_union_diff_datasource: 'Union dataset must have same data source', can_not_union_diff_datasource: 'Union dataset must have same data source'
operator: 'Operator',
d_q_trans: 'Dimension/Quota Transform',
add_calc_field: 'Create calc field',
input_name: 'Please input name',
field_exp: 'Field Expression',
data_type: 'Data Type',
click_ref_field: 'Click Quote Field',
click_ref_function: 'Click Quote Function',
field_manage: 'Field Manage',
edit_calc_field: 'Edit calc field',
calc_field: 'Calc Field',
show_sql: 'Show SQL'
}, },
datasource: { datasource: {
datasource: 'Data Source', datasource: 'Data Source',
@ -1306,54 +1288,5 @@ export default {
i18n_msg_type_dataset_sync_faild: 'Dataset synchronization failed', i18n_msg_type_dataset_sync_faild: 'Dataset synchronization failed',
i18n_msg_type_all: 'All type', i18n_msg_type_all: 'All type',
channel_inner_msg: 'On site news' channel_inner_msg: 'On site news'
},
denumberrange: {
label: 'Number range',
split_placeholder: 'To',
please_key_min: 'Please key min value',
please_key_max: 'Please key max value',
out_of_min: 'The min value cannot be less than the min integer -2³²',
out_of_max: 'The max value cannot be more than the max integer 2³²-1',
must_int: 'Please key interger',
min_out_max: 'The min value must be less than the max value',
max_out_min: 'The max value must be more than the min value'
},
denumberselect: {
label: 'Number selector',
placeholder: 'Please select'
},
deinputsearch: {
label: 'Text search',
placeholder: 'Please key keyword'
},
detextselect: {
label: 'Text selector',
placeholder: 'Please select'
},
detextgridselect: {
label: 'Text list',
placeholder: 'Please select'
},
denumbergridselect: {
label: 'Number list',
placeholder: 'Please select'
},
dedaterange: {
label: 'Date range',
to_placeholder: 'End date',
from_placeholder: 'Start date',
split_placeholder: 'To'
},
dedate: {
label: 'Date',
placeholder: 'Please select date'
},
deyearmonth: {
label: 'Month',
placeholder: 'Please select month'
},
deyear: {
label: 'Year',
placeholder: 'Please select year'
} }
} }

View File

@ -109,25 +109,25 @@ export default {
navbar: { navbar: {
dashboard: '首頁', dashboard: '首頁',
github: '項目地址', github: '項目地址',
logOut: '退出登', logOut: '退出登',
profile: '個人中心', profile: '個人中心',
theme: '換膚', theme: '換膚',
size: '佈局大小' size: '佈局大小'
}, },
login: { login: {
title: '系統登', title: '系統登',
welcome: '歡迎使用', welcome: '歡迎使用',
logIn: '登', logIn: '登',
username: '帳號', username: '帳號',
password: '密碼', password: '密碼',
any: '任意字符', any: '任意字符',
thirdparty: '第三方登', thirdparty: '第三方登',
thirdpartyTips: '本地不能模擬,請結合自己業務進行模擬!!!', thirdpartyTips: '本地不能模擬,請結合自己業務進行模擬!!!',
expires: '登陸信息過期,請重新登陸', expires: '登錄信息過期,請重新登錄',
tokenError: '信息錯誤,請重新登', tokenError: '信息錯誤,請重新登',
username_error: '請輸入正確的 ID', username_error: '請輸入正確的 ID',
password_error: '密碼不小於 8 位', password_error: '密碼不小於 8 位',
re_login: '重新登陸' login_again: '重新登錄'
}, },
commons: { commons: {
no_target_permission: '沒有權限', no_target_permission: '沒有權限',
@ -184,7 +184,7 @@ export default {
prompt: '提示', prompt: '提示',
operating: '操作', operating: '操作',
input_limit: '長度在 {0} 到 {1} 個字符', input_limit: '長度在 {0} 到 {1} 個字符',
login: '登', login: '登',
welcome: '一站式開源數據分析平臺', welcome: '一站式開源數據分析平臺',
username: '姓名', username: '姓名',
password: '密碼', password: '密碼',
@ -256,7 +256,7 @@ export default {
remove: '移除', remove: '移除',
remove_cancel: '移除取消', remove_cancel: '移除取消',
remove_success: '移除成功', remove_success: '移除成功',
tips: '認證信息已過期,請重新登', tips: '認證信息已過期,請重新登',
not_performed_yet: '尚未執行', not_performed_yet: '尚未執行',
incorrect_input: '輸入內容不正確', incorrect_input: '輸入內容不正確',
delete_confirm: '請輸入以下內容,確認刪除:', delete_confirm: '請輸入以下內容,確認刪除:',
@ -752,7 +752,6 @@ export default {
chart_funnel: '漏鬥圖', chart_funnel: '漏鬥圖',
chart_radar: '雷達圖', chart_radar: '雷達圖',
chart_gauge: '儀表盤', chart_gauge: '儀表盤',
chart_map: '地圖',
dateStyle: '日期顯示', dateStyle: '日期顯示',
datePattern: '日期格式', datePattern: '日期格式',
y: '年', y: '年',
@ -821,11 +820,6 @@ export default {
drag_block_funnel_split: '漏鬥分層', drag_block_funnel_split: '漏鬥分層',
drag_block_radar_length: '分支長度', drag_block_radar_length: '分支長度',
drag_block_radar_label: '分支標簽', drag_block_radar_label: '分支標簽',
map_range: '地圖範圍',
select_map_range: '請選擇地圖範圍',
area: '地區',
stack_item: '堆疊項',
placeholder_field: '拖動字段至此處',
axis_label_rotate: '標簽角度' axis_label_rotate: '標簽角度'
}, },
dataset: { dataset: {
@ -980,19 +974,7 @@ export default {
right_join: '右連接', right_join: '右連接',
inner_join: '內連接', inner_join: '內連接',
full_join: '全連接', full_join: '全連接',
can_not_union_diff_datasource: '被關聯數據集必須與當前數據集的數據源一致', can_not_union_diff_datasource: '被關聯數據集必須與當前數據集的數據源一致'
operator: '操作',
d_q_trans: '維度/指標轉換',
add_calc_field: '新建计算字段',
input_name: '請輸入名稱',
field_exp: '字段表達式',
data_type: '數據類型',
click_ref_field: '點擊引用字段',
click_ref_function: '點擊引用函數',
field_manage: '字段管理',
edit_calc_field: '編輯計算字段',
calc_field: '計算字段',
show_sql: '顯示SQL'
}, },
datasource: { datasource: {
datasource: '數據源', datasource: '數據源',
@ -1145,7 +1127,7 @@ export default {
lineHeight: '行高', lineHeight: '行高',
letterSpacing: '字間距', letterSpacing: '字間距',
textAlign: '左右對齊', textAlign: '左右對齊',
opacity: '透明度', opacity: '透明度',
verticalAlign: '上下對齊', verticalAlign: '上下對齊',
text_align_left: '左對齊', text_align_left: '左對齊',
text_align_center: '左右居中', text_align_center: '左右居中',
@ -1184,9 +1166,9 @@ export default {
}, },
display: { display: {
logo: '頭部系統 Logo', logo: '頭部系統 Logo',
loginLogo: '登頁面頭部 Logo', loginLogo: '登頁面頭部 Logo',
loginImage: '登頁面右側圖片', loginImage: '登頁面右側圖片',
loginTitle: '登頁面標題', loginTitle: '登頁面標題',
title: '系統名稱', title: '系統名稱',
advice_size: '建議圖片大小' advice_size: '建議圖片大小'
}, },
@ -1306,54 +1288,5 @@ export default {
i18n_msg_type_dataset_sync_faild: '數據集同步失敗', i18n_msg_type_dataset_sync_faild: '數據集同步失敗',
i18n_msg_type_all: '全部類型', i18n_msg_type_all: '全部類型',
channel_inner_msg: '站內消息' channel_inner_msg: '站內消息'
},
denumberrange: {
label: '數值區間',
split_placeholder: '至',
please_key_min: '請輸入最小值',
please_key_max: '請輸入最大值',
out_of_min: '最小值不能小于最小整數-2³²',
out_of_max: '最大值不能大于最大整數2³²-1',
must_int: '請輸入整數',
min_out_max: '最小值必須小于最大值',
max_out_min: '最大值必須大于最小值'
},
denumberselect: {
label: '數字下拉',
placeholder: '請選擇'
},
deinputsearch: {
label: '文本搜索',
placeholder: '請輸入關鍵字'
},
detextselect: {
label: '文本下拉',
placeholder: '請選擇'
},
detextgridselect: {
label: '文本列表',
placeholder: '請選擇'
},
denumbergridselect: {
label: '數字列表',
placeholder: '請選擇'
},
dedaterange: {
label: '日期範圍',
to_placeholder: '結束日期',
from_placeholder: '開始日期',
split_placeholder: '至'
},
dedate: {
label: '日期',
placeholder: '請選擇日期'
},
deyearmonth: {
label: '年月',
placeholder: '請選擇年月'
},
deyear: {
label: '年份',
placeholder: '請選擇年份'
} }
} }

View File

@ -127,7 +127,7 @@ export default {
tokenError: '登陆信息错误,请重新登录', tokenError: '登陆信息错误,请重新登录',
username_error: '请输入正确的 ID', username_error: '请输入正确的 ID',
password_error: '密码不小于 8 位', password_error: '密码不小于 8 位',
re_login: '重新登录' login_again: '重新登录'
}, },
commons: { commons: {
no_target_permission: '没有权限', no_target_permission: '没有权限',
@ -752,7 +752,6 @@ export default {
chart_funnel: '漏斗图', chart_funnel: '漏斗图',
chart_radar: '雷达图', chart_radar: '雷达图',
chart_gauge: '仪表盘', chart_gauge: '仪表盘',
chart_map: '地图',
dateStyle: '日期显示', dateStyle: '日期显示',
datePattern: '日期格式', datePattern: '日期格式',
y: '年', y: '年',
@ -821,11 +820,6 @@ export default {
drag_block_funnel_split: '漏斗分层', drag_block_funnel_split: '漏斗分层',
drag_block_radar_length: '分支长度', drag_block_radar_length: '分支长度',
drag_block_radar_label: '分支标签', drag_block_radar_label: '分支标签',
map_range: '地图范围',
select_map_range: '请选择地图范围',
area: '地区',
stack_item: '堆叠项',
placeholder_field: '拖动字段至此处',
axis_label_rotate: '标签角度' axis_label_rotate: '标签角度'
}, },
dataset: { dataset: {
@ -980,19 +974,7 @@ export default {
right_join: '右连接', right_join: '右连接',
inner_join: '内连接', inner_join: '内连接',
full_join: '全连接', full_join: '全连接',
can_not_union_diff_datasource: '被关联数据集必须与当前数据集的数据源一致', can_not_union_diff_datasource: '被关联数据集必须与当前数据集的数据源一致'
operator: '操作',
d_q_trans: '维度/指标转换',
add_calc_field: '新建计算字段',
input_name: '请输入名称',
field_exp: '字段表达式',
data_type: '数据类型',
click_ref_field: '点击引用字段',
click_ref_function: '点击引用函数',
field_manage: '字段管理',
edit_calc_field: '编辑计算字段',
calc_field: '计算字段',
show_sql: '显示SQL'
}, },
datasource: { datasource: {
datasource: '数据源', datasource: '数据源',
@ -1146,7 +1128,7 @@ export default {
lineHeight: '行高', lineHeight: '行高',
letterSpacing: '字间距', letterSpacing: '字间距',
textAlign: '左右对齐', textAlign: '左右对齐',
opacity: '透明度', opacity: '透明度',
verticalAlign: '上下对齐', verticalAlign: '上下对齐',
text_align_left: '左对齐', text_align_left: '左对齐',
text_align_center: '左右居中', text_align_center: '左右居中',
@ -1308,54 +1290,5 @@ export default {
i18n_msg_type_dataset_sync_faild: '数据集同步失败', i18n_msg_type_dataset_sync_faild: '数据集同步失败',
i18n_msg_type_all: '全部类型', i18n_msg_type_all: '全部类型',
channel_inner_msg: '站内消息' channel_inner_msg: '站内消息'
},
denumberrange: {
label: '数值区间',
split_placeholder: '至',
please_key_min: '请输入最小值',
please_key_max: '请输入最大值',
out_of_min: '最小值不能小于最小整数-2³²',
out_of_max: '最大值不能大于最大整数2³²-1',
must_int: '请输入整数',
min_out_max: '最小值必须小于最大值',
max_out_min: '最大值必须大于最小值'
},
denumberselect: {
label: '数字下拉',
placeholder: '请选择'
},
deinputsearch: {
label: '文本搜索',
placeholder: '请输入关键字'
},
detextselect: {
label: '文本下拉',
placeholder: '请选择'
},
detextgridselect: {
label: '文本列表',
placeholder: '请选择'
},
denumbergridselect: {
label: '数字列表',
placeholder: '请选择'
},
dedaterange: {
label: '日期范围',
to_placeholder: '结束日期',
from_placeholder: '开始日期',
split_placeholder: '至'
},
dedate: {
label: '日期',
placeholder: '请选择日期'
},
deyearmonth: {
label: '年月',
placeholder: '请选择年月'
},
deyear: {
label: '年份',
placeholder: '请选择年份'
} }
} }

View File

@ -16,7 +16,7 @@ const LinkTokenKey = Config.LinkTokenKey
const service = axios.create({ const service = axios.create({
baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
// withCredentials: true, // send cookies when cross-domain requests // withCredentials: true, // send cookies when cross-domain requests
timeout: 10000 // request timeout timeout: 20000 // request timeout
}) })
// request interceptor // request interceptor
@ -52,10 +52,6 @@ service.interceptors.request.use(
} }
) )
const defaultOptions = {
confirmButtonText: i18n.t('login.re_login')
}
const checkAuth = response => { const checkAuth = response => {
// 请根据实际需求修改 // 请根据实际需求修改
@ -66,7 +62,10 @@ const checkAuth = response => {
store.dispatch('user/logout').then(() => { store.dispatch('user/logout').then(() => {
location.reload() location.reload()
}) })
}, defaultOptions) }, {
confirmButtonText: i18n.t('login.login_again'),
showClose: false
})
} }
if (response.headers['authentication-status'] === 'invalid') { if (response.headers['authentication-status'] === 'invalid') {
@ -75,6 +74,9 @@ const checkAuth = response => {
store.dispatch('user/logout').then(() => { store.dispatch('user/logout').then(() => {
location.reload() location.reload()
}) })
}, {
confirmButtonText: i18n.t('login.login_again'),
showClose: false
}) })
} }
// token到期后自动续命 刷新token // token到期后自动续命 刷新token