答案解析:
diff --git a/src/layouts/navbar/index.vue b/src/layouts/navbar/index.vue
index 37ef7b9..4bceb8a 100644
--- a/src/layouts/navbar/index.vue
+++ b/src/layouts/navbar/index.vue
@@ -65,11 +65,6 @@ export default {
index: '/index/list',
title: '我的首页'
},
- {
- icon: 'el-icon-user',
- index: '/student/list',
- title: '学生管理'
- },
{
icon: 'el-icon-notebook-1',
index: '/quesBank/list',
@@ -95,15 +90,20 @@ export default {
index: '/achievement/list',
title: '成绩管理'
},
- {
- icon: 'el-icon-setting',
- index: '/system/list',
- title: '系统设置'
- },
{
icon: 'el-icon-chat-dot-round',
index: '/messageBoard/list',
title: '交流互动'
+ },
+ {
+ icon: 'el-icon-user',
+ index: '/student/list',
+ title: '学生管理'
+ },
+ {
+ icon: 'el-icon-setting',
+ index: '/system/list',
+ title: '系统设置'
}
],
menus: []
@@ -129,13 +129,7 @@ export default {
initMenu(){
if(Setting.dynamicRoute){
let routes = this.routes
- let menus = [
- {
- icon: 'el-icon-folder-checked',
- index: '/index/list',
- title: '我的首页'
- }
- ]
+ let menus = []
this.defaultMenus.map(e => {
routes.find(n => n.path == e.index) && menus.push(e)
})
diff --git a/src/libs/route/addRoutes.js b/src/libs/route/addRoutes.js
index 424cdac..d3770c7 100644
--- a/src/libs/route/addRoutes.js
+++ b/src/libs/route/addRoutes.js
@@ -31,7 +31,7 @@ export default function(data,path){
// routes[1].children = [...routes[1].children,...newRoutes]
store.dispatch('auth/addRoutes',newRoutes)
// router.addRoutes(routes)
- // setTimeout(() => {
- // !newRoutes.find(n => n.name == '/index/list') && router.push(newRoutes[0].path)
- // },10)
+ setTimeout(() => {
+ !newRoutes.find(n => n.name == '/index/list') && router.push(newRoutes[0].path)
+ },10)
}
\ No newline at end of file
diff --git a/src/libs/util.js b/src/libs/util.js
index 2943822..32458d7 100644
--- a/src/libs/util.js
+++ b/src/libs/util.js
@@ -89,6 +89,20 @@ const util = {
getFileExt(fileName) {
return fileName.substring(fileName.lastIndexOf('.') + 1)
},
+ // 传入文件名和路径,下载图片视频,支持跨域,a标签加download不支持跨域
+ downloadFile(fileName,url) {
+ var x = new XMLHttpRequest()
+ x.open("GET", url, true)
+ x.responseType = 'blob'
+ x.onload=function(e) {
+ var url = window.URL.createObjectURL(x.response)
+ var a = document.createElement('a')
+ a.href = url
+ a.download = fileName
+ a.click()
+ }
+ x.send()
+ },
}
export default util
\ No newline at end of file
diff --git a/src/main.js b/src/main.js
index 3a59e02..024b5b9 100644
--- a/src/main.js
+++ b/src/main.js
@@ -16,9 +16,12 @@ import Setting from '@/setting';
// 插件
import plugins from '@/plugins';
+import filters from '@/plugins/filters'
Vue.use(plugins);
+Object.keys(filters).forEach(item => Vue.filter(item,filters[item]))
+
Vue.prototype.api = api;
Vue.prototype.$get = get;
Vue.prototype.$post = post;
diff --git a/src/mixins/file/index.js b/src/mixins/file/index.js
index 29ff8f0..6132920 100644
--- a/src/mixins/file/index.js
+++ b/src/mixins/file/index.js
@@ -1,4 +1,5 @@
import util from '@/libs/util'
+import { Loading } from 'element-ui'
export default {
data() {
return {
@@ -7,15 +8,16 @@ export default {
iframeSrc: '',
pdfVisible: false,
pdfSrc: '',
- imgName: '',
- imgSrc: ''
+ isDownload: 0,
+ loadIns: null,
}
},
mounted() {
this.insertScript()
},
methods: {
- preview(url,isVideo){
+ preview(url,isVideo,isDownload){
+ this.isDownload = isDownload
let ext = util.getFileExt(url)
if(isVideo){
this.$get(`${this.api.getPlayAuth}/${url}`).then(res => {
@@ -63,14 +65,22 @@ export default {
this.playAuth = ''
this.player.pause()
},
- download(fileName,url){
- let ext = util.getFileExt(url)
- if(util.isImg(ext)){
- this.imgName = fileName
- this.imgSrc = url
- this.$refs.picLink.click()
+ download(fileName,url,isVideo){
+ if(isVideo){
+ this.loadIns = Loading.service()
+ this.preview(url,isVideo,1)
+ setTimeout(() => {
+ util.downloadFile(fileName,document.querySelector('#player video').src)
+ this.loadIns.close()
+ this.playAuth = ''
+ },1000)
}else{
- window.open(url)
+ let ext = util.getFileExt(url)
+ if(util.isImg(ext)){
+ util.downloadFile(fileName,url)
+ }else{
+ window.open(url)
+ }
}
}
}
diff --git a/src/pages/achievement/list/practiceResults.vue b/src/pages/achievement/list/practiceResults.vue
index a4f2ca5..59b6f61 100644
--- a/src/pages/achievement/list/practiceResults.vue
+++ b/src/pages/achievement/list/practiceResults.vue
@@ -62,9 +62,21 @@
-
-
-
+
+
+ {{scope.row.max | defaultShow}}
+
+
+
+
+ {{scope.row.min | defaultShow}}
+
+
+
+
+ {{scope.row.avg | defaultShow}}
+
+
查看详情
@@ -110,7 +122,11 @@
-
+
+
+ {{scope.row.score | defaultShow}}
+
+
查看
diff --git a/src/pages/achievement/list/wrongBook.vue b/src/pages/achievement/list/wrongBook.vue
index 565695a..c3121b0 100644
--- a/src/pages/achievement/list/wrongBook.vue
+++ b/src/pages/achievement/list/wrongBook.vue
@@ -22,7 +22,7 @@
{{fileName}}
- 下载
+ 下载
{{fileName}}
-
+ 下载
@@ -82,13 +82,12 @@