Merge pull request 'qinqing_dev' (#263) from qinqing_dev into main

Reviewed-on: #263
This commit is contained in:
qinqing 2024-09-24 17:27:07 +08:00
commit f7262effc3
1 changed files with 63 additions and 13 deletions

View File

@ -4,14 +4,14 @@
<div class="page-con-left">
<div class="stand-head" ref="headref">
<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 class="stand-head-right">
<div class="stand-head-right-tit">{{booktitle}}</div>
<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-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>
@ -68,8 +68,10 @@
</div>
</div>
</div>
<el-dialog v-model="dialogVisible" append-to-body :show-close="false" width="550">
<ChooseTextbook @change-book="getData" @node-click="getData" />
<el-dialog v-model="dialogVisible" title="切换教材" append-to-body width="550">
<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>
</div>
</template>
@ -82,7 +84,7 @@ import { listEvaluationclue } from '@/api/teaching/classwork'
import { uploadServer, getJSONFile } from '@/utils/common'
import { ElNotification } from 'element-plus'
import ChooseTextbook from "@/components/choose-textbook/index.vue";
import { listEvaluation } from '@/api/classManage/index'
import useUserStore from '@/store/modules/user'
const userStore = useUserStore()
const sourceStore = useResoureStore()
@ -101,6 +103,10 @@ const searchref = ref(null);
const listHeight = ref(0);
const dialogVisible = ref(false);
const booktitle = ref('');
const bookInfo = ref(null);
const booksel = ref(0);
const bookList = ref([])
const searchOptions = [{
value: '0',
@ -109,7 +115,7 @@ const searchOptions = [{
value: '1',
label: '按内容量',
}];
const standList = ref([])
const standList = ref([]);
const showData = ref([]);
//
@ -234,16 +240,41 @@ const getData = (data) => {
// ID
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;
booktitle.value = `${edustage + edusubject}课程标准`
const filePath = `${import.meta.env.VITE_APP_RES_FILE_PATH}${edustage}-${edusubject}-课标.pdf`
const timer = setTimeout(() => {
pdfUrl.value = filePath
clearTimeout(timer);
},2000)
await loadPdfAnimation(filePath)
if(cardref.value && headref.value){
const cardH = cardref.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>