zhuhao_dev #5

Merged
zhuhao merged 4 commits from zhuhao_dev into main 2024-07-09 17:50:19 +08:00
8 changed files with 231 additions and 110 deletions
Showing only changes of commit dbcb17fc7e - Show all commits

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,52 +1,115 @@
<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 userStore = useUserStore()
const { edustage, edusubject } = userStore.user const { edustage, edusubject, userId } = userStore.user
const dialogVisible = ref(true) //
const subjectList = ref([])
const dialogVisible = ref(false)
//ID
const curBookId = ref(-1)
//
const curBookName = ref('')
const getSubject = async ()=>{ //
const getSubject = async () => {
const { rows } = await listEvaluation({ itemkey: "version", pageSize: 500 }) const { rows } = await listEvaluation({ itemkey: "version", pageSize: 500 })
const data = rows.filter( item => item.edustage == edustage && item.edusubject == edusubject) subjectList.value = rows.filter(item => item.edustage == edustage && item.edusubject == edusubject)
console.log(data) 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 = [{ }
//
const changeBook = ({ id, itemtitle }) => {
curBookId.value = id
curBookName.value = itemtitle
setTimeout(() => {
dialogVisible.value = false
}, 100);
}
//
const getImageUrl = (url) => {
const path = new URL(`${url}`, import.meta.url)
return path.href
}
onMounted(() => {
getSubject(),
getSubjectContent()
})
const data = [{
label: 'Level one 1', label: 'Level one 1',
children: [ children: [
{ {
@ -58,8 +121,8 @@
], ],
}, },
], ],
}, },
{ {
label: 'Level one 2', label: 'Level one 2',
children: [ children: [
{ {
@ -79,8 +142,8 @@
], ],
}, },
], ],
}, },
{ {
label: 'Level one 3', label: 'Level one 3',
children: [ children: [
{ {
@ -100,9 +163,9 @@
], ],
}, },
], ],
},] },]
const handleNodeClick = () =>{} const handleNodeClick = () => { }
const defaultProps = { const defaultProps = {
children: 'children', children: 'children',
label: 'label', label: 'label',
} }
@ -110,14 +173,14 @@
</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;
@ -126,8 +189,55 @@
cursor: pointer; cursor: pointer;
border-bottom: solid #f4f5f7 1px; border-bottom: solid #f4f5f7 1px;
} }
.book-list{
.book-list {
padding: 0 20px; 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;
}
&:hover {
background: #f4f7f9;
}
}
.active-item {
background-color: #f4f7f9;
.book-name {
color: #368fff;
font-weight: bold
}
}
.textbook-img {
width: 55px;
height: 70px;
}
}
</style> </style>