Merge pull request 'lyc-dev' (#4) from lyc-dev into main

This commit is contained in:
lyc 2024-07-09 17:49:33 +08:00
commit 4357e72809
8 changed files with 231 additions and 110 deletions

View File

@ -1,10 +1,10 @@
// 查询evaluation列表 // 查询evaluation列表
import request from '@/utils/request' import request from '@/utils/request'
export const listEvaluation = (query)=> { export const listEvaluation = (params)=> {
return request({ return request({
url: '/education/evaluation/list', url: '/education/evaluation/list',
method: 'get', method: 'get',
params: query params
}) })
} }

View File

@ -1,8 +1,8 @@
@font-face { @font-face {
font-family: "iconfont"; /* Project id 2794390 */ font-family: "iconfont"; /* Project id 2794390 */
src: url('iconfont.woff2?t=1720494614524') format('woff2'), src: url('iconfont.woff2?t=1720508953092') format('woff2'),
url('iconfont.woff?t=1720494614524') format('woff'), url('iconfont.woff?t=1720508953092') format('woff'),
url('iconfont.ttf?t=1720494614524') format('truetype'); url('iconfont.ttf?t=1720508953092') format('truetype');
} }
.iconfont { .iconfont {
@ -13,6 +13,10 @@
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
.icon-guanbi:before {
content: "\e60f";
}
.icon-xiangyou:before { .icon-xiangyou:before {
content: "\e609"; content: "\e609";
} }

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,13 @@
"css_prefix_text": "icon-", "css_prefix_text": "icon-",
"description": "", "description": "",
"glyphs": [ "glyphs": [
{
"icon_id": "4736203",
"name": "关闭",
"font_class": "guanbi",
"unicode": "e60f",
"unicode_decimal": 58895
},
{ {
"icon_id": "22358026", "icon_id": "22358026",
"name": "向右", "name": "向右",

View File

@ -1,108 +1,171 @@
<template> <template>
<div class="book-wrap"> <div class="book-wrap">
<div class="book-name flex"> <div class="book-name flex" @click="dialogVisible = true">
<span>语文-人教版-七年级上</span> <span>{{ curBookName }}</span>
<i class="iconfont icon-xiangyou"></i> <i class="iconfont icon-xiangyou"></i>
</div> </div>
<div class="book-list"> <div class="book-list">
<el-tree <el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick" />
:data="data"
:props="defaultProps"
@node-click="handleNodeClick"
/>
</div> </div>
</div> </div>
<el-dialog <!--弹窗 选择教材-->
v-model="dialogVisible" <el-dialog v-model="dialogVisible" class="choose-dialog" append-to-body :show-close="false" width="550">
title="切换教材" <template #header>
width="30%" <div class="choose-book-header flex">
> <span>切换教材</span>
<span>This is a message</span> <i class="iconfont icon-guanbi" @click="dialogVisible = false"></i>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false">Cancel</el-button>
<el-button type="primary" @click="dialogVisible = false">
Confirm
</el-button>
</div> </div>
</template> </template>
<div class="textbook-container">
<el-scrollbar height="450px">
<div class="textbook-item flex" v-for="item in subjectList" :class="curBookId == item.id ? 'active-item' : ''"
:key="item.id" @click="changeBook(item)">
<img :src="item.avartar" class="textbook-img" alt="">
<span class="book-name">{{ item.itemtitle }}</span>
</div>
</el-scrollbar>
</div>
</el-dialog> </el-dialog>
</template> </template>
<script setup> <script setup>
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import { listEvaluation } from '@/api/subject' import { listEvaluation } from '@/api/subject'
import { handleTree } from '@/utils/ruoyi.js'
const userStore = useUserStore()
const { edustage, edusubject } = userStore.user
const dialogVisible = ref(true)
const getSubject = async ()=>{ const userStore = useUserStore()
const { rows } = await listEvaluation({ itemkey: "version", pageSize: 500 }) const { edustage, edusubject, userId } = userStore.user
const data = rows.filter( item => item.edustage == edustage && item.edusubject == edusubject) //
console.log(data) const subjectList = ref([])
const dialogVisible = ref(false)
//ID
const curBookId = ref(-1)
//
const curBookName = 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 () => {
const params = {
edusubject,
edustage,
entpcourseedituserid: userId,
pageSize: 500
} }
const { rows } = await listEvaluation(params)
//
const beforAry = []
//
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
}
})
onMounted(getSubject) console.log(nextAry)
const data = [{ }
label: 'Level one 1',
children: [ //
{ const changeBook = ({ id, itemtitle }) => {
label: 'Level two 1-1', curBookId.value = id
children: [ curBookName.value = itemtitle
{ setTimeout(() => {
label: 'Level three 1-1-1', dialogVisible.value = false
}, }, 100);
], }
},
], //
}, const getImageUrl = (url) => {
{ const path = new URL(`${url}`, import.meta.url)
label: 'Level one 2', return path.href
children: [ }
{
label: 'Level two 2-1', onMounted(() => {
children: [ getSubject(),
{ getSubjectContent()
label: 'Level three 2-1-1', })
},
], const data = [{
}, label: 'Level one 1',
{ children: [
label: 'Level two 2-2', {
children: [ label: 'Level two 1-1',
{ children: [
label: 'Level three 2-2-1', {
}, label: 'Level three 1-1-1',
], },
}, ],
], },
}, ],
{ },
label: 'Level one 3', {
children: [ label: 'Level one 2',
{ children: [
label: 'Level two 3-1', {
children: [ label: 'Level two 2-1',
{ children: [
label: 'Level three 3-1-1', {
}, label: 'Level three 2-1-1',
], },
}, ],
{ },
label: 'Level two 3-2', {
children: [ label: 'Level two 2-2',
{ children: [
label: 'Level three 3-2-1', {
}, label: 'Level three 2-2-1',
], },
}, ],
], },
},] ],
const handleNodeClick = () =>{} },
const defaultProps = { {
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', children: 'children',
label: 'label', label: 'label',
} }
@ -110,24 +173,71 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.book-wrap{ .book-wrap {
width: 260px; width: 260px;
height: 100%; height: 100%;
background: #ffffff; background: #ffffff;
border-radius: 10px; border-radius: 10px;
box-shadow: 0px 0px 20px 0px rgba(99,99,99,0.06); box-shadow: 0px 0px 20px 0px rgba(99, 99, 99, 0.06);
.book-name{ .book-name {
height: 45px; height: 45px;
padding: 0 15px; padding: 0 15px;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
color: #3b3b3b;
cursor: pointer;
border-bottom: solid #f4f5f7 1px;
}
.book-list {
padding: 0 20px;
}
}
:deep(.choose-dialog) {
border-radius: 10px;
}
.choose-book-header {
justify-content: space-between;
font-size: 15px;
.icon-guanbi {
font-size: 20px;
cursor: pointer;
}
}
.textbook-container {
.textbook-item {
padding: 10px 20px;
align-items: center;
border-radius: 5px;
cursor: pointer;
.book-name {
margin-left: 20px;
color: #3b3b3b; color: #3b3b3b;
cursor: pointer;
border-bottom: solid #f4f5f7 1px;
} }
.book-list{
padding: 0 20px; &:hover {
background: #f4f7f9;
} }
} }
.active-item {
background-color: #f4f7f9;
.book-name {
color: #368fff;
font-weight: bold
}
}
.textbook-img {
width: 55px;
height: 70px;
}
}
</style> </style>