[代码优化](v2.6):update
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 330 KiB After Width: | Height: | Size: 115 KiB |
@@ -1,10 +0,0 @@
|
|||||||
import defaultSettings from '@/settings'
|
|
||||||
|
|
||||||
const title = defaultSettings.title || 'Vue Element Admin'
|
|
||||||
|
|
||||||
export default function getPageTitle(pageTitle) {
|
|
||||||
if (pageTitle) {
|
|
||||||
return `${pageTitle} - ${title}`
|
|
||||||
}
|
|
||||||
return `${title}`
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/**
|
|
||||||
*Created by PanJiaChen on 16/11/29.
|
|
||||||
* @param {Sting} url
|
|
||||||
* @param {Sting} title
|
|
||||||
* @param {Number} w
|
|
||||||
* @param {Number} h
|
|
||||||
*/
|
|
||||||
export default function openWindow(url, title, w, h) {
|
|
||||||
// Fixes dual-screen position Most browsers Firefox
|
|
||||||
const dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left
|
|
||||||
const dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top
|
|
||||||
|
|
||||||
const width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width
|
|
||||||
const height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height
|
|
||||||
|
|
||||||
const left = ((width / 2) - (w / 2)) + dualScreenLeft
|
|
||||||
const top = ((height / 2) - (h / 2)) + dualScreenTop
|
|
||||||
const newWindow = window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left)
|
|
||||||
|
|
||||||
// Puts focus on the newWindow
|
|
||||||
if (window.focus) {
|
|
||||||
newWindow.focus()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
Math.easeInOutQuad = function(t, b, c, d) {
|
|
||||||
t /= d / 2
|
|
||||||
if (t < 1) {
|
|
||||||
return c / 2 * t * t + b
|
|
||||||
}
|
|
||||||
t--
|
|
||||||
return -c / 2 * (t * (t - 2) - 1) + b
|
|
||||||
}
|
|
||||||
|
|
||||||
// requestAnimationFrame for Smart Animating http://goo.gl/sx5sts
|
|
||||||
var requestAnimFrame = (function() {
|
|
||||||
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { window.setTimeout(callback, 1000 / 60) }
|
|
||||||
})()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Because it's so fucking difficult to detect the scrolling element, just move them all
|
|
||||||
* @param {number} amount
|
|
||||||
*/
|
|
||||||
function move(amount) {
|
|
||||||
document.documentElement.scrollTop = amount
|
|
||||||
document.body.parentNode.scrollTop = amount
|
|
||||||
document.body.scrollTop = amount
|
|
||||||
}
|
|
||||||
|
|
||||||
function position() {
|
|
||||||
return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {number} to
|
|
||||||
* @param {number} duration
|
|
||||||
* @param {Function} callback
|
|
||||||
*/
|
|
||||||
export function scrollTo(to, duration, callback) {
|
|
||||||
const start = position()
|
|
||||||
const change = to - start
|
|
||||||
const increment = 20
|
|
||||||
let currentTime = 0
|
|
||||||
duration = (typeof (duration) === 'undefined') ? 500 : duration
|
|
||||||
var animateScroll = function() {
|
|
||||||
// increment the time
|
|
||||||
currentTime += increment
|
|
||||||
// find the value with the quadratic in-out easing function
|
|
||||||
var val = Math.easeInOutQuad(currentTime, start, change, duration)
|
|
||||||
// move the document.body
|
|
||||||
move(val)
|
|
||||||
// do the animation unless its over
|
|
||||||
if (currentTime < duration) {
|
|
||||||
requestAnimFrame(animateScroll)
|
|
||||||
} else {
|
|
||||||
if (callback && typeof (callback) === 'function') {
|
|
||||||
// the animation is done so lets callback
|
|
||||||
callback()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
animateScroll()
|
|
||||||
}
|
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<el-progress type="circle" :percentage="parseFloat(data.cpu.used)" />
|
<el-progress type="dashboard" :percentage="parseFloat(data.cpu.used)" />
|
||||||
</div>
|
</div>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<div class="footer">{{ data.cpu.coreNumber }} 核心</div>
|
<div class="footer">{{ data.cpu.coreNumber }} 核心</div>
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<el-progress type="circle" :percentage="parseFloat(data.memory.usageRate)" />
|
<el-progress type="dashboard" :percentage="parseFloat(data.memory.usageRate)" />
|
||||||
</div>
|
</div>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<div class="footer">{{ data.memory.used }} / {{ data.memory.total }}</div>
|
<div class="footer">{{ data.memory.used }} / {{ data.memory.total }}</div>
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<el-progress type="circle" :percentage="parseFloat(data.swap.usageRate)" />
|
<el-progress type="dashboard" :percentage="parseFloat(data.swap.usageRate)" />
|
||||||
</div>
|
</div>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<div class="footer">{{ data.swap.used }} / {{ data.swap.total }}</div>
|
<div class="footer">{{ data.swap.used }} / {{ data.swap.total }}</div>
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<el-progress type="circle" :percentage="parseFloat(data.disk.usageRate)" />
|
<el-progress type="dashboard" :percentage="parseFloat(data.disk.usageRate)" />
|
||||||
</div>
|
</div>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
@@ -268,13 +268,20 @@ export default {
|
|||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
margin-right: 5%;
|
margin-right: 5%;
|
||||||
}
|
}
|
||||||
.title, .footer {
|
.title {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #999;
|
color: #999;
|
||||||
height: 25px;
|
height: 30px;
|
||||||
line-height: 25px;
|
}
|
||||||
|
.footer {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #999;
|
||||||
|
margin-top: -5px;
|
||||||
|
margin-bottom: 6px;
|
||||||
}
|
}
|
||||||
.content {
|
.content {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
Reference in New Issue
Block a user