Merge branch 'main' of http://27.128.240.72:3000/zhuhao/AIx_Smarttalk into zdg
This commit is contained in:
commit
13e755bb9a
|
@ -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 = {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<el-tabs v-model="active" class="demo-tabs" @tab-change="handleClick">
|
||||
<template v-for="(item,index) in gradeList" :key="index">
|
||||
<el-tab-pane :label="item.label" :name="item.value">
|
||||
<el-tab-pane :label="item.label" :name="item.value" disabled>
|
||||
<SelectSubject ref="selectSubject" :subjectList="subjectList" @clickTag="getTagId"></SelectSubject>
|
||||
</el-tab-pane>
|
||||
</template>
|
||||
|
@ -14,22 +14,34 @@ 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
|
||||
const textbookVersionId = ref(0)
|
||||
//不需要切换年级教材了
|
||||
const handleClick = (tab) => {
|
||||
console.log(tab,'tab')
|
||||
getSubject(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 +56,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>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -88,6 +88,10 @@ export const gradeList = [
|
|||
]
|
||||
//课件类别
|
||||
export const coursewareTypeList = [
|
||||
{
|
||||
label:'全部',
|
||||
value:''
|
||||
},
|
||||
{
|
||||
label:'课件',
|
||||
value:3
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -69,7 +69,7 @@ export default defineStore('resource', {
|
|||
bookId:0,
|
||||
stage:0,
|
||||
subjectId:0,
|
||||
type:3,
|
||||
type:'',
|
||||
title:''
|
||||
},
|
||||
result: {
|
||||
|
|
Loading…
Reference in New Issue