Compare commits

...

2 Commits

6 changed files with 43 additions and 29 deletions

View File

@ -5,8 +5,9 @@
<el-dropdown style="width: 100%;height: 100%">
<div class="el-dropdown-link flex" style="width: 100%;height: 100%;justify-content: space-between;align-items: center">
<span>{{titleName}}</span>
<i class="iconfont icon-xiangyou"></i>
<!-- <i class="iconfont icon-xiangyou"></i>-->
</div>
<!-- 学科学段选择-->
<template #dropdown>
<div style="width: 300px;padding: 20px">
<ThirdIndex @getVertion="getVertion"></ThirdIndex>
@ -29,10 +30,12 @@ import ThirdIndex from './third/index.vue'
import {nextTick, reactive, ref,onMounted,watch} from 'vue'
import {getBook, getTextbook} from '@/api/file/third'
import useThirdStore from '@/store/modules/thirdTextbook'
import useUserStore from '@/store/modules/user'
const useThird = useThirdStore()
const useStore = useUserStore()
const emit = defineEmits(['nodeClick'])
const titleName = ref('小学-语文')
const titleName = ref('')
//
const treeData = ref([])
//
@ -158,16 +161,12 @@ const handleNodeClick = (data,node) => {
}
//
onMounted(() => {
const info = localStorage.getItem('selectBookInfo')
if(info){
const {gradeName,subjectName} = JSON.parse(info)
titleName.value = `${gradeName}-${subjectName}`
}
titleName.value = `${useStore.user.edustage}-${useStore.user.edusubject}`
treeLoading.value = true
})
//
watch(() => useThird,() => {
titleName.value = `${useThird.gradeName}-${useThird.subjectName}`
titleName.value = `${useStore.user.edustage}-${useStore.user.edusubject}`
},{deep:true})
const defaultProps = {

View File

@ -14,10 +14,12 @@ import { gradeList } from '@/utils/resourceDict'
import SelectSubject from './selectSubject.vue'
import {getSubjects,getTextbookVersion} from '@/api/file/third'
import useThirdStore from '@/store/modules/thirdTextbook'
import useUserStore from '@/store/modules/user'
const useThird = useThirdStore()
const useStore = useUserStore()
const emit = defineEmits(['getVertion'])
const active = ref(useThird.activeGrade || gradeList[0].value)
const active = ref(1)
//
const subjectList = ref([])
//id
@ -27,9 +29,17 @@ const handleClick = (tab) => {
}
//
const getSubject = (value) => {
const currentIndex = gradeList.findIndex(item => item.value === value)
getSubjects({stage:value}).then(res => {
if(res.code === 200){
subjectList.value = [...res.data]
subjectList.value = res.data.map(item => {
return {
...item,
gradeName:gradeList[currentIndex].label
}
})
const nameIndex = subjectList.value.findIndex(item => item.subjectName === useStore.user.edusubject)
getTagId({subjectId:subjectList.value[nameIndex].subjectId,subjectName:subjectList.value[nameIndex].subjectName})
if(textbookVersionId.value === 0){
getTagId(subjectList.value[0])
}
@ -44,21 +54,14 @@ const getTagId = (item) => {
if(res.code === 200){
emit('getVertion',res.data)
useThird.getSelectBookInfo({...item,activeGrade:active.value,gradeName:gradeList[currentIndex].label})
localStorage.setItem('selectBookInfo',JSON.stringify({...item,activeGrade:active.value,gradeName:gradeList[currentIndex].label}))
}
})
}
onMounted(() => {
const currentIndex = gradeList.findIndex(item => item.label === useStore.user.edustage)
//
handleClick(active.value)
//
const info = localStorage.getItem('selectBookInfo')
if(info){
const {activeGrade,subjectId,subjectName} = JSON.parse(info)
active.value = activeGrade
//
getTagId({subjectId:subjectId,subjectName:subjectName})
}
getSubject(gradeList[currentIndex].value)
active.value = gradeList[currentIndex].value
})
</script>

View File

@ -1,11 +1,11 @@
<template>
<template v-for="item in subjectList" :key="item.subjectId">
<el-tag
type="primary"
:type="useStore.user.edusubject === item.subjectName && useStore.user.edustage === item.gradeName ? 'primary' : 'info'"
effect="dark"
round
style="cursor: pointer;margin-right: 5px;margin-top: 5px;"
@click="clickTag(item)"
class="tagItem"
:style="useStore.user.edusubject === item.subjectName && useStore.user.edustage === item.gradeName ? {'cursor': 'pointer'} : {'cursor': 'no-Drop'}"
>
{{ item.subjectName }}
</el-tag>
@ -13,6 +13,8 @@
</template>
<script setup name="selectSubject">
import useUserStore from "@/store/modules/user";
const useStore = useUserStore()
const props = defineProps({
subjectList: {
type: Array,
@ -20,11 +22,14 @@ const props = defineProps({
}
})
const emit = defineEmits(['clickTag'])
const clickTag = (item) => {
emit('clickTag',item)
}
// const clickTag = (item) => {
// emit('clickTag',item)
// }
</script>
<style scoped>
.tagItem{
margin-right: 5px;
margin-top: 5px;
}
</style>

View File

@ -88,6 +88,10 @@ export const gradeList = [
]
//课件类别
export const coursewareTypeList = [
{
label:'全部',
value:''
},
{
label:'课件',
value:3

View File

@ -53,7 +53,7 @@
</template>
<script setup>
import {watch,ref} from 'vue'
import {watch,ref,onMounted} from 'vue'
import useResoureStore from '../store'
import {coursewareTypeList} from '@/utils/resourceDict'
const isThird = ref(false)
@ -71,6 +71,9 @@ const debouncedChangeName = debounce(sourceStore.changeName, 300);
const onchangeInput = () => {
debouncedChangeName()
}
onMounted(() => {
sourceStore.query.fileSource = '平台'
})
watch(() => sourceStore.query.fileSource,() => {
sourceStore.query.fileSource === '第三方'?isThird.value = true:isThird.value = false

View File

@ -69,7 +69,7 @@ export default defineStore('resource', {
bookId:0,
stage:0,
subjectId:0,
type:3,
type:'',
title:''
},
result: {