【fix ESLint】components/jero、components/layouts、components/tools、utils、views/account/center、views/demo、views/system
This commit is contained in:
@@ -71,7 +71,7 @@ function globalDisabledAuth (code) {
|
||||
// 设置全局配置是否有命中
|
||||
let gFlag = false// 禁用命中
|
||||
let invalidFlag = false// 无效命中
|
||||
if (allPermissionList != null && allPermissionList != '' && allPermissionList !== undefined && allPermissionList.length > 0) {
|
||||
if (allPermissionList && allPermissionList.length > 0) {
|
||||
for (const itemG of allPermissionList) {
|
||||
if (code === itemG.action) {
|
||||
if (itemG.status + '' === '0') {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable */
|
||||
import { getAction } from '@/api/manage'
|
||||
import { ENCRYPTED_STRING } from '@/store/mutation-types'
|
||||
import Vue from 'vue'
|
||||
|
||||
@@ -9,7 +9,7 @@ export default class signMd5Utils {
|
||||
*/
|
||||
|
||||
static sortAsc (jsonObj) {
|
||||
const arr = new Array()
|
||||
const arr = []
|
||||
let num = 0
|
||||
for (const i in jsonObj) {
|
||||
arr[num] = i
|
||||
@@ -76,7 +76,7 @@ export default class signMd5Utils {
|
||||
static mergeObject (objectOne, objectTwo) {
|
||||
if (objectTwo && Object.keys(objectTwo).length > 0) {
|
||||
for (const key in objectTwo) {
|
||||
if (objectTwo.hasOwnProperty(key) === true) {
|
||||
if (Object.prototype.hasOwnProperty.call(objectTwo, key) === true) {
|
||||
// 数字值转为string类型,前后端加密规则保持一致
|
||||
if (this.myIsNaN(objectTwo[key])) {
|
||||
objectTwo[key] = objectTwo[key].toString()
|
||||
@@ -92,7 +92,7 @@ export default class signMd5Utils {
|
||||
if (param == null) return ''
|
||||
let paramStr = ''
|
||||
const t = typeof (param)
|
||||
if (t == 'string' || t == 'number' || t == 'boolean') {
|
||||
if (t === 'string' || t === 'number' || t === 'boolean') {
|
||||
paramStr += '&' + key + '=' + ((encode == null || encode) ? encodeURIComponent(param) : param)
|
||||
} else {
|
||||
for (const i in param) {
|
||||
|
||||
@@ -84,7 +84,7 @@ export function filterGlobalPermission (el, binding) {
|
||||
}
|
||||
// 设置全局配置是否有命中
|
||||
let invalidFlag = false// 无效命中
|
||||
if (allPermissionList != null && allPermissionList != '' && allPermissionList !== undefined && allPermissionList.length > 0) {
|
||||
if (allPermissionList && allPermissionList.length > 0) {
|
||||
for (const itemG of allPermissionList) {
|
||||
if (binding.value === itemG.action) {
|
||||
if (itemG.status + '' !== '0') {
|
||||
|
||||
@@ -19,7 +19,7 @@ function classNames () {
|
||||
}
|
||||
} else if (argType === 'object') {
|
||||
for (const key in arg) {
|
||||
if (arg.hasOwnProperty(key) && arg[key]) {
|
||||
if (Object.prototype.hasOwnProperty.call(arg, key) && arg[key]) {
|
||||
classes.push(key)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,7 @@ export function filterObj (obj) {
|
||||
}
|
||||
|
||||
for (const key in obj) {
|
||||
if (obj.hasOwnProperty(key) &&
|
||||
(obj[key] == null || obj[key] === undefined || obj[key] === '')) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key) && (obj[key] == null || obj[key] === undefined || obj[key] === '')) {
|
||||
delete obj[key]
|
||||
}
|
||||
}
|
||||
@@ -110,8 +109,7 @@ function generateChildRouters (data) {
|
||||
} else {
|
||||
component = 'views/' + item.component
|
||||
}
|
||||
// eslint-disable-next-line
|
||||
let URL = (item.meta.url|| '').replace(/{{([^}}]+)?}}/g, (s1, s2) => eval(s2)) // URL支持{{ window.xxx }}占位符变量
|
||||
const URL = (item.meta.url || '').replace(/{{([^}}]+)?}}/g, (s1, s2) => eval(s2)) // URL支持{{ window.xxx }}占位符变量
|
||||
if (isURL(URL) || (item.meta.url && item.meta.url.indexOf('{{') === 0)) {
|
||||
item.meta.url = URL
|
||||
}
|
||||
@@ -581,7 +579,7 @@ export function isOAuth2AppEnv () {
|
||||
*/
|
||||
export function getReportPrintUrl (url, id, open) {
|
||||
// URL支持{{ window.xxx }}占位符变量
|
||||
url = url.replace(/{{([^}]+)?}}/g, (s1, s2) => eval(s2))
|
||||
url = url.replace(/{{([^}]+)?}}/g, (s1, s2) => evil(s2))
|
||||
if (url.includes('?')) {
|
||||
url += '&'
|
||||
} else {
|
||||
@@ -594,3 +592,13 @@ export function getReportPrintUrl (url, id, open) {
|
||||
}
|
||||
return url
|
||||
}
|
||||
|
||||
/**
|
||||
* 解决eval的eslint问题
|
||||
* @param fn
|
||||
* @returns {*}
|
||||
*/
|
||||
export function evil (fn) {
|
||||
const Fn = Function // 一个变量指向Function,防止有些前端编译工具报错
|
||||
return new Fn('return ' + fn)()
|
||||
}
|
||||
Reference in New Issue
Block a user