优化PDF插件几课标教材分析逻辑优化
This commit is contained in:
parent
e7a36ddfba
commit
cf38097739
File diff suppressed because one or more lines are too long
|
@ -294,7 +294,7 @@ See https://github.com/adobe-type-tools/cmap-resources
|
||||||
</span>
|
</span>
|
||||||
<span id="numPages" class="toolbarLabel"></span>
|
<span id="numPages" class="toolbarLabel"></span>
|
||||||
</div>
|
</div>
|
||||||
<div id="toolbarViewerRight" style="display: none;">
|
<div id="toolbarViewerRight">
|
||||||
<div id="editorModeButtons" class="splitToolbarButton toggled" role="radiogroup">
|
<div id="editorModeButtons" class="splitToolbarButton toggled" role="radiogroup">
|
||||||
<button id="editorHighlight" class="toolbarButton" hidden="true" disabled="disabled" title="Highlight" role="radio" aria-checked="false" aria-controls="editorHighlightParamsToolbar" tabindex="31" data-l10n-id="pdfjs-editor-highlight-button">
|
<button id="editorHighlight" class="toolbarButton" hidden="true" disabled="disabled" title="Highlight" role="radio" aria-checked="false" aria-controls="editorHighlightParamsToolbar" tabindex="31" data-l10n-id="pdfjs-editor-highlight-button">
|
||||||
<span data-l10n-id="pdfjs-editor-highlight-button-label">Highlight</span>
|
<span data-l10n-id="pdfjs-editor-highlight-button-label">Highlight</span>
|
||||||
|
|
|
@ -16,11 +16,10 @@ const props = defineProps({
|
||||||
/**pdf文件地址 */
|
/**pdf文件地址 */
|
||||||
const pdfUrl = ref('');
|
const pdfUrl = ref('');
|
||||||
/**pdfjs文件地址 */
|
/**pdfjs文件地址 */
|
||||||
const fileUrl = '/pdfjs-dist/web/viewer.html?file=';
|
const fileUrl = '/pdfjs-dist/web/viewer.html?pagemode=attachments&file=';
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
/** 将传入的pdf地址进行编码,防止中文识别错误 */
|
/** 将传入的pdf地址进行编码,防止中文识别错误 */
|
||||||
pdfUrl.value = fileUrl + encodeURIComponent(props.url)
|
pdfUrl.value = fileUrl + encodeURIComponent(props.url)
|
||||||
console.log('组件',pdfUrl.value);
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<el-image class="imges" :src="bookInfo ? bookInfo.avartar : ''" />
|
<el-image class="imges" :src="bookInfo ? bookInfo.avartar : ''" />
|
||||||
</div>
|
</div>
|
||||||
<div class="stand-head-right">
|
<div class="stand-head-right">
|
||||||
<div class="stand-head-right-tit">{{booktitle}}</div>
|
<div class="stand-head-right-tit">{{bookInfo ? bookInfo.bookName : ''}}</div>
|
||||||
<i class="iconfont icon-yidongdaozu stand-head-right-icon" @click="dialogVisible = true"></i>
|
<i class="iconfont icon-yidongdaozu stand-head-right-icon" @click="dialogVisible = true"></i>
|
||||||
<div class="stand-head-right-row">
|
<div class="stand-head-right-row">
|
||||||
<div class="stand-head-right-row-time">更新2024.9.10</div>
|
<div class="stand-head-right-row-time">更新2024.9.10</div>
|
||||||
|
@ -68,11 +68,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<el-dialog v-model="dialogVisible" title="切换教材" append-to-body width="550">
|
<el-dialog v-model="dialogVisible" title="切换课标" append-to-body width="550">
|
||||||
<div class="booklist">
|
<div class="booklist">
|
||||||
<div :class="{'item': true,'active': booksel === idx}" v-for="item,idx in bookList" :key="idx" @click="bookChange(item,idx)">
|
<div :class="{'item': true,'active': booksel === idx}" v-for="item,idx in bookList" :key="idx" @click="bookChange(item,idx)">
|
||||||
<el-image class="bookimg" :src="item.avartar" />
|
<el-image class="bookimg" :src="item.avartar" />
|
||||||
<div class="bookname">{{item.fileurl.replace('.txt', '')}}</div>
|
<div class="bookname">{{item.bookName}}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
@ -105,7 +105,6 @@ const headref = ref(null);
|
||||||
const searchref = ref(null);
|
const searchref = ref(null);
|
||||||
const listHeight = ref(0);
|
const listHeight = ref(0);
|
||||||
const dialogVisible = ref(false);
|
const dialogVisible = ref(false);
|
||||||
const booktitle = ref('');
|
|
||||||
const bookInfo = ref(null);
|
const bookInfo = ref(null);
|
||||||
const booksel = ref(0);
|
const booksel = ref(0);
|
||||||
const bookList = ref([])
|
const bookList = ref([])
|
||||||
|
@ -246,23 +245,24 @@ const getAllSubject = async () => {
|
||||||
const { rows } = await listEvaluation({ itemkey: "subject", pageSize: 500 })
|
const { rows } = await listEvaluation({ itemkey: "subject", pageSize: 500 })
|
||||||
const { edustage, edusubject } = userStore.user;
|
const { edustage, edusubject } = userStore.user;
|
||||||
rows && rows.map(item => {
|
rows && rows.map(item => {
|
||||||
if(item.edustage === edustage && item.edusubject === edusubject){
|
if(edustage === item.edustage && item.edusubject === edusubject){
|
||||||
bookInfo.value = {...item,avartar: import.meta.env.VITE_APP_BUILD_BASE_PATH + item.avartar}
|
bookInfo.value = {...item,avartar: import.meta.env.VITE_APP_BUILD_BASE_PATH + item.avartar,bookName: bookNameFormat(item.edustage,item.edusubject)}
|
||||||
}
|
}
|
||||||
if(item.fileurl !== ''){
|
if(item.fileurl !== ''){
|
||||||
bookList.value.push({...item,avartar: import.meta.env.VITE_APP_BUILD_BASE_PATH + item.avartar})
|
bookList.value.push({...item,avartar: import.meta.env.VITE_APP_BUILD_BASE_PATH + item.avartar,bookName: bookNameFormat(item.edustage,item.edusubject)})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const textselidx = bookList.value.findIndex(item => item.edustage === edustage && item.edusubject === edusubject)
|
const textselidx = bookList.value.findIndex(item => item.edustage === edustage && item.edusubject === edusubject)
|
||||||
booksel.value = textselidx
|
booksel.value = textselidx
|
||||||
booktitle.value = bookList.value[textselidx].fileurl.replace('.txt','')
|
|
||||||
const filePath = import.meta.env.VITE_APP_RES_FILE_PATH + bookList.value[textselidx].fileurl.replace('.txt','.pdf')
|
const filePath = import.meta.env.VITE_APP_RES_FILE_PATH + bookList.value[textselidx].fileurl.replace('.txt','.pdf')
|
||||||
await loadPdfAnimation(filePath)
|
await loadPdfAnimation(filePath)
|
||||||
}
|
}
|
||||||
|
const bookNameFormat = (edustage,edusubject) => {
|
||||||
|
return `${edustage}-${edusubject}`
|
||||||
|
}
|
||||||
const bookChange = async (item, idx) => {
|
const bookChange = async (item, idx) => {
|
||||||
booksel.value = idx
|
booksel.value = idx
|
||||||
bookInfo.value = {...item}
|
bookInfo.value = {...item}
|
||||||
booktitle.value = item.fileurl.replace('.txt','')
|
|
||||||
pdfUrl.value = '';
|
pdfUrl.value = '';
|
||||||
const filepath = import.meta.env.VITE_APP_RES_FILE_PATH + item.fileurl.replace('.txt','.pdf')
|
const filepath = import.meta.env.VITE_APP_RES_FILE_PATH + item.fileurl.replace('.txt','.pdf')
|
||||||
await loadPdfAnimation(filepath)
|
await loadPdfAnimation(filepath)
|
||||||
|
@ -539,9 +539,9 @@ onMounted(async () => {
|
||||||
width: 130px;
|
width: 130px;
|
||||||
height: 180px;
|
height: 180px;
|
||||||
}
|
}
|
||||||
.name{
|
.bookname{
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #3b3b3b;
|
text-align: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.item:hover{
|
.item:hover{
|
||||||
|
|
|
@ -244,19 +244,17 @@ const getData = (data) => {
|
||||||
// 获取学科
|
// 获取学科
|
||||||
const getAllSubject = async () => {
|
const getAllSubject = async () => {
|
||||||
const { edustage, edusubject } = userStore.user;
|
const { edustage, edusubject } = userStore.user;
|
||||||
const { rows } = await listEvaluation({ itemkey: "version", edustage, edusubject, pageSize: 500 })
|
const { rows } = await listEvaluation({ itemkey: "version", edustage, edusubject, orderby: 'orderidx asc', pageSize: 500 })
|
||||||
rows && rows.map(item => {
|
const dataList = [];
|
||||||
if(item.edustage === edustage && item.edusubject === edusubject){
|
rows && rows.map((item,idx) => {
|
||||||
bookInfo.value = {...item,avartar: import.meta.env.VITE_APP_BUILD_BASE_PATH + item.avartar}
|
|
||||||
}
|
|
||||||
if(item.fileurl !== ''){
|
if(item.fileurl !== ''){
|
||||||
bookList.value.push({...item,avartar: import.meta.env.VITE_APP_BUILD_BASE_PATH + item.avartar})
|
dataList.push({...item,avartar: import.meta.env.VITE_APP_BUILD_BASE_PATH + item.avartar})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const textselidx = bookList.value.findIndex(item => item.edustage === edustage && item.edusubject === edusubject)
|
bookList.value = dataList
|
||||||
booksel.value = textselidx
|
bookInfo.value = {...dataList[0],avartar: dataList[0].avartar}
|
||||||
booktitle.value = bookList.value[textselidx].fileurl.replace('.txt','')
|
booktitle.value = dataList[0].fileurl.replace('.txt','')
|
||||||
const filePath = import.meta.env.VITE_APP_RES_FILE_PATH + bookList.value[textselidx].fileurl.replace('.txt','.pdf')
|
const filePath = import.meta.env.VITE_APP_RES_FILE_PATH + dataList[0].fileurl.replace('.txt','.pdf')
|
||||||
await loadPdfAnimation(filePath)
|
await loadPdfAnimation(filePath)
|
||||||
}
|
}
|
||||||
const bookChange = async (item, idx) => {
|
const bookChange = async (item, idx) => {
|
||||||
|
|
Loading…
Reference in New Issue