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