Merge branch 'main' into zhuhao_dev
This commit is contained in:
commit
926f45f232
|
@ -14,14 +14,14 @@ const defaultData = {
|
||||||
isPdfWin: false, // pdf窗口是否打开
|
isPdfWin: false, // pdf窗口是否打开
|
||||||
isToolWin: false, // 工具窗口是否打开
|
isToolWin: false, // 工具窗口是否打开
|
||||||
curSubjectNode: {
|
curSubjectNode: {
|
||||||
data: {}, // 当前教材节点 (包含当前教材 单元)
|
|
||||||
querySearch: {} // 查询资源所需参数
|
querySearch: {} // 查询资源所需参数
|
||||||
},
|
},
|
||||||
subject: {
|
subject: { // 不走同步 Pinia
|
||||||
bookList: null, // 教材列表
|
bookList: null, // 教材列表
|
||||||
curBook: null, // 当前选中的教材
|
curBook: null, // 当前选中的教材
|
||||||
curNode: null, // 当前选中的节点
|
curNode: null, // 当前选中的节点
|
||||||
defaultExpandedKeys: [], //展开的节点
|
defaultExpandedKeys: [], //展开的节点
|
||||||
|
subjectTree: [] // "树结构" 章节
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
local: { // 本地(永久localStorage)
|
local: { // 本地(永久localStorage)
|
||||||
|
|
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>
|
||||||
|
|
|
@ -21,7 +21,6 @@ const fileUrl = getAppInstallUrl('pdfjs-dist/web/viewer.html', 'user', '\\out\\r
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
/** 将传入的pdf地址进行编码,防止中文识别错误 */
|
/** 将传入的pdf地址进行编码,防止中文识别错误 */
|
||||||
pdfUrl.value = fileUrl + encodeURIComponent(props.url)
|
pdfUrl.value = fileUrl + encodeURIComponent(props.url)
|
||||||
console.log('组件',pdfUrl.value);
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -181,6 +181,8 @@ onMounted( async () => {
|
||||||
|
|
||||||
// 章节"树"
|
// 章节"树"
|
||||||
treeData.value = useSubject.getTreeData(curBook.data.id)
|
treeData.value = useSubject.getTreeData(curBook.data.id)
|
||||||
|
sessionStore.set('subject.subjectTree',useSubject.getTreeData(curBook.data.id))
|
||||||
|
|
||||||
nextTick(() =>{
|
nextTick(() =>{
|
||||||
// 默认展开 选中
|
// 默认展开 选中
|
||||||
if(sessionStore.get('subject.curNode')){
|
if(sessionStore.get('subject.curNode')){
|
||||||
|
|
|
@ -145,7 +145,6 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
window.test = this
|
|
||||||
this.slotKeys = Object.keys(this.$slots)
|
this.slotKeys = Object.keys(this.$slots)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -285,7 +285,7 @@ onMounted(async () => {
|
||||||
canvas2.canvas.setWidth(window.innerWidth / 2 - 100)
|
canvas2.canvas.setWidth(window.innerWidth / 2 - 100)
|
||||||
// canvas2.canvas.isDrawingMode=false
|
// canvas2.canvas.isDrawingMode=false
|
||||||
canvas1FabricVue.value = canvas2
|
canvas1FabricVue.value = canvas2
|
||||||
window.test = { canvas1, canvas2 }
|
// window.test = { canvas1, canvas2 }
|
||||||
emit('update:numPagesTotal', pdf.numPages)
|
emit('update:numPagesTotal', pdf.numPages)
|
||||||
|
|
||||||
if (props.pdfObj.allPageData.length) {
|
if (props.pdfObj.allPageData.length) {
|
||||||
|
|
|
@ -294,7 +294,7 @@ onMounted(async () => {
|
||||||
canvas2.canvas.setWidth(window.innerWidth / 2 - 100)
|
canvas2.canvas.setWidth(window.innerWidth / 2 - 100)
|
||||||
// canvas2.canvas.isDrawingMode=false
|
// canvas2.canvas.isDrawingMode=false
|
||||||
canvas1FabricVue.value = canvas2
|
canvas1FabricVue.value = canvas2
|
||||||
window.test = { canvas1, canvas2 }
|
// window.test = { canvas1, canvas2 }
|
||||||
emit('update:numPagesTotal', pdf.numPages)
|
emit('update:numPagesTotal', pdf.numPages)
|
||||||
|
|
||||||
if (props.pdfObj.allPageData.length) {
|
if (props.pdfObj.allPageData.length) {
|
||||||
|
|
|
@ -6,6 +6,9 @@ import { sessionStore } from '@/utils/store'
|
||||||
|
|
||||||
// 默认数据
|
// 默认数据
|
||||||
const defData = sessionStore.store || {}
|
const defData = sessionStore.store || {}
|
||||||
|
const exArrs = ['subject']
|
||||||
|
exArrs.forEach(k => Object.keys(defData).includes(k) && (delete defData[k]))
|
||||||
|
|
||||||
// 延时
|
// 延时
|
||||||
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
|
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
|
||||||
|
|
||||||
|
@ -16,7 +19,6 @@ export const useToolState = defineStore('tool', {
|
||||||
isPdfWin: false, // pdf窗口是否打开
|
isPdfWin: false, // pdf窗口是否打开
|
||||||
isToolWin: false, // 工具窗口是否打开
|
isToolWin: false, // 工具窗口是否打开
|
||||||
curSubjectNode: {
|
curSubjectNode: {
|
||||||
data: {}, // 当前教材节点 (包含当前教材 单元)
|
|
||||||
querySearch: {} // 查询资源所需参数
|
querySearch: {} // 查询资源所需参数
|
||||||
},
|
},
|
||||||
...defData // 默认数据-覆盖上面的配置(不要删除, 会导致新窗口-获取状态失败)
|
...defData // 默认数据-覆盖上面的配置(不要删除, 会导致新窗口-获取状态失败)
|
||||||
|
|
|
@ -234,7 +234,7 @@ const openDialog = (data) => {
|
||||||
classWorkAnalysis.activeQuizAnalysisData = []
|
classWorkAnalysis.activeQuizAnalysisData = []
|
||||||
|
|
||||||
classWorkAnalysis.row = data
|
classWorkAnalysis.row = data
|
||||||
window.test = this
|
// window.test = this
|
||||||
// zdg: 学生列表
|
// zdg: 学生列表
|
||||||
const studentArr = data.classworkdatastudentids
|
const studentArr = data.classworkdatastudentids
|
||||||
? JSON.parse(`[${data.classworkdatastudentids}]`)
|
? JSON.parse(`[${data.classworkdatastudentids}]`)
|
||||||
|
@ -539,6 +539,10 @@ const workHandle = (type) => {
|
||||||
classWorkAnalysis.view = type
|
classWorkAnalysis.view = type
|
||||||
const isClose = type != 'quizStats' && !! classWorkActiveData.timerId
|
const isClose = type != 'quizStats' && !! classWorkActiveData.timerId
|
||||||
const isOpen = type == 'quizStats' && !classWorkActiveData.timerId
|
const isOpen = type == 'quizStats' && !classWorkActiveData.timerId
|
||||||
|
// 每次进来都重新调用一次
|
||||||
|
if(type == 'quizStats') {
|
||||||
|
getWorkFeedList();
|
||||||
|
}
|
||||||
if (isClose) clearInterval(classWorkActiveData.timerId) // 关闭定时器
|
if (isClose) clearInterval(classWorkActiveData.timerId) // 关闭定时器
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
// 轮询 更新学生作答数据
|
// 轮询 更新学生作答数据
|
||||||
|
|
|
@ -44,7 +44,6 @@
|
||||||
v-model="ruleForm.address"
|
v-model="ruleForm.address"
|
||||||
:options="regionData"
|
:options="regionData"
|
||||||
@change="handleChange"
|
@change="handleChange"
|
||||||
:props="{checkStrictly: true}"
|
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="学校" prop="school" v-if="activeIndex==2">
|
<el-form-item label="学校" prop="school" v-if="activeIndex==2">
|
||||||
|
@ -233,23 +232,24 @@ const OpenModel = v =>{
|
||||||
// 关闭弹窗
|
// 关闭弹窗
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
var restValue={
|
var restValue={
|
||||||
name: '',
|
name: '',
|
||||||
idNumber:'',
|
idNumber:'',
|
||||||
phoneNumber: '',
|
phoneNumber: '',
|
||||||
Code:'',
|
Code:'',
|
||||||
password:'',
|
password:'',
|
||||||
confirmPassword:'',
|
confirmPassword:'',
|
||||||
class:[],
|
class:[],
|
||||||
discipline:[],
|
discipline:[],
|
||||||
school:[],
|
school:[100,255,279],
|
||||||
}
|
address:["50","5001","500101"]
|
||||||
|
}
|
||||||
Object.assign(ruleForm, restValue);
|
Object.assign(ruleForm, restValue);
|
||||||
schoolSubject.value=[]
|
schoolSubject.value=[]
|
||||||
gradeTree.value=[]
|
gradeTree.value=[]
|
||||||
if (ruleFormRef.value) ruleFormRef.value.resetFields()
|
if (ruleFormRef.value) ruleFormRef.value.resetFields()
|
||||||
removeToken();
|
removeToken();
|
||||||
activeIndex.value=1
|
|
||||||
dialogVisible.value=false
|
dialogVisible.value=false
|
||||||
|
activeIndex.value=1
|
||||||
}
|
}
|
||||||
|
|
||||||
const nextStep = (formEl) => {
|
const nextStep = (formEl) => {
|
||||||
|
@ -346,13 +346,14 @@ const submitForm = async (formEl) => {
|
||||||
confirmPassword:'',
|
confirmPassword:'',
|
||||||
class:[],
|
class:[],
|
||||||
discipline:[],
|
discipline:[],
|
||||||
school:[],
|
school:[100,255,279],
|
||||||
|
address:["50","5001","500101"]
|
||||||
}
|
}
|
||||||
schoolSubject.value=[]
|
schoolSubject.value=[]
|
||||||
gradeTree.value=[]
|
gradeTree.value=[]
|
||||||
Object.assign(ruleForm, restValue);
|
Object.assign(ruleForm, restValue);
|
||||||
|
dialogVisible.value=false
|
||||||
activeIndex.value=1
|
activeIndex.value=1
|
||||||
dialogVisible.value=false
|
|
||||||
}else{
|
}else{
|
||||||
ElMessage.error(res.msg)
|
ElMessage.error(res.msg)
|
||||||
}
|
}
|
||||||
|
@ -495,7 +496,7 @@ const gradeName = (key) =>{
|
||||||
}
|
}
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
//默认给到地区重庆
|
//默认给到地区重庆
|
||||||
ruleForm.address = ['50']
|
ruleForm.address = ["50","5001","500101"]
|
||||||
//默认给到学校的值
|
//默认给到学校的值
|
||||||
ruleForm.school = [100,255,279]
|
ruleForm.school = [100,255,279]
|
||||||
})
|
})
|
||||||
|
|
|
@ -583,11 +583,7 @@ export default {
|
||||||
this.uploadData.levelSecondId = cata[1]
|
this.uploadData.levelSecondId = cata[1]
|
||||||
this.uploadData.levelThirdId = cata[2]
|
this.uploadData.levelThirdId = cata[2]
|
||||||
this.uploadData.textbookId = data.textBook.curBookId
|
this.uploadData.textbookId = data.textBook.curBookId
|
||||||
toolStore.curSubjectNode.data = data
|
toolStore.curSubjectNode.querySearch = this.uploadData
|
||||||
// 不要同时修改共享数据,这样只会触发一次
|
|
||||||
this.$nextTick(() => {
|
|
||||||
toolStore.curSubjectNode.querySearch = this.uploadData
|
|
||||||
})
|
|
||||||
this.initHomeWork()
|
this.initHomeWork()
|
||||||
await this.asyncAllFile()
|
await this.asyncAllFile()
|
||||||
},
|
},
|
||||||
|
|
|
@ -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) => {
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
<span class="unit-top-center">选择目录</span>
|
<span class="unit-top-center">选择目录</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="unit-content">
|
<div class="unit-content">
|
||||||
<Lesson @changeChapter="changeChapter" />
|
<Lesson @changeChapter="changeChapter" :curNode="curNode.data" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
|
@ -70,19 +70,20 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, toRaw } from 'vue';
|
import { ref, onMounted, toRaw, nextTick, reactive } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user'
|
||||||
import { getSmarttalkPage } from '@/api/file'
|
import { getSmarttalkPage } from '@/api/file'
|
||||||
import SetHomework from '@/components/set-homework/index.vue'
|
import SetHomework from '@/components/set-homework/index.vue'
|
||||||
import FileImage from '@/components/file-image/index.vue'
|
import FileImage from '@/components/file-image/index.vue'
|
||||||
import { useGetHomework } from '@/hooks/useGetHomework'
|
import { useGetHomework } from '@/hooks/useGetHomework'
|
||||||
import { ipcMsgSend, ipcMsgSend2, ipcMsgInvoke } from '@/utils/tool'
|
import { ipcMsgSend, ipcMsgInvoke } from '@/utils/tool'
|
||||||
import { useToolState } from '@/store/modules/tool'
|
import { useToolState } from '@/store/modules/tool'
|
||||||
import Lesson from './lesson.vue';
|
import Lesson from './lesson.vue';
|
||||||
import { parseCataByNode } from '@/utils/talkFile'
|
import { parseCataByNode } from '@/utils/talkFile'
|
||||||
import MsgEnum from '@/plugins/imChat/msgEnum' // 消息枚举
|
import MsgEnum from '@/plugins/imChat/msgEnum' // 消息枚举
|
||||||
import { createHomework } from '../createHomework'
|
import { createHomework } from '../createHomework'
|
||||||
|
import { sessionStore } from '@/utils/store'
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const usertore = useUserStore().user
|
const usertore = useUserStore().user
|
||||||
|
@ -99,6 +100,10 @@ const resourceList = ref([])
|
||||||
//当前点击的数据
|
//当前点击的数据
|
||||||
const curRow = ref('')
|
const curRow = ref('')
|
||||||
|
|
||||||
|
const curNode = reactive({
|
||||||
|
data: {}
|
||||||
|
})
|
||||||
|
|
||||||
const sendHomework = (row) => {
|
const sendHomework = (row) => {
|
||||||
curRow.value = row
|
curRow.value = row
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
@ -118,6 +123,7 @@ const successHomework = (data)=>{
|
||||||
}
|
}
|
||||||
// 章节目录change
|
// 章节目录change
|
||||||
const changeChapter = async (data)=>{
|
const changeChapter = async (data)=>{
|
||||||
|
curNode.data = data
|
||||||
const { res } = await useGetHomework(data)
|
const { res } = await useGetHomework(data)
|
||||||
dataList.value = res
|
dataList.value = res
|
||||||
let cata = parseCataByNode(data)
|
let cata = parseCataByNode(data)
|
||||||
|
@ -177,10 +183,10 @@ const getResource = () => {
|
||||||
|
|
||||||
//获取作业数据
|
//获取作业数据
|
||||||
const getHomework = async () => {
|
const getHomework = async () => {
|
||||||
const data = toRaw(toolStore.curSubjectNode).data.node
|
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
const { res } = await useGetHomework(data)
|
const { res } = await useGetHomework(curNode.data)
|
||||||
dataList.value = res
|
dataList.value = res
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
|
@ -203,13 +209,16 @@ function leave(el, done) {
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(async () => {
|
||||||
|
await nextTick()
|
||||||
entpcourseid.value = route.query.entpcourseid
|
entpcourseid.value = route.query.entpcourseid
|
||||||
lesson.value = route.query.label
|
lesson.value = route.query.label
|
||||||
setTimeout(()=>{
|
// 当前节点 mounted 的时候从缓存里拿
|
||||||
getHomework()
|
curNode.data = sessionStore.get('subject.curNode')
|
||||||
getResource()
|
getHomework()
|
||||||
},200)
|
getResource()
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<el-scrollbar>
|
<el-scrollbar>
|
||||||
<el-tree ref="refTree" :data="treeData" :props="defaultProps" node-key="id"
|
<el-tree ref="refTree" :data="treeData" :props="defaultProps" node-key="id"
|
||||||
:default-expanded-keys="defaultExpandedKeys" :current-node-key="currentNodeId" highlight-current
|
:default-expanded-keys="defaultExpandedKeys" :current-node-key="currentNode.data.id" highlight-current
|
||||||
@node-click="handleNodeClick">
|
@node-click="handleNodeClick">
|
||||||
<template #default="{ node }">
|
<template #default="{ node }">
|
||||||
<span :title="node.label" class="tree-label">{{ node.label }}</span>
|
<span :title="node.label" class="tree-label">{{ node.label }}</span>
|
||||||
|
@ -13,133 +13,60 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, nextTick, toRaw } from 'vue'
|
import { ref, reactive, onMounted, toRaw, watch } from 'vue'
|
||||||
import { useToolState } from '@/store/modules/tool'
|
import { useToolState } from '@/store/modules/tool'
|
||||||
|
import { sessionStore } from '@/utils/store'
|
||||||
|
import { cloneDeep } from 'lodash'
|
||||||
|
|
||||||
const emit = defineEmits(['changeChapter'])
|
const emit = defineEmits(['changeChapter'])
|
||||||
|
const props = defineProps(['curNode'])
|
||||||
|
|
||||||
const toolStore = useToolState()
|
const toolStore = useToolState()
|
||||||
const treeData = ref([])
|
const treeData = ref([])
|
||||||
const defaultProps = {
|
const defaultProps = {
|
||||||
children: 'children',
|
children: 'children',
|
||||||
label: 'label',
|
label: 'itemtitle',
|
||||||
class: 'textbook-tree'
|
class: 'textbook-tree'
|
||||||
}
|
}
|
||||||
// 当前选中的节点ID
|
const currentNode = reactive({
|
||||||
const currentNodeId = ref(0)
|
data: {}
|
||||||
// 当前选中的节点名称
|
})
|
||||||
const currentNodeName = ref('')
|
|
||||||
|
watch(() => props.curNode , (newVal) =>{
|
||||||
|
currentNode.data = newVal
|
||||||
|
console.log(currentNode.data)
|
||||||
|
},
|
||||||
|
{deep: true, immediate: true})
|
||||||
|
|
||||||
// 默认展开的节点
|
// 默认展开的节点
|
||||||
const defaultExpandedKeys = ref([])
|
const defaultExpandedKeys = ref([])
|
||||||
// tree
|
// tree
|
||||||
const refTree = ref(null)
|
const refTree = ref(null)
|
||||||
// 教材ID
|
|
||||||
const curBookId = ref('')
|
|
||||||
//
|
|
||||||
const evaluationList = ref([])
|
|
||||||
|
|
||||||
const getTreeData = () => {
|
const handleNodeClick = (data) => {
|
||||||
evaluationList.value = JSON.parse(localStorage.getItem('unitList'))
|
|
||||||
|
|
||||||
//上册
|
|
||||||
/**
|
|
||||||
* 不区分上下册
|
|
||||||
* 2024/08/20调整
|
|
||||||
*/
|
|
||||||
let volumeOne = evaluationList.value.filter(item => item.level == 1)
|
|
||||||
|
|
||||||
//数据过滤
|
|
||||||
|
|
||||||
let upData = transData(volumeOne)
|
|
||||||
if(upData.length){
|
|
||||||
treeData.value = [...upData]
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
treeData.value = []
|
|
||||||
return
|
|
||||||
}
|
|
||||||
nextTick(() => {
|
|
||||||
let defaultKey
|
|
||||||
if(toolStore.curSubjectNode.querySearch.levelSecondId){
|
|
||||||
defaultKey = toolStore.curSubjectNode.querySearch.levelSecondId
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
defaultKey = toolStore.curSubjectNode.querySearch.levelFirstId
|
|
||||||
}
|
|
||||||
currentNodeId.value = defaultKey
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleNodeClick = (data, node) => {
|
|
||||||
/**
|
/**
|
||||||
* data : 当前节点数据
|
* data : 当前节点数据
|
||||||
* node : 当前节点对象 包含当前节点所有数据 parent属性 指向父节点Node对象
|
|
||||||
*/
|
*/
|
||||||
|
currentNode.data = data
|
||||||
|
let nodeData = cloneDeep(toRaw(data));
|
||||||
|
|
||||||
|
//增加一个label 之前取的label
|
||||||
|
nodeData.label = nodeData.itemtitle
|
||||||
|
// 父级节点 如果当前是一级节点 父级则为null
|
||||||
|
let parent = {
|
||||||
|
id: nodeData.parentid,
|
||||||
|
label: nodeData.parenttitle,
|
||||||
|
itemtitle: nodeData.parenttitle
|
||||||
|
}
|
||||||
|
const parentNode = nodeData.parentid ? parent : null
|
||||||
|
nodeData.parentNode = parentNode
|
||||||
|
|
||||||
const nodeData = data;
|
emit('changeChapter', nodeData)
|
||||||
const parentNode = node.parent.data;
|
|
||||||
|
|
||||||
if (Array.isArray(parentNode)) {
|
|
||||||
nodeData.parentNode = null
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
nodeData.parentNode = parentNode
|
|
||||||
}
|
|
||||||
|
|
||||||
emit('changeChapter', toRaw(nodeData))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 根据教材章节单元ID 查询作业列表所需ID
|
|
||||||
const getChapterId = () => {
|
|
||||||
return listEntpcourse({
|
|
||||||
evalid: this.uploadData.levelSecondId,
|
|
||||||
edituserid: this.userStore.userId,
|
|
||||||
pageSize: 500
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const transData = (data) => {
|
|
||||||
let ary = []
|
|
||||||
data.forEach(item => {
|
|
||||||
let obj = {}
|
|
||||||
if (item.rootid == curBookId.value) {
|
|
||||||
obj.label = item.itemtitle
|
|
||||||
obj.id = item.id
|
|
||||||
obj.itemtitle = item.itemtitle
|
|
||||||
obj.edudegree = item.edudegree
|
|
||||||
obj.edustage = item.edustage
|
|
||||||
obj.edusubject = item.edusubject
|
|
||||||
let ary2 = []
|
|
||||||
evaluationList.value.forEach(el => {
|
|
||||||
let obj2 = {}
|
|
||||||
if (item.id == el.parentid) {
|
|
||||||
obj2 = {
|
|
||||||
label: el.itemtitle,
|
|
||||||
id: el.id,
|
|
||||||
itemtitle : el.itemtitle,
|
|
||||||
edudegree : el.edudegree,
|
|
||||||
edustage : el.edustage,
|
|
||||||
edusubject : el.edusubject,
|
|
||||||
}
|
|
||||||
ary2.push(obj2)
|
|
||||||
}
|
|
||||||
obj.children = ary2
|
|
||||||
})
|
|
||||||
ary.push(obj)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return ary
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
setTimeout(()=>{
|
treeData.value = sessionStore.get('subject.subjectTree')
|
||||||
let data = toRaw(toolStore.curSubjectNode)
|
defaultExpandedKeys.value = sessionStore.get('subject.defaultExpandedKeys')
|
||||||
curBookId.value = data.data.textBook.curBookId
|
|
||||||
getTreeData()
|
|
||||||
},500)
|
|
||||||
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -84,8 +84,8 @@ const btnList = [ // 工具栏按钮列表
|
||||||
// === 页面加载完毕 ===
|
// === 页面加载完毕 ===
|
||||||
onMounted(async() => {
|
onMounted(async() => {
|
||||||
if (!electron) return // 浏览器端
|
if (!electron) return // 浏览器端
|
||||||
window.test = sessionStore
|
// window.test = sessionStore
|
||||||
window.test1 = toolStore
|
// window.test1 = toolStore
|
||||||
getClassInfo() // 获取课堂详情 ex3
|
getClassInfo() // 获取课堂详情 ex3
|
||||||
resetStatus() // 开启重置状态-监听
|
resetStatus() // 开启重置状态-监听
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue