{{title}}
-
+
@@ -34,10 +34,7 @@
},
computed: {
- ...mapState('app', {
- device: state => state.device,
- animation: state => state.loginBackgroundAnimation
- }),
+ ...mapState('app', ['device', 'loginBackgroundAnimation']),
component() {
const formType = this.$route.path.substring(1)
@@ -64,7 +61,7 @@
mounted() {
//移动端关闭动画,太卡
- this.device !== 'mobile' && this.setAnimation(this.animation)
+ this.device !== 'mobile' && this.setAnimation(this.loginBackgroundAnimation)
},
beforeDestroy() {
diff --git a/vue/src/views/example/developingTest/components/ApiSpeedTest.vue b/vue/src/views/example/developingTest/components/ApiSpeedTest.vue
index b06f432..05b18c8 100644
--- a/vue/src/views/example/developingTest/components/ApiSpeedTest.vue
+++ b/vue/src/views/example/developingTest/components/ApiSpeedTest.vue
@@ -1,7 +1,7 @@
测试接口返回速度
- 当前响应次数:{{times}},平均响应:{{avg}}毫秒,最长响应:{{max}}毫秒
+ 当前响应次数:{{times}},响应时间:{{cur}}毫秒,平均响应:{{avg}}毫秒,最长响应:{{max}}毫秒
点我测试
重置
@@ -18,6 +18,7 @@
return {
loading: false,
times: 0,
+ cur: 0,
avg: 0,
max: 0,
total: 0
@@ -31,17 +32,20 @@
request
.post('/test/test')
.finally(() => {
- const end = performance.now() - start
+ const end = (performance.now() - start)
if (end > this.max) this.max = end
+ this.cur = end.toFixed(2)
this.total += end
this.times++
this.avg = (this.total / this.times).toFixed(2)
this.loading = false
})
},
+
reset() {
if (this.loading) return
this.times = 0
+ this.cur = 0
this.avg = 0
this.max = 0
this.total = 0
diff --git a/vue/src/views/example/developingTest/components/ImageCompressTest.vue b/vue/src/views/example/developingTest/components/ImageCompressTest.vue
index fb19a21..2ecf55d 100644
--- a/vue/src/views/example/developingTest/components/ImageCompressTest.vue
+++ b/vue/src/views/example/developingTest/components/ImageCompressTest.vue
@@ -31,6 +31,7 @@
+
测试纯前端png图片压缩效率。
使用pngquant
@@ -118,6 +119,7 @@
this[type].input.size = file.size
this[type].input.src = window.URL.createObjectURL(file)
},
+
cancel(type) {
if (this[type].loading) return
window.URL.revokeObjectURL(this[type].input.src)
@@ -130,6 +132,7 @@
this[type].totalCost = 0
this[type].calcCost = 0
},
+
compress(type) {
if (this[type].loading) return
if (!this[type].input.file) return elError(`请选择一张${type}图片`)
@@ -143,18 +146,21 @@
}
reader.readAsArrayBuffer(this[type].input.file)
},
+
compressJPG(uint8Array, start) {
import('@/plugin/imageCompress/cjpeg')
.then(_ => _.default(uint8Array, this.jpg.quality))
.then(({data, time}) => this.compressSuccess({type: 'jpg', start, data, time}))
.finally(() => this.jpg.loading = false)
},
+
compressPNG(uint8Array, start) {
import('@/plugin/imageCompress/pngquant')
.then(_ => _.default(uint8Array, this.png.quality, this.png.speed))
.then(({data, time}) => this.compressSuccess({type: 'png', start, data, time}))
.finally(() => this.png.loading = false)
},
+
compressSuccess({type, start, data, time}) {
this[type].totalCost = (window.performance.now() - start).toFixed(2)
this[type].calcCost = time.toFixed(2)
diff --git a/vue/src/views/userCenter/components/UserCard.vue b/vue/src/views/userCenter/components/UserCard.vue
index 182866f..235a620 100644
--- a/vue/src/views/userCenter/components/UserCard.vue
+++ b/vue/src/views/userCenter/components/UserCard.vue
@@ -36,12 +36,7 @@
},
computed: {
- ...mapState('user', {
- name: state => state.name,
- avatar: state => state.avatar,
- role_name: state => state.role_name,
- admin: state => state.admin
- })
+ ...mapState('user', ['name', 'avatar', 'role_name', 'admin'])
}
}