Merge branch 'main' into zhuhao_dev

This commit is contained in:
朱浩 2024-09-27 10:13:02 +08:00
commit 926f45f232
17 changed files with 107 additions and 170 deletions

View File

@ -14,14 +14,14 @@ const defaultData = {
isPdfWin: false, // pdf窗口是否打开
isToolWin: false, // 工具窗口是否打开
curSubjectNode: {
data: {}, // 当前教材节点 (包含当前教材 单元)
querySearch: {} // 查询资源所需参数
},
subject: {
subject: { // 不走同步 Pinia
bookList: null, // 教材列表
curBook: null, // 当前选中的教材
curNode: null, // 当前选中的节点
defaultExpandedKeys: [], //展开的节点
subjectTree: [] // "树结构" 章节
}
},
local: { // 本地(永久localStorage)

File diff suppressed because one or more lines are too long

View File

@ -294,7 +294,7 @@ See https://github.com/adobe-type-tools/cmap-resources
</span>
<span id="numPages" class="toolbarLabel"></span>
</div>
<div id="toolbarViewerRight" style="display: none;">
<div id="toolbarViewerRight">
<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">
<span data-l10n-id="pdfjs-editor-highlight-button-label">Highlight</span>

View File

@ -21,7 +21,6 @@ const fileUrl = getAppInstallUrl('pdfjs-dist/web/viewer.html', 'user', '\\out\\r
onMounted(() => {
/** 将传入的pdf地址进行编码防止中文识别错误 */
pdfUrl.value = fileUrl + encodeURIComponent(props.url)
console.log('组件',pdfUrl.value);
})
</script>

View File

@ -181,6 +181,8 @@ onMounted( async () => {
// ""
treeData.value = useSubject.getTreeData(curBook.data.id)
sessionStore.set('subject.subjectTree',useSubject.getTreeData(curBook.data.id))
nextTick(() =>{
//
if(sessionStore.get('subject.curNode')){

View File

@ -145,7 +145,6 @@ export default {
}
},
created() {
window.test = this
this.slotKeys = Object.keys(this.$slots)
},
methods: {

View File

@ -285,7 +285,7 @@ onMounted(async () => {
canvas2.canvas.setWidth(window.innerWidth / 2 - 100)
// canvas2.canvas.isDrawingMode=false
canvas1FabricVue.value = canvas2
window.test = { canvas1, canvas2 }
// window.test = { canvas1, canvas2 }
emit('update:numPagesTotal', pdf.numPages)
if (props.pdfObj.allPageData.length) {

View File

@ -294,7 +294,7 @@ onMounted(async () => {
canvas2.canvas.setWidth(window.innerWidth / 2 - 100)
// canvas2.canvas.isDrawingMode=false
canvas1FabricVue.value = canvas2
window.test = { canvas1, canvas2 }
// window.test = { canvas1, canvas2 }
emit('update:numPagesTotal', pdf.numPages)
if (props.pdfObj.allPageData.length) {

View File

@ -6,6 +6,9 @@ import { sessionStore } from '@/utils/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))
@ -16,7 +19,6 @@ export const useToolState = defineStore('tool', {
isPdfWin: false, // pdf窗口是否打开
isToolWin: false, // 工具窗口是否打开
curSubjectNode: {
data: {}, // 当前教材节点 (包含当前教材 单元)
querySearch: {} // 查询资源所需参数
},
...defData // 默认数据-覆盖上面的配置(不要删除, 会导致新窗口-获取状态失败)

View File

@ -234,7 +234,7 @@ const openDialog = (data) => {
classWorkAnalysis.activeQuizAnalysisData = []
classWorkAnalysis.row = data
window.test = this
// window.test = this
// zdg:
const studentArr = data.classworkdatastudentids
? JSON.parse(`[${data.classworkdatastudentids}]`)
@ -539,6 +539,10 @@ const workHandle = (type) => {
classWorkAnalysis.view = type
const isClose = type != 'quizStats' && !! classWorkActiveData.timerId
const isOpen = type == 'quizStats' && !classWorkActiveData.timerId
//
if(type == 'quizStats') {
getWorkFeedList();
}
if (isClose) clearInterval(classWorkActiveData.timerId) //
if (isOpen) {
//

View File

@ -44,7 +44,6 @@
v-model="ruleForm.address"
:options="regionData"
@change="handleChange"
:props="{checkStrictly: true}"
/>
</el-form-item>
<el-form-item label="学校" prop="school" v-if="activeIndex==2">
@ -233,23 +232,24 @@ const OpenModel = v =>{
//
const handleClose = () => {
var restValue={
name: '',
idNumber:'',
phoneNumber: '',
Code:'',
password:'',
confirmPassword:'',
class:[],
discipline:[],
school:[],
}
name: '',
idNumber:'',
phoneNumber: '',
Code:'',
password:'',
confirmPassword:'',
class:[],
discipline:[],
school:[100,255,279],
address:["50","5001","500101"]
}
Object.assign(ruleForm, restValue);
schoolSubject.value=[]
gradeTree.value=[]
if (ruleFormRef.value) ruleFormRef.value.resetFields()
removeToken();
activeIndex.value=1
dialogVisible.value=false
activeIndex.value=1
}
const nextStep = (formEl) => {
@ -346,13 +346,14 @@ const submitForm = async (formEl) => {
confirmPassword:'',
class:[],
discipline:[],
school:[],
school:[100,255,279],
address:["50","5001","500101"]
}
schoolSubject.value=[]
gradeTree.value=[]
Object.assign(ruleForm, restValue);
dialogVisible.value=false
activeIndex.value=1
dialogVisible.value=false
}else{
ElMessage.error(res.msg)
}
@ -495,7 +496,7 @@ const gradeName = (key) =>{
}
onMounted(()=>{
//
ruleForm.address = ['50']
ruleForm.address = ["50","5001","500101"]
//
ruleForm.school = [100,255,279]
})

View File

@ -583,11 +583,7 @@ export default {
this.uploadData.levelSecondId = cata[1]
this.uploadData.levelThirdId = cata[2]
this.uploadData.textbookId = data.textBook.curBookId
toolStore.curSubjectNode.data = data
//
this.$nextTick(() => {
toolStore.curSubjectNode.querySearch = this.uploadData
})
toolStore.curSubjectNode.querySearch = this.uploadData
this.initHomeWork()
await this.asyncAllFile()
},

View File

@ -7,7 +7,7 @@
<el-image class="imges" :src="bookInfo ? bookInfo.avartar : ''" />
</div>
<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>
<div class="stand-head-right-row">
<div class="stand-head-right-row-time">更新2024.9.10</div>
@ -68,11 +68,11 @@
</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="{'item': true,'active': booksel === idx}" v-for="item,idx in bookList" :key="idx" @click="bookChange(item,idx)">
<el-image class="bookimg" :src="item.avartar" />
<div class="bookname">{{item.fileurl.replace('.txt', '')}}</div>
<div class="bookname">{{item.bookName}}</div>
</div>
</div>
</el-dialog>
@ -105,7 +105,6 @@ const headref = ref(null);
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([])
@ -246,23 +245,24 @@ 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(edustage === item.edustage && item.edusubject === edusubject){
bookInfo.value = {...item,avartar: import.meta.env.VITE_APP_BUILD_BASE_PATH + item.avartar,bookName: bookNameFormat(item.edustage,item.edusubject)}
}
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)
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')
await loadPdfAnimation(filePath)
}
const bookNameFormat = (edustage,edusubject) => {
return `${edustage}-${edusubject}`
}
const bookChange = async (item, idx) => {
booksel.value = idx
bookInfo.value = {...item}
booktitle.value = item.fileurl.replace('.txt','')
pdfUrl.value = '';
const filepath = import.meta.env.VITE_APP_RES_FILE_PATH + item.fileurl.replace('.txt','.pdf')
await loadPdfAnimation(filepath)
@ -539,9 +539,9 @@ onMounted(async () => {
width: 130px;
height: 180px;
}
.name{
.bookname{
font-size: 14px;
color: #3b3b3b;
text-align: center;
}
}
.item:hover{

View File

@ -244,19 +244,17 @@ const getData = (data) => {
//
const getAllSubject = async () => {
const { edustage, edusubject } = userStore.user;
const { rows } = await listEvaluation({ itemkey: "version", edustage, edusubject, pageSize: 500 })
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}
}
const { rows } = await listEvaluation({ itemkey: "version", edustage, edusubject, orderby: 'orderidx asc', pageSize: 500 })
const dataList = [];
rows && rows.map((item,idx) => {
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)
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')
bookList.value = dataList
bookInfo.value = {...dataList[0],avartar: dataList[0].avartar}
booktitle.value = dataList[0].fileurl.replace('.txt','')
const filePath = import.meta.env.VITE_APP_RES_FILE_PATH + dataList[0].fileurl.replace('.txt','.pdf')
await loadPdfAnimation(filePath)
}
const bookChange = async (item, idx) => {

View File

@ -62,7 +62,7 @@
<span class="unit-top-center">选择目录</span>
</div>
<div class="unit-content">
<Lesson @changeChapter="changeChapter" />
<Lesson @changeChapter="changeChapter" :curNode="curNode.data" />
</div>
</div>
</transition>
@ -70,19 +70,20 @@
</template>
<script setup>
import { ref, onMounted, toRaw } from 'vue';
import { ref, onMounted, toRaw, nextTick, reactive } from 'vue';
import { useRoute } from 'vue-router';
import useUserStore from '@/store/modules/user'
import { getSmarttalkPage } from '@/api/file'
import SetHomework from '@/components/set-homework/index.vue'
import FileImage from '@/components/file-image/index.vue'
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 Lesson from './lesson.vue';
import { parseCataByNode } from '@/utils/talkFile'
import MsgEnum from '@/plugins/imChat/msgEnum' //
import { createHomework } from '../createHomework'
import { sessionStore } from '@/utils/store'
const route = useRoute();
const usertore = useUserStore().user
@ -99,6 +100,10 @@ const resourceList = ref([])
//
const curRow = ref('')
const curNode = reactive({
data: {}
})
const sendHomework = (row) => {
curRow.value = row
setTimeout(() => {
@ -118,6 +123,7 @@ const successHomework = (data)=>{
}
// change
const changeChapter = async (data)=>{
curNode.data = data
const { res } = await useGetHomework(data)
dataList.value = res
let cata = parseCataByNode(data)
@ -177,10 +183,10 @@ const getResource = () => {
//
const getHomework = async () => {
const data = toRaw(toolStore.curSubjectNode).data.node
loading.value = true
try {
const { res } = await useGetHomework(data)
const { res } = await useGetHomework(curNode.data)
dataList.value = res
} finally {
loading.value = false
@ -203,13 +209,16 @@ function leave(el, done) {
done();
}
onMounted(() => {
onMounted(async () => {
await nextTick()
entpcourseid.value = route.query.entpcourseid
lesson.value = route.query.label
setTimeout(()=>{
getHomework()
getResource()
},200)
// mounted
curNode.data = sessionStore.get('subject.curNode')
getHomework()
getResource()
})
</script>

View File

@ -2,7 +2,7 @@
<el-scrollbar>
<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">
<template #default="{ node }">
<span :title="node.label" class="tree-label">{{ node.label }}</span>
@ -13,133 +13,60 @@
</template>
<script setup>
import { ref, onMounted, nextTick, toRaw } from 'vue'
import { ref, reactive, onMounted, toRaw, watch } from 'vue'
import { useToolState } from '@/store/modules/tool'
import { sessionStore } from '@/utils/store'
import { cloneDeep } from 'lodash'
const emit = defineEmits(['changeChapter'])
const props = defineProps(['curNode'])
const toolStore = useToolState()
const treeData = ref([])
const defaultProps = {
children: 'children',
label: 'label',
label: 'itemtitle',
class: 'textbook-tree'
}
// ID
const currentNodeId = ref(0)
//
const currentNodeName = ref('')
const currentNode = reactive({
data: {}
})
watch(() => props.curNode , (newVal) =>{
currentNode.data = newVal
console.log(currentNode.data)
},
{deep: true, immediate: true})
//
const defaultExpandedKeys = ref([])
// tree
const refTree = ref(null)
// ID
const curBookId = ref('')
//
const evaluationList = ref([])
const getTreeData = () => {
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) => {
const handleNodeClick = (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;
const parentNode = node.parent.data;
if (Array.isArray(parentNode)) {
nodeData.parentNode = null
}
else {
nodeData.parentNode = parentNode
}
emit('changeChapter', toRaw(nodeData))
emit('changeChapter', 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(()=>{
setTimeout(()=>{
let data = toRaw(toolStore.curSubjectNode)
curBookId.value = data.data.textBook.curBookId
getTreeData()
},500)
treeData.value = sessionStore.get('subject.subjectTree')
defaultExpandedKeys.value = sessionStore.get('subject.defaultExpandedKeys')
})
</script>

View File

@ -84,8 +84,8 @@ const btnList = [ // 工具栏按钮列表
// === ===
onMounted(async() => {
if (!electron) return //
window.test = sessionStore
window.test1 = toolStore
// window.test = sessionStore
// window.test1 = toolStore
getClassInfo() // ex3
resetStatus() // -
})