Compare commits

..

3 Commits

1 changed files with 63 additions and 13 deletions

View File

@ -4,14 +4,14 @@
<div class="page-con-left"> <div class="page-con-left">
<div class="stand-head" ref="headref"> <div class="stand-head" ref="headref">
<div class="stand-head-left"> <div class="stand-head-left">
<el-image class="imges" src="https://file.ysaix.com:7868//src/assets/images/高中语文必修上册.jpg" /> <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">{{booktitle}}</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>
<el-switch class="stand-head-right-row-switch" v-model="isOpenClass" inline-prompt active-text="公开" inactive-text="非公" /> <!-- <el-switch class="stand-head-right-row-switch" v-model="isOpenClass" inline-prompt active-text="公开" inactive-text="非公" /> -->
</div> </div>
</div> </div>
</div> </div>
@ -68,8 +68,10 @@
</div> </div>
</div> </div>
</div> </div>
<el-dialog v-model="dialogVisible" append-to-body :show-close="false" width="550"> <el-dialog v-model="dialogVisible" title="切换教材" append-to-body width="550">
<ChooseTextbook @change-book="getData" @node-click="getData" /> <div class="booklist">
<div :class="{'item': true,'active': booksel === idx}" v-for="item,idx in bookList" :key="idx" @click="bookChange(item)">{{item.edustage + item.edusubject}}</div>
</div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
@ -82,7 +84,7 @@ import { listEvaluationclue } from '@/api/teaching/classwork'
import { uploadServer, getJSONFile } from '@/utils/common' import { uploadServer, getJSONFile } from '@/utils/common'
import { ElNotification } from 'element-plus' import { ElNotification } from 'element-plus'
import ChooseTextbook from "@/components/choose-textbook/index.vue"; import ChooseTextbook from "@/components/choose-textbook/index.vue";
import { listEvaluation } from '@/api/classManage/index'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
const userStore = useUserStore() const userStore = useUserStore()
const sourceStore = useResoureStore() const sourceStore = useResoureStore()
@ -101,6 +103,10 @@ const searchref = ref(null);
const listHeight = ref(0); const listHeight = ref(0);
const dialogVisible = ref(false); const dialogVisible = ref(false);
const booktitle = ref(''); const booktitle = ref('');
const bookInfo = ref(null);
const booksel = ref(0);
const bookList = ref([])
const searchOptions = [{ const searchOptions = [{
value: '0', value: '0',
@ -109,7 +115,7 @@ const searchOptions = [{
value: '1', value: '1',
label: '按内容量', label: '按内容量',
}]; }];
const standList = ref([]) const standList = ref([]);
const showData = ref([]); const showData = ref([]);
// //
@ -234,16 +240,41 @@ const getData = (data) => {
// ID // ID
localStorage.setItem('unitId', JSON.stringify({ levelFirstId, levelSecondId})) localStorage.setItem('unitId', JSON.stringify({ levelFirstId, levelSecondId}))
} }
onMounted(() => { //
const getAllSubject = async () => {
const { rows } = await listEvaluation({ itemkey: "subject", pageSize: 500 })
const { edustage, edusubject } = userStore.user;
rows && rows.map(item => {
if(item.edustage === edustage && item.edusubject === edusubject){
bookInfo.value = {...item,avartar: import.meta.env.VITE_APP_BUILD_BASE_PATH + item.avartar}
}
if(item.fileurl !== ''){
bookList.value.push({...item,avartar: import.meta.env.VITE_APP_BUILD_BASE_PATH + item.avartar})
}
})
booksel.value = bookList.value.findIndex(item => item.edustage === edustage && item.edusubject === edusubject)
}
const bookChange = async (item, idx) => {
booksel.value = idx
bookInfo.value = {...item}
booktitle.value = `${item.edustage + item.edusubject}课程标准`
pdfUrl.value = '';
const filepath = import.meta.env.VITE_APP_RES_FILE_PATH + item.fileurl.replace('.txt','.pdf')
await loadPdfAnimation(filepath)
dialogVisible.value = false
}
const loadPdfAnimation = (path) => {
const timer = setTimeout(() => {
pdfUrl.value = path
clearTimeout(timer);
},2000)
}
onMounted(async () => {
await getAllSubject();
const { edustage, edusubject } = userStore.user; const { edustage, edusubject } = userStore.user;
booktitle.value = `${edustage + edusubject}课程标准` booktitle.value = `${edustage + edusubject}课程标准`
const filePath = `${import.meta.env.VITE_APP_RES_FILE_PATH}${edustage}-${edusubject}-课标.pdf` const filePath = `${import.meta.env.VITE_APP_RES_FILE_PATH}${edustage}-${edusubject}-课标.pdf`
const timer = setTimeout(() => { await loadPdfAnimation(filePath)
pdfUrl.value = filePath
clearTimeout(timer);
},2000)
if(cardref.value && headref.value){ if(cardref.value && headref.value){
const cardH = cardref.value.offsetHeight; const cardH = cardref.value.offsetHeight;
const headh = headref.value.offsetHeight; const headh = headref.value.offsetHeight;
@ -492,4 +523,23 @@ onMounted(() => {
} }
} }
} }
.booklist{
width: 100%;
height: 500px;
padding-top: 1px;
overflow: auto;
.item{
width: 100%;
height: auto;
padding: 8px 16px;
background-color: #ffffff;
border-top: 1px solid #f1f1f1;
font-size: 14px;
color: #3b3b3b;
}
.active{
background-color: #409eff;
color: #ffffff;
}
}
</style> </style>