mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-13 19:35:24 +00:00
perf: message
This commit is contained in:
@@ -19,7 +19,7 @@ import VueLogger from 'vuejs-logger'
|
||||
import loggerOptions from './utils/logger'
|
||||
import ECharts from 'vue-echarts'
|
||||
import service from '@/utils/request'
|
||||
import { Message } from '@/utils/Message'
|
||||
import { message } from '@/utils/message'
|
||||
import xss from '@/utils/xss'
|
||||
|
||||
/**
|
||||
@@ -60,7 +60,7 @@ Vue.prototype.$axios = service
|
||||
window._ = require('lodash')
|
||||
// Vue.set(Vue.prototype, '_', _)
|
||||
|
||||
Vue.prototype.$message = Message
|
||||
Vue.prototype.$message = message
|
||||
|
||||
Vue.prototype.$xss = xss
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { Message as elMessage } from 'element-ui'
|
||||
|
||||
let messageDom = null
|
||||
const Message = (options) => {
|
||||
const message = (options) => {
|
||||
// 判断弹窗是否已存在, 若存在则关闭
|
||||
if (messageDom) messageDom.close()
|
||||
messageDom = elMessage(options)
|
||||
@@ -10,11 +10,11 @@ const Message = (options) => {
|
||||
|
||||
const typeArray = ['success', 'error', 'warning', 'info']
|
||||
typeArray.forEach(type => {
|
||||
Message[type] = options => {
|
||||
message[type] = options => {
|
||||
if (typeof options === 'string') options = { message: options }
|
||||
options.type = type
|
||||
return Message(options)
|
||||
return message(options)
|
||||
}
|
||||
})
|
||||
|
||||
export { Message }
|
||||
export { message }
|
||||
|
||||
@@ -4,7 +4,7 @@ import { getTokenFromCookie } from '@/utils/auth'
|
||||
import { getErrorResponseMsg } from '@/utils/common'
|
||||
import { refreshSessionIdAge } from '@/api/users'
|
||||
import { MessageBox } from 'element-ui'
|
||||
import { Message } from '@/utils/Message'
|
||||
import { message } from '@/utils/message'
|
||||
import store from '@/store'
|
||||
import axiosRetry from 'axios-retry'
|
||||
import router from '@/router'
|
||||
@@ -93,7 +93,7 @@ export function flashErrorMsg({ response, error }) {
|
||||
if (!response.config.disableFlashErrorMsg) {
|
||||
const responseErrorMsg = getErrorResponseMsg(error)
|
||||
const msg = responseErrorMsg || error.message
|
||||
Message({
|
||||
message({
|
||||
message: msg,
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
|
||||
@@ -3,7 +3,7 @@ import store from '@/store'
|
||||
import router, { resetRouter } from '@/router'
|
||||
import Vue from 'vue'
|
||||
import VueCookie from 'vue-cookie'
|
||||
import { Message } from '@/utils/Message'
|
||||
import { message } from '@/utils/message'
|
||||
import orgUtil from '@/utils/org'
|
||||
import orgs from '@/api/orgs'
|
||||
import { getPropView, isViewHasOrgs } from '@/utils/jms'
|
||||
@@ -119,7 +119,7 @@ export async function generatePageRoutes({ to, from, next }) {
|
||||
} catch (error) {
|
||||
// remove token and go to login page to re-login
|
||||
// await store.dispatch('user/resetToken')
|
||||
Message.error(error || 'Has Error')
|
||||
message.error(error || 'Has Error')
|
||||
Vue.$log.error('Error occur: ', error)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import ProtocolSelector from '@/components/FormFields/ProtocolSelector'
|
||||
import AssetAccounts from '@/views/assets/Asset/AssetCreateUpdate/components/AssetAccounts'
|
||||
import rules from '@/components/DataForm/rules'
|
||||
import { Select2 } from '@/components/FormFields'
|
||||
import { Message } from '@/utils/Message'
|
||||
import { message } from '@/utils/message'
|
||||
|
||||
export const filterSelectValues = (values) => {
|
||||
if (!values) return
|
||||
@@ -19,7 +19,7 @@ export const filterSelectValues = (values) => {
|
||||
const inputValue = { name, value }
|
||||
selects.push(inputValue)
|
||||
} else {
|
||||
Message.error(i18n.t('assets.LabelInputFormatValidation'))
|
||||
message.error(i18n.t('assets.LabelInputFormatValidation'))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user