|
@@ -55,12 +55,11 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import { downloadRealPaper, paperGrade, papersCancelCollect, papersCollect, papersList } from '@/api/webApi/webQue.js'
|
|
|
+import { paperGrade, papersList } from '@/api/webApi/webQue.js'
|
|
|
import { mapGetters } from 'vuex'
|
|
|
import MxCondition from '@/components/MxCondition/mx-condition'
|
|
|
import MxSearchGroup from '@/components/MxSearch/mx-search-group'
|
|
|
-import MxConst from "@/common/MxConst";
|
|
|
-import {downloadOssFile} from "@/utils/download-helper";
|
|
|
+import PaperActionsMixin from "@/views/questioncenter/components/paper-actions-mixin";
|
|
|
|
|
|
export default {
|
|
|
name: 'famous-paper',
|
|
@@ -68,6 +67,7 @@ export default {
|
|
|
MxCondition,
|
|
|
MxSearchGroup
|
|
|
},
|
|
|
+ mixins: [PaperActionsMixin],
|
|
|
data() {
|
|
|
return {
|
|
|
queryParams: {
|
|
@@ -93,43 +93,6 @@ export default {
|
|
|
...mapGetters(['period', 'isFrontTeacher'])
|
|
|
},
|
|
|
methods: {
|
|
|
- _combineOssPath(item) {
|
|
|
- const {osspath, filename} = item
|
|
|
- return `${this.$ossBase}/${osspath}/${filename}`
|
|
|
- },
|
|
|
- _ossPreview(url) {
|
|
|
- const pdfSuffixes = ['.pdf']
|
|
|
- const msSuffixes = ['.doc','.ppt','.xls','.docx', 'pptx', '.xlsx']
|
|
|
- if (pdfSuffixes.some(s => url.endsWith(s))) {
|
|
|
- window.open('/pdfView/index.html?src=' + url)
|
|
|
- } else if (msSuffixes.some(s => url.endsWith(s))) {
|
|
|
- window.open('https://view.officeapps.live.com/op/view.aspx?src=' + url)
|
|
|
- } else {
|
|
|
- this.$message.error('格式错误,无法预览该格式文件!');
|
|
|
- }
|
|
|
- },
|
|
|
- paperDownLoad(item) {
|
|
|
- const {id: paperId, paperSource, filename} = item
|
|
|
- if (paperSource == MxConst.enum.paper.paperSource.oss) {
|
|
|
- const ossFullPath = this._combineOssPath(item)
|
|
|
- downloadOssFile(ossFullPath, filename)
|
|
|
- return
|
|
|
- }
|
|
|
- downloadRealPaper(paperId, this.period)
|
|
|
- },
|
|
|
- // 跳转到预览页面
|
|
|
- toPreView(item) {
|
|
|
- const {id: paperId, papername: paperName, paperSource} = item
|
|
|
- if (paperSource == MxConst.enum.paper.paperSource.oss) {
|
|
|
- const ossFullPath = this._combineOssPath(item)
|
|
|
- this._ossPreview(ossFullPath)
|
|
|
- return
|
|
|
- }
|
|
|
- this.$router.push({
|
|
|
- path: '/question-center/bestPaper/preview',
|
|
|
- query: { paperId, paperName }
|
|
|
- })
|
|
|
- },
|
|
|
// 获取试卷列表
|
|
|
getPaperList() {
|
|
|
papersList({
|
|
@@ -145,26 +108,9 @@ export default {
|
|
|
clickSuffix() {
|
|
|
this.getPaperList()
|
|
|
},
|
|
|
- // 收藏
|
|
|
- collect(item) {
|
|
|
- item.collect = !item.collect
|
|
|
- papersCollect({ paperId: item.id }).then((res) => {
|
|
|
- this.msgSuccess('收藏成功')
|
|
|
- })
|
|
|
- },
|
|
|
- // 取消收藏
|
|
|
- cancelCollect(item) {
|
|
|
- item.collect = !item.collect
|
|
|
- papersCancelCollect({ paperId: item.id }).then((res) => {
|
|
|
- this.msgSuccess('取消收藏成功')
|
|
|
- })
|
|
|
- },
|
|
|
togglePage() {
|
|
|
this.getPaperList()
|
|
|
},
|
|
|
- handleInvalidQuery() {
|
|
|
- // todo
|
|
|
- },
|
|
|
handleQuery(model) {
|
|
|
this.firedParams = model
|
|
|
this.getPaperList()
|