diff --git a/electron.vite.config.mjs b/electron.vite.config.mjs index 83ad28a..d19fc20 100644 --- a/electron.vite.config.mjs +++ b/electron.vite.config.mjs @@ -21,8 +21,8 @@ export default defineConfig({ server: { proxy: { '/dev-api': { - // target: 'http://27.128.240.72:7865', - target: 'http://192.168.2.52:7863', + target: 'http://27.128.240.72:7865', + // target: 'http://192.168.2.52:7863', changeOrigin: true, rewrite: (p) => p.replace(/^\/dev-api/, '') }, diff --git a/src/renderer/src/assets/iconfont/iconfont.css b/src/renderer/src/assets/iconfont/iconfont.css index 5fcfe11..6f0ef3c 100644 --- a/src/renderer/src/assets/iconfont/iconfont.css +++ b/src/renderer/src/assets/iconfont/iconfont.css @@ -1,8 +1,8 @@ @font-face { font-family: "iconfont"; /* Project id 2794390 */ - src: url('iconfont.woff2?t=1720508953092') format('woff2'), - url('iconfont.woff?t=1720508953092') format('woff'), - url('iconfont.ttf?t=1720508953092') format('truetype'); + src: url('iconfont.woff2?t=1720613279441') format('woff2'), + url('iconfont.woff?t=1720613279441') format('woff'), + url('iconfont.ttf?t=1720613279441') format('truetype'); } .iconfont { @@ -13,6 +13,22 @@ -moz-osx-font-smoothing: grayscale; } +.icon-jiahao:before { + content: "\e602"; +} + +.icon-pdf:before { + content: "\e803"; +} + +.icon-ppt:before { + content: "\e806"; +} + +.icon-word:before { + content: "\e807"; +} + .icon-guanbi:before { content: "\e60f"; } diff --git a/src/renderer/src/assets/iconfont/iconfont.js b/src/renderer/src/assets/iconfont/iconfont.js index 9dbac57..fa0c500 100644 --- a/src/renderer/src/assets/iconfont/iconfont.js +++ b/src/renderer/src/assets/iconfont/iconfont.js @@ -1 +1 @@ -window._iconfont_svg_string_2794390='',function(e){var t=(t=document.getElementsByTagName("script"))[t.length-1],a=t.getAttribute("data-injectcss"),t=t.getAttribute("data-disable-injectsvg");if(!t){var i,l,o,c,n,h=function(t,a){a.parentNode.insertBefore(t,a)};if(a&&!e.__iconfont__svg__cssinject__){e.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(t){console&&console.log(t)}}i=function(){var t,a=document.createElement("div");a.innerHTML=e._iconfont_svg_string_2794390,(a=a.getElementsByTagName("svg")[0])&&(a.setAttribute("aria-hidden","true"),a.style.position="absolute",a.style.width=0,a.style.height=0,a.style.overflow="hidden",a=a,(t=document.body).firstChild?h(a,t.firstChild):t.appendChild(a))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(i,0):(l=function(){document.removeEventListener("DOMContentLoaded",l,!1),i()},document.addEventListener("DOMContentLoaded",l,!1)):document.attachEvent&&(o=i,c=e.document,n=!1,s(),c.onreadystatechange=function(){"complete"==c.readyState&&(c.onreadystatechange=null,d())})}function d(){n||(n=!0,o())}function s(){try{c.documentElement.doScroll("left")}catch(t){return void setTimeout(s,50)}d()}}(window); \ No newline at end of file +window._iconfont_svg_string_2794390='',function(a){var l=(l=document.getElementsByTagName("script"))[l.length-1],t=l.getAttribute("data-injectcss"),l=l.getAttribute("data-disable-injectsvg");if(!l){var i,h,c,e,o,d=function(l,t){t.parentNode.insertBefore(l,t)};if(t&&!a.__iconfont__svg__cssinject__){a.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(l){console&&console.log(l)}}i=function(){var l,t=document.createElement("div");t.innerHTML=a._iconfont_svg_string_2794390,(t=t.getElementsByTagName("svg")[0])&&(t.setAttribute("aria-hidden","true"),t.style.position="absolute",t.style.width=0,t.style.height=0,t.style.overflow="hidden",t=t,(l=document.body).firstChild?d(t,l.firstChild):l.appendChild(t))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(i,0):(h=function(){document.removeEventListener("DOMContentLoaded",h,!1),i()},document.addEventListener("DOMContentLoaded",h,!1)):document.attachEvent&&(c=i,e=a.document,o=!1,n(),e.onreadystatechange=function(){"complete"==e.readyState&&(e.onreadystatechange=null,p())})}function p(){o||(o=!0,c())}function n(){try{e.documentElement.doScroll("left")}catch(l){return void setTimeout(n,50)}p()}}(window); \ No newline at end of file diff --git a/src/renderer/src/assets/iconfont/iconfont.json b/src/renderer/src/assets/iconfont/iconfont.json index 53ddd7f..9bd97e3 100644 --- a/src/renderer/src/assets/iconfont/iconfont.json +++ b/src/renderer/src/assets/iconfont/iconfont.json @@ -5,6 +5,34 @@ "css_prefix_text": "icon-", "description": "", "glyphs": [ + { + "icon_id": "8721197", + "name": "加号", + "font_class": "jiahao", + "unicode": "e602", + "unicode_decimal": 58882 + }, + { + "icon_id": "11441567", + "name": "pdf", + "font_class": "pdf", + "unicode": "e803", + "unicode_decimal": 59395 + }, + { + "icon_id": "11447679", + "name": "ppt2", + "font_class": "ppt", + "unicode": "e806", + "unicode_decimal": 59398 + }, + { + "icon_id": "11447681", + "name": "word2", + "font_class": "word", + "unicode": "e807", + "unicode_decimal": 59399 + }, { "icon_id": "4736203", "name": "关闭", diff --git a/src/renderer/src/assets/iconfont/iconfont.ttf b/src/renderer/src/assets/iconfont/iconfont.ttf index 6962e80..770b133 100644 Binary files a/src/renderer/src/assets/iconfont/iconfont.ttf and b/src/renderer/src/assets/iconfont/iconfont.ttf differ diff --git a/src/renderer/src/assets/iconfont/iconfont.woff b/src/renderer/src/assets/iconfont/iconfont.woff index 45f5b6d..5091a71 100644 Binary files a/src/renderer/src/assets/iconfont/iconfont.woff and b/src/renderer/src/assets/iconfont/iconfont.woff differ diff --git a/src/renderer/src/assets/iconfont/iconfont.woff2 b/src/renderer/src/assets/iconfont/iconfont.woff2 index 95d34d3..1c9cddc 100644 Binary files a/src/renderer/src/assets/iconfont/iconfont.woff2 and b/src/renderer/src/assets/iconfont/iconfont.woff2 differ diff --git a/src/renderer/src/components/choose-textbook/index.vue b/src/renderer/src/components/choose-textbook/index.vue index 6b9db8b..bcbf7b0 100644 --- a/src/renderer/src/components/choose-textbook/index.vue +++ b/src/renderer/src/components/choose-textbook/index.vue @@ -5,7 +5,7 @@
- +
@@ -33,25 +33,32 @@ import { onMounted, ref } from 'vue'; import useUserStore from '@/store/modules/user' import { listEvaluation } from '@/api/subject' -import { handleTree } from '@/utils/ruoyi.js' +// 定义要发送的emit事件 +const emit = defineEmits(['nodeClick']) +// store const userStore = useUserStore() const { edustage, edusubject, userId } = userStore.user // const subjectList = ref([]) +const evaluationList = ref([]) const dialogVisible = ref(false) +// 当前教材下面单元内容数据 +const treeData = ref([]) +const defaultProps = { + children: 'children', + label: 'label', + class: 'textbook-tree' +} //当前教材ID const curBookId = ref(-1) //当前教材名称 const curBookName = ref('') +// 上册 +const volumeOne = ref([]) +// 下册 +const volumeTwo = ref([]) -//获取教材 -const getSubject = async () => { - const { rows } = await listEvaluation({ itemkey: "version", pageSize: 500 }) - subjectList.value = rows.filter(item => item.edustage == edustage && item.edusubject == edusubject) - curBookName.value = subjectList.value[0].itemtitle - curBookId.value = subjectList.value[0].id -} //获取教材下面的单元内容 const getSubjectContent = async () => { @@ -62,119 +69,91 @@ const getSubjectContent = async () => { pageSize: 500 } const { rows } = await listEvaluation(params) + evaluationList.value = rows + //获取教材版本 + await getSubject() //上册 - const beforAry = [] + volumeOne.value = rows.filter(item => item.level == 1 && item.semester == '上册') //下册 - const nextAry = [] - rows.map(item => { - if (item.level == 1) { - if (item.semester == '上册') { - beforAry.push(item) - } - if (item.semester == '下册') { - nextAry.push(item) - } - } - }) - - console.log(beforAry) - beforAry.forEach( item =>{ - let obj = {} - if(item.rootid == curBookId){ - obj.itemtitle = item.itemtitle - - } - }) + volumeTwo.value = rows.filter(item => item.level == 1 && item.semester == '下册') - console.log(nextAry) + getTreeData() } //选择教材 const changeBook = ({ id, itemtitle }) => { curBookId.value = id curBookName.value = itemtitle + getTreeData() setTimeout(() => { dialogVisible.value = false }, 100); + } -// 图片地址 -const getImageUrl = (url) => { - const path = new URL(`${url}`, import.meta.url) - return path.href +const getTreeData = () => { + //数据过滤 + let upData = transData(volumeOne.value) + let downData = transData(volumeTwo.value) + treeData.value = upData.length ? upData : downData +} + + +const transData = (data) => { + let ary = [] + + data.forEach(item => { + let obj = {} + + if (item.rootid == curBookId.value) { + obj.label = item.itemtitle + obj.id = item.id + let ary2 = [] + evaluationList.value.forEach(el => { + let obj2 = {} + if (item.id == el.parentid) { + obj2 = { + label: el.itemtitle, + id: el.id + } + ary2.push(obj2) + } + obj.children = ary2 + }) + ary.push(obj) + } + }) + return ary +} + +//获取教材 +const getSubject = async () => { + const { rows } = await listEvaluation({ itemkey: "version", pageSize: 500 }) + subjectList.value = rows.filter(item => item.edustage == edustage && item.edusubject == edusubject && isHaveUnit(item.id)) + curBookName.value = subjectList.value[0].itemtitle + curBookId.value = subjectList.value[0].id +} + + +const isHaveUnit = (id) => { + return evaluationList.value.some(item => { + return item.rootid == id + }) +} + +const handleNodeClick = (data) => { + emit('nodeClick', data) } onMounted(() => { - getSubject(), - getSubjectContent() + getSubjectContent() }) -const data = [{ - label: 'Level one 1', - children: [ - { - label: 'Level two 1-1', - children: [ - { - label: 'Level three 1-1-1', - }, - ], - }, - ], -}, -{ - label: 'Level one 2', - children: [ - { - label: 'Level two 2-1', - children: [ - { - label: 'Level three 2-1-1', - }, - ], - }, - { - label: 'Level two 2-2', - children: [ - { - label: 'Level three 2-2-1', - }, - ], - }, - ], -}, -{ - label: 'Level one 3', - children: [ - { - label: 'Level two 3-1', - children: [ - { - label: 'Level three 3-1-1', - }, - ], - }, - { - label: 'Level two 3-2', - children: [ - { - label: 'Level three 3-2-1', - }, - ], - }, - ], -},] -const handleNodeClick = () => { } -const defaultProps = { - children: 'children', - label: 'label', -} - \ No newline at end of file diff --git a/src/renderer/src/layout/components/Header.vue b/src/renderer/src/layout/components/Header.vue index d5fc65f..0cd8db8 100644 --- a/src/renderer/src/layout/components/Header.vue +++ b/src/renderer/src/layout/components/Header.vue @@ -4,43 +4,23 @@

AIX智慧课堂

-
- {{ isMaxSize ? '' : '' }} + {{ isMaxSize ? '' : + '' }}
-
@@ -63,18 +43,45 @@ \ No newline at end of file