mirror of
https://github.com/fumiama/paper-manager.git
synced 2026-06-06 00:10:23 +08:00
replace router with useGo
This commit is contained in:
@@ -37,10 +37,9 @@
|
||||
import { useI18n } from '/@/hooks/web/useI18n'
|
||||
import { useDesign } from '/@/hooks/web/useDesign'
|
||||
import { useModal } from '/@/components/Modal'
|
||||
|
||||
import { useGo } from '/@/hooks/web/usePage'
|
||||
import headerImg from '/@/assets/images/header.jpg'
|
||||
import { propTypes } from '/@/utils/propTypes'
|
||||
import { router } from '/@/router'
|
||||
import { PageEnum } from '/@/enums/pageEnum'
|
||||
|
||||
import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent'
|
||||
@@ -61,6 +60,7 @@
|
||||
setup() {
|
||||
const { prefixCls } = useDesign('header-user-dropdown')
|
||||
const { t } = useI18n()
|
||||
const go = useGo()
|
||||
const userStore = useUserStore()
|
||||
|
||||
const getUserInfo = computed(() => {
|
||||
@@ -81,7 +81,7 @@
|
||||
handleLoginOut()
|
||||
break
|
||||
case 'settings':
|
||||
router.push(PageEnum.PAGE_SETTINGS)
|
||||
go(PageEnum.PAGE_SETTINGS)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<template>
|
||||
<PageWrapper title="带参数标签页" content="支持带参数多tab缓存">
|
||||
<PageWrapper :title="t('routes.filelist.file')">
|
||||
<template #headerContent>
|
||||
<a-button type="primary"> 下载试卷 </a-button>
|
||||
</template>
|
||||
<div ref="chartRef" :style="{ height, width }"></div>
|
||||
<div class="docxWrap" :style="{ width }">
|
||||
<div ref="docxRef"></div>
|
||||
@@ -14,10 +17,13 @@
|
||||
import { renderAsync } from 'docx-preview'
|
||||
import { downloadFile } from '/@/api/page'
|
||||
import { DownloadFile } from '/@/api/page/model/fileModel'
|
||||
import { router } from '/@/router'
|
||||
import { useGo } from '/@/hooks/web/usePage'
|
||||
import { PageEnum } from '/@/enums/pageEnum'
|
||||
import { useI18n } from '/@/hooks/web/useI18n'
|
||||
import axios from 'axios'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
let docxRef = ref(null)
|
||||
|
||||
function loadDocx(file: Blob) {
|
||||
@@ -36,7 +42,7 @@
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
name: 'TestTab',
|
||||
name: 'PaperAnalyzeTab',
|
||||
components: { PageWrapper },
|
||||
props: {
|
||||
width: {
|
||||
@@ -50,13 +56,14 @@
|
||||
},
|
||||
setup() {
|
||||
const { currentRoute } = useRouter()
|
||||
const go = useGo()
|
||||
|
||||
const params = computed(() => {
|
||||
return unref(currentRoute).params
|
||||
})
|
||||
|
||||
if (!params.value || !params.value.id) {
|
||||
router.push(PageEnum.ERROR_PAGE)
|
||||
go(PageEnum.ERROR_PAGE)
|
||||
}
|
||||
|
||||
downloadFile(Number(params.value.id)).then((file: DownloadFile) => {
|
||||
@@ -94,7 +101,7 @@
|
||||
left: '2%',
|
||||
top: '1%',
|
||||
textStyle: {
|
||||
fontSize: 36,
|
||||
fontSize: 20,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -102,7 +109,7 @@
|
||||
left: '40%',
|
||||
top: '1%',
|
||||
textStyle: {
|
||||
fontSize: 36,
|
||||
fontSize: 20,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -110,7 +117,7 @@
|
||||
left: '2%',
|
||||
top: '50%',
|
||||
textStyle: {
|
||||
fontSize: 36,
|
||||
fontSize: 20,
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -188,6 +195,7 @@
|
||||
})
|
||||
})
|
||||
return {
|
||||
t,
|
||||
chartRef,
|
||||
docxRef,
|
||||
}
|
||||
|
||||
@@ -41,7 +41,13 @@
|
||||
<template #title>
|
||||
<span>{{ item.title }}</span>
|
||||
<div class="extra">
|
||||
<a-button color="success" :disabled="item.percent < 100"> 查阅 </a-button>
|
||||
<a-button
|
||||
color="success"
|
||||
:disabled="item.percent < 100"
|
||||
@click="openFile(item.id)"
|
||||
>
|
||||
查阅
|
||||
</a-button>
|
||||
|
||||
<a-button
|
||||
color="warning"
|
||||
@@ -111,6 +117,8 @@
|
||||
import { uploadApi } from '/@/api/sys/upload'
|
||||
import { useI18n } from '/@/hooks/web/useI18n'
|
||||
import { delFile, analyzeFile } from '/@/api/page'
|
||||
import { useGo } from '/@/hooks/web/usePage'
|
||||
import { PageEnum } from '/@/enums/pageEnum'
|
||||
|
||||
const { t } = useI18n()
|
||||
const { createMessage } = useMessage()
|
||||
@@ -163,6 +171,11 @@
|
||||
},
|
||||
setup() {
|
||||
const { hasPermission } = usePermission()
|
||||
const go = useGo()
|
||||
|
||||
function openFile(id: number) {
|
||||
go(PageEnum.PAGE_FILELIST + '/file/' + id)
|
||||
}
|
||||
|
||||
return {
|
||||
t,
|
||||
@@ -174,6 +187,7 @@
|
||||
hasPermission,
|
||||
prefixCls: 'list-basic',
|
||||
getListOfPage,
|
||||
openFile,
|
||||
deleteFile,
|
||||
analyzeFile: analFile,
|
||||
cardList,
|
||||
|
||||
Reference in New Issue
Block a user