v1.3 版本发布,代码同步后端v1.3版本
This commit is contained in:
@@ -15,7 +15,7 @@ export function parseTime(time) {
|
||||
var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
|
||||
var seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
|
||||
// 拼接
|
||||
return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds
|
||||
return year + '年' + month + '月' + day + '日 ' + hours + ':' + minutes + ':' + seconds
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
@@ -93,3 +93,26 @@ export function debounce(func, wait, immediate) {
|
||||
export function isExternal(path) {
|
||||
return /^(https?:|mailto:|tel:)/.test(path)
|
||||
}
|
||||
|
||||
// 替换邮箱字符
|
||||
export function regEmail(email) {
|
||||
if (String(email).indexOf('@') > 0) {
|
||||
const str = email.split('@')
|
||||
let _s = ''
|
||||
if (str[0].length > 3) {
|
||||
for (var i = 0; i < str[0].length - 3; i++) {
|
||||
_s += '*'
|
||||
}
|
||||
}
|
||||
var new_email = str[0].substr(0, 3) + _s + '@' + str[1]
|
||||
}
|
||||
return new_email
|
||||
}
|
||||
|
||||
// 替换手机字符
|
||||
export function regMobile(mobile) {
|
||||
if (mobile.length > 7) {
|
||||
var new_mobile = mobile.substr(0, 3) + '****' + mobile.substr(7)
|
||||
}
|
||||
return new_mobile
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import axios from 'axios'
|
||||
import router from '@/router'
|
||||
import { Notification, MessageBox } from 'element-ui'
|
||||
import store from '../store'
|
||||
import { getToken } from '@/utils/auth'
|
||||
@@ -51,9 +52,9 @@ service.interceptors.response.use(
|
||||
return Promise.reject(error)
|
||||
}
|
||||
}
|
||||
if (code === 403 || code === 401) {
|
||||
if (code === 401) {
|
||||
MessageBox.confirm(
|
||||
'Token 无效或已经过期,你可以取消继续留在该页面,或者重新登录',
|
||||
'登录状态已失效,你可以取消继续留在该页面,或者重新登录',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '重新登录',
|
||||
@@ -65,6 +66,8 @@ service.interceptors.response.use(
|
||||
location.reload() // 为了重新实例化vue-router对象 避免bug
|
||||
})
|
||||
})
|
||||
} else if (code === 403) {
|
||||
router.push({ path: '/401' })
|
||||
} else {
|
||||
const errorMsg = error.response.data.message
|
||||
if (errorMsg !== undefined) {
|
||||
|
||||
Reference in New Issue
Block a user