mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-20 08:16:46 +08:00
fix:共享文档下载方式修改
This commit is contained in:
@@ -794,7 +794,8 @@
|
|||||||
>{{ item.name }}</span
|
>{{ item.name }}</span
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
:href="item.response ? item.response.data : ''"
|
href="javascript:void(0);"
|
||||||
|
@click="downloadFile(item.response ? item.response.data : '')"
|
||||||
style="margin-left: 5px"
|
style="margin-left: 5px"
|
||||||
>下载</a
|
>下载</a
|
||||||
>
|
>
|
||||||
@@ -2427,6 +2428,29 @@ export default {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 共享文档文件下载
|
||||||
|
const downloadFile = (url) => {
|
||||||
|
console.log(url)
|
||||||
|
if(url){
|
||||||
|
window.open(url)
|
||||||
|
}
|
||||||
|
// if(url){
|
||||||
|
// const filename = '操作指南'
|
||||||
|
// const x = new XMLHttpRequest()
|
||||||
|
// x.open('GET', url, true)
|
||||||
|
// x.responseType = 'blob'
|
||||||
|
// x.onload = () => {
|
||||||
|
// // 会创建一个 DOMString,其中包含一个表示参数中给出的对象的URL。这个 URL 的生命周期和创建它的窗口中的 document 绑定。这个新的URL 对象表示指定的 File 对象或 Blob 对象。
|
||||||
|
// const url = window.URL.createObjectURL(x.response)
|
||||||
|
// const a = document.createElement('a')
|
||||||
|
// a.href = url
|
||||||
|
// a.download = filename
|
||||||
|
// a.click()
|
||||||
|
// }
|
||||||
|
// x.send()
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...toRefs(state),
|
...toRefs(state),
|
||||||
...toRefs(levelList),
|
...toRefs(levelList),
|
||||||
@@ -2492,6 +2516,7 @@ export default {
|
|||||||
evaluationModel,
|
evaluationModel,
|
||||||
homeworkModel,
|
homeworkModel,
|
||||||
commonModel,
|
commonModel,
|
||||||
|
downloadFile,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -671,7 +671,10 @@
|
|||||||
<span style="font: oblique bold 16px Sans-serif;width:300px;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;">{{
|
<span style="font: oblique bold 16px Sans-serif;width:300px;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;">{{
|
||||||
item.name
|
item.name
|
||||||
}}</span>
|
}}</span>
|
||||||
<a :href="item.response?item.response.data:''" style="margin-left: 5px">下载</a>
|
<a
|
||||||
|
href="javascript:void(0);"
|
||||||
|
@click="downloadFile(item.response ? item.response.data : '')"
|
||||||
|
style="margin-left: 5px">下载</a>
|
||||||
<span
|
<span
|
||||||
style="color: #4ea6ff; cursor: pointer"
|
style="color: #4ea6ff; cursor: pointer"
|
||||||
@click="deFile(item.uid)"
|
@click="deFile(item.uid)"
|
||||||
@@ -1335,6 +1338,30 @@ export default defineComponent({
|
|||||||
|
|
||||||
state.edit = true;
|
state.edit = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 共享文档文件下载
|
||||||
|
const downloadFile = (url) => {
|
||||||
|
console.log(url)
|
||||||
|
if(url){
|
||||||
|
window.open(url)
|
||||||
|
}
|
||||||
|
// if(url){
|
||||||
|
// const filename = '操作指南'
|
||||||
|
// const x = new XMLHttpRequest()
|
||||||
|
// x.open('GET', url, true)
|
||||||
|
// x.responseType = 'blob'
|
||||||
|
// x.onload = () => {
|
||||||
|
// // 会创建一个 DOMString,其中包含一个表示参数中给出的对象的URL。这个 URL 的生命周期和创建它的窗口中的 document 绑定。这个新的URL 对象表示指定的 File 对象或 Blob 对象。
|
||||||
|
// const url = window.URL.createObjectURL(x.response)
|
||||||
|
// const a = document.createElement('a')
|
||||||
|
// a.href = url
|
||||||
|
// a.download = filename
|
||||||
|
// a.click()
|
||||||
|
// }
|
||||||
|
// x.send()
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...toRefs(state),
|
...toRefs(state),
|
||||||
value,
|
value,
|
||||||
@@ -1356,7 +1383,8 @@ export default defineComponent({
|
|||||||
scoresum,
|
scoresum,
|
||||||
checkedClose,
|
checkedClose,
|
||||||
editNotice,
|
editNotice,
|
||||||
deFile
|
deFile,
|
||||||
|
downloadFile
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1097,7 +1097,10 @@
|
|||||||
:title="item.name"
|
:title="item.name"
|
||||||
>{{ item.name }}</span
|
>{{ item.name }}</span
|
||||||
>
|
>
|
||||||
<a :href="item.response?item.response.data:''" style="margin-left: 5px">下载</a>
|
<a
|
||||||
|
href="javascript:void(0);"
|
||||||
|
@click="downloadFile(item.response ? item.response.data : '')"
|
||||||
|
style="margin-left: 5px">下载</a>
|
||||||
<span
|
<span
|
||||||
style="color: #4ea6ff; float: right; cursor: pointer"
|
style="color: #4ea6ff; float: right; cursor: pointer"
|
||||||
@click="deFile(item.uid)"
|
@click="deFile(item.uid)"
|
||||||
@@ -4147,6 +4150,30 @@ export default {
|
|||||||
state.Seevisible = true;
|
state.Seevisible = true;
|
||||||
state.checkStuId = record.studentId;
|
state.checkStuId = record.studentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 共享文档文件下载
|
||||||
|
const downloadFile = (url) => {
|
||||||
|
console.log(url)
|
||||||
|
if(url){
|
||||||
|
window.open(url)
|
||||||
|
}
|
||||||
|
// if(url){
|
||||||
|
// const filename = '操作指南'
|
||||||
|
// const x = new XMLHttpRequest()
|
||||||
|
// x.open('GET', url, true)
|
||||||
|
// x.responseType = 'blob'
|
||||||
|
// x.onload = () => {
|
||||||
|
// // 会创建一个 DOMString,其中包含一个表示参数中给出的对象的URL。这个 URL 的生命周期和创建它的窗口中的 document 绑定。这个新的URL 对象表示指定的 File 对象或 Blob 对象。
|
||||||
|
// const url = window.URL.createObjectURL(x.response)
|
||||||
|
// const a = document.createElement('a')
|
||||||
|
// a.href = url
|
||||||
|
// a.download = filename
|
||||||
|
// a.click()
|
||||||
|
// }
|
||||||
|
// x.send()
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...toRefs(state),
|
...toRefs(state),
|
||||||
...toRefs(levelList),
|
...toRefs(levelList),
|
||||||
@@ -4253,6 +4280,7 @@ export default {
|
|||||||
showCodeModel,
|
showCodeModel,
|
||||||
showCodeModel2,
|
showCodeModel2,
|
||||||
checkType,
|
checkType,
|
||||||
|
downloadFile,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user