【fix ESLint】src/components/layouts

This commit is contained in:
danshihao
2023-03-06 09:55:27 +08:00
parent 689c988642
commit e60ab2b2e1
5 changed files with 28 additions and 29 deletions
@@ -5,8 +5,8 @@
</template>
<script>
import PageLayout from '../page/PageLayout'
import RouteView from './RouteView'
// import PageLayout from '../page/PageLayout'
// import RouteView from './RouteView'
export default {
name: 'IframePageContent',
@@ -23,15 +23,14 @@ export default {
this.goUrl()
},
watch: {
$route (to, from) {
$route (/* to, from */) {
this.goUrl()
}
},
methods: {
goUrl () {
const url = this.$route.meta.url
const id = this.$route.path
this.id = id
this.id = this.$route.path
// url = "http://www.baidu.com"
console.log('------url------' + url)
if (url !== null && url !== undefined) {
@@ -7,8 +7,8 @@
<script>
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import PageLayout from '../page/PageLayout'
import RouteView from './RouteView'
// import PageLayout from '../page/PageLayout'
// import RouteView from './RouteView'
export default {
name: 'IframePageContent',
@@ -26,22 +26,22 @@ export default {
this.goUrl()
},
watch: {
$route (to, from) {
$route (/* to, from */) {
this.goUrl()
}
},
methods: {
goUrl () {
const url = this.$route.meta.url
const id = this.$route.path
this.id = id
this.id = this.$route.path
// url = "http://www.baidu.com"
console.log('------url------' + url)
if (url !== null && url !== undefined) {
// -----------------------------------------------------------------------------------------
// url支持通过 ${token}方式传递当前登录TOKEN
// eslint-disable-next-line no-template-curly-in-string
const tokenStr = '${token}'
if (url.indexOf(tokenStr) != -1) {
if (url.indexOf(tokenStr) !== -1) {
const token = Vue.ls.get(ACCESS_TOKEN)
this.url = url.replace(tokenStr, token)
} else {
@@ -50,7 +50,7 @@ export default {
// -----------------------------------------------------------------------------------------
/* update_begin author:wuxianquan date:20190908 for:判断打开方式,新窗口打开时this.$route.meta.internalOrExternal==true */
if (this.$route.meta.internalOrExternal != undefined && this.$route.meta.internalOrExternal == true) {
if (this.$route.meta.internalOrExternal !== undefined && this.$route.meta.internalOrExternal === true) {
this.closeCurrent()
window.open(this.url)
}
+2 -2
View File
@@ -1,7 +1,7 @@
<template>
<page-layout :desc="description" :title="getTitle" :link-list="linkList" :search="search" :tabs="tabs">
<div slot="extra" class="extra-img">
<img :src="extraImage"/>
<img :src="extraImage" alt=""/>
</div>
<!-- keep-alive -->
<route-view ref="content"></route-view>
@@ -52,7 +52,7 @@ export default {
this.description = content.description
this.linkList = content.linkList
this.extraImage = content.extraImage
this.search = content.search == true
this.search = content.search === true
this.tabs = content.tabs
}
}
@@ -98,7 +98,7 @@ export default {
this.linkList = [newRoute.fullPath]
this.pageList = [Object.assign({}, newRoute)]
// update-begin-author:taoyan date:20200211 for: TASK #3368 【路由缓存】首页的缓存设置有问题,需要根据后台的路由配置来实现是否缓存
} else if (indexKey == newRoute.fullPath) {
} else if (indexKey === newRoute.fullPath) {
// 首页时 判断是否缓存 没有缓存 刷新之
if (newRoute.meta.keepAlive === false) {
this.routeReload()
@@ -171,7 +171,7 @@ export default {
return
}
console.log('this.pageList ', this.pageList)
const removeRoute = this.pageList.filter(item => item.fullPath == key)
const removeRoute = this.pageList.filter(item => (item.fullPath + '') === (key + ''))
this.pageList = this.pageList.filter(item => item.fullPath !== key)
let index = this.linkList.indexOf(key)
this.linkList = this.linkList.filter(item => item !== key)
@@ -234,7 +234,7 @@ export default {
/* update_end author:wuxianquan date:20190828 for: 关闭当前tab页,供子页面调用->望菜单能配置外链,直接弹出新页面而不是嵌入iframe #428 */
closeOthers (pageKey) {
const index = this.linkList.indexOf(pageKey)
if (pageKey == indexKey || pageKey.indexOf('?ticke=') >= 0) {
if ((pageKey + '') === (indexKey + '') || pageKey.indexOf('?ticke=') >= 0) {
this.linkList = this.linkList.slice(index, index + 1)
this.pageList = this.pageList.slice(index, index + 1)
this.activePage = this.linkList[0]
@@ -245,10 +245,10 @@ export default {
}
},
closeLeft (pageKey) {
if (pageKey == indexKey) {
if ((pageKey + '') === (indexKey + '')) {
return
}
const tempList = [...this.pageList]
// const tempList = [...this.pageList]
const index = this.linkList.indexOf(pageKey)
this.linkList = this.linkList.slice(index)
this.pageList = this.pageList.slice(index)
+10 -10
View File
@@ -53,27 +53,27 @@ export default {
}
// 判断当前设备
function isMobile () {
var userAgentInfo = navigator.userAgent
const userAgentInfo = navigator.userAgent
var mobileAgents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod']
const mobileAgents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod']
var mobile_flag = false
let mobileFlag = false
// 根据userAgent判断是否是手机
for (var v = 0; v < mobileAgents.length; v++) {
for (let v = 0; v < mobileAgents.length; v++) {
if (userAgentInfo.indexOf(mobileAgents[v]) > 0) {
mobile_flag = true
mobileFlag = true
break
}
}
var screen_width = window.screen.width
var screen_height = window.screen.height
const screenWidth = window.screen.width
const screenHeight = window.screen.height
// 根据屏幕分辨率判断是否是手机
if (screen_width < 500 && screen_height < 800) {
mobile_flag = true
if (screenWidth < 500 && screenHeight < 800) {
mobileFlag = true
}
return mobile_flag
return mobileFlag
}
</script>
<style lang="less" >