Compare commits

...

2 Commits

2 changed files with 185 additions and 80 deletions

View File

@ -7,16 +7,10 @@
</div> </div>
<div class="change-tab"> <div class="change-tab">
<ul class="flex"> <ul class="flex">
<li <li class="flex" :class="[activeId == menu.path ? 'active-li' : '', menu.disabled ? 'disabled' : '']"
v-for="(item, index) in routeHeader.nowRouter" v-for="menu in headerMenus" :key="menu.id" @click="clickMenu(menu)">
:key="index" <i class="iconfont" :class="menu.icon"></i>
class="flex" <span class="text">{{ menu.name }}</span>
:style="{'color' : item.color}"
:class="currentRoute === item.url ? 'active-li' : ''"
@click="handleOutLink(item.url,item.type, item.name)"
>
<i :class="item.img"></i>
<span class="text">{{ item.name }}</span>
</li> </li>
</ul> </ul>
</div> </div>
@ -25,14 +19,9 @@
<div class="right-section flex"> <div class="right-section flex">
<WindowTools /> <WindowTools />
<div class="user flex"> <div class="user flex">
<div class="avatar-container"> <div class="avatar-container">
<el-dropdown <div class="avatar-wrapper flex">
class="right-menu-item hover-effect" <el-dropdown class="right-menu-item hover-effect" @command="handleCommand">
trigger="click"
@command="handleCommand"
>
<div class="avatar-wrapper">
<img :src="dev_api + userStore.user.avatar" class="user-avatar" style="float: left" /> <img :src="dev_api + userStore.user.avatar" class="user-avatar" style="float: left" />
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
@ -65,17 +54,8 @@
</div> </div>
<div class="user-depname">{{ userStore.user.deptName }}</div> <div class="user-depname">{{ userStore.user.deptName }}</div>
</div> </div>
<template #dropdown> </div>
<el-dropdown-menu>
<el-dropdown-item @click="changePage('/testpdf')">测试页面</el-dropdown-item>
<el-dropdown-item @click="changePage('/classReserv')">课程预约</el-dropdown-item>
<el-dropdown-item @click="changePage('/class')">班级中心</el-dropdown-item>
<el-dropdown-item divided command="logout">
<span>退出登录</span>
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div> </div>
</div> </div>
</div> </div>
@ -83,13 +63,13 @@
</template> </template>
<script setup> <script setup>
import { ref, watch } from 'vue' import { ref, watch, onMounted } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { ElMessageBox, ElMessage } from 'element-plus' import { ElMessageBox, ElMessage } from 'element-plus'
import { ArrowDown } from '@element-plus/icons-vue' import { ArrowDown } from '@element-plus/icons-vue'
import WindowTools from '@/components/window-tools/index.vue' import WindowTools from '@/components/window-tools/index.vue'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import routerStore from '@/store/modules/route' import { updateUserInfo } from '@/api/system/user'
import outLink from '@/utils/linkConfig' import outLink from '@/utils/linkConfig'
import logoIco from '@/assets/images/logo.png' import logoIco from '@/assets/images/logo.png'
import { listEvaluation } from '@/api/classManage/index' import { listEvaluation } from '@/api/classManage/index'
@ -104,20 +84,22 @@ const userStore = useUserStore()
const router = useRouter() const router = useRouter()
const currentRoute = ref('') const currentRoute = ref('')
const dev_api = ref(import.meta.env.VITE_APP_BASE_API) const dev_api = ref(import.meta.env.VITE_APP_BASE_API)
const userSubjectList = ref([])
const handleOutLink = (path, type, name) => { const handleOutLink = (path, type, name) => {
if (!path) return if (!path) return
if (type === 'hash') { if (type === 'hash') {
router.push(path) router.push(path)
} else { } else {
// key linkConfig.js // key linkConfig.js
let configObj = outLink().getBaseData() let configObj = outLink().getBaseData()
let fullPath = configObj.fullPath + path let fullPath = configObj.fullPath + path
fullPath = fullPath.replaceAll('//', '/') fullPath = fullPath.replaceAll('//', '/')
const { levelFirstId, levelSecondId } = JSON.parse(localStorage.getItem('unitId')) const { levelFirstId, levelSecondId } = JSON.parse(localStorage.getItem('unitId'))
let unitId = levelSecondId ? levelSecondId :levelFirstId let unitId = levelSecondId ? levelSecondId : levelFirstId
if(name == '教材分析' || name == '高考研究'){ if (name == '教材分析' || name == '考试分析') {
fullPath += `?unitId=${unitId}` fullPath += `?unitId=${unitId}`
} }
// //
ipcRenderer.send('openWindow', { ipcRenderer.send('openWindow', {
@ -127,34 +109,47 @@ const handleOutLink = (path, type, name) => {
}) })
} }
} }
/*const menus = ref([
const activeId = ref('/home')
const headerMenus = [
{ {
icon: 'icon-zhuye2 icon-homepage', name: '工作台',
name: '主页', id: 1,
path: '/homepage' icon: 'icon-gongzuotai',
path: '/home'
}, },
{ {
icon: 'icon-jiaoxueziyuan icon-resource', name: '研究室',
name: '资源', id: 2,
icon: 'icon-yanjiushi',
disabled: true
},
{
name: '资源库',
id: 3,
icon: 'icon-saoyisao',
path: '/resource' path: '/resource'
}, },
{ {
icon: 'icon-beike icon-prepare', name: '朋友圈',
name: '备课', id: 4,
path: '/prepare' icon: 'icon-pengyouquan1',
}, disabled: true
{
icon: 'icon-jiangke1 icon-teach',
name: '授课',
path: '/teach'
} }
])*/ ]
const clickMenu = ({ id, disabled, path }) => {
if (disabled) return
activeId.value = id
router.push(path)
}
// //
watch( watch(
() => router.currentRoute.value, () => router.currentRoute.value,
(newValue) => { (newValue) => {
currentRoute.value = newValue.path currentRoute.value = newValue
activeId.value = newValue.path
}, },
{ immediate: true } { immediate: true }
) )
@ -195,20 +190,48 @@ function logout() {
ipcRenderer && ipcRenderer.send('openLoginWindow') ipcRenderer && ipcRenderer.send('openLoginWindow')
}) })
}) })
.catch(() => {}) .catch(() => { })
} }
const emits = defineEmits(['setLayout']) const emits = defineEmits(['setLayout'])
function setLayout() { function setLayout() {
emits('setLayout') emits('setLayout')
} }
//
const changeSubject = async (command) =>{
clearBookInfo()
const { userId, userName, phonenumber, plainpwd } = userStore.user
const data = {
userId,
userName,
edustage: command.edustage,
edusubject: command.edusubject
}
await updateUserInfo(data)
await userStore.login({username: phonenumber, password: plainpwd})
await userStore.getInfo()
router.go()
}
//
const getAllSubject = async () => {
const { rows } = await listEvaluation({ itemkey: "subject", pageSize: 500 })
if(!userStore.user.subject) return
const subject = userStore.user.subject.split(',')
userSubjectList.value = rows.filter(item =>
subject.some(el => item.id == el)
)
}
onMounted(() => {
getAllSubject()
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.title-bar { .title-bar {
height: 80px; height: 80px;
background: #ebf0f9;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
-webkit-app-region: drag; -webkit-app-region: drag;
@ -216,27 +239,41 @@ function setLayout() {
.left-section { .left-section {
display: flex; display: flex;
align-items: center; align-items: flex-start;
flex-direction: column;
width: 50%; width: 50%;
.title-box {
padding-top: 8px;
box-sizing: border-box;
align-items: center;
padding-left: 20px;
.title {
color: #4b73df;
font-size: 13px;
padding: 0 5px;
}
}
.change-tab { .change-tab {
-webkit-app-region: no-drag; -webkit-app-region: no-drag;
margin-left: 20px; margin-left: 20px;
ul { ul {
li { li {
padding: 3px 13px;
cursor: pointer; cursor: pointer;
flex-direction: column; flex-direction: column;
border-radius: 8px; border-radius: 8px;
margin: 0 5px; margin: 0 10px;
.text { .text {
font-size: 13px; font-size: 13px;
font-weight: bold;
} }
.iconfont { .iconfont {
font-size: 22px; font-size: 26px;
} }
.icon-resource { .icon-resource {
@ -256,12 +293,20 @@ function setLayout() {
} }
&:hover { &:hover {
background: #d3e3fb; color: #409eff;
}
}
.disabled {
cursor: not-allowed;
color: #bfbfbf;
&:hover {
color: #bfbfbf;
} }
} }
.active-li { .active-li {
background: #d3e3fb;
color: #409eff; color: #409eff;
} }
} }
@ -271,11 +316,7 @@ function setLayout() {
-webkit-app-region: no-drag; -webkit-app-region: no-drag;
} }
.title {
color: #4b73df;
font-size: 18px;
padding: 0 20px;
}
} }
.right-section { .right-section {
@ -287,11 +328,25 @@ function setLayout() {
flex-direction: column; flex-direction: column;
.user { .user {
padding-right: 10px;
.user-info { .user-info {
padding-right: 5px; padding-right: 5px;
align-items: center; align-items: flex-start;
flex-direction: column; flex-direction: column;
font-size: 12px; font-size: 12px;
height: 100%;
justify-content: space-around;
.user-depname {
margin-right: 0;
}
.user-subject {
display: flex;
align-items: center;
font-size: 12px;
}
} }
} }
} }
@ -301,12 +356,12 @@ function setLayout() {
.avatar-wrapper { .avatar-wrapper {
display: flex; display: flex;
align-items: center;
.user-avatar { .user-avatar {
width: 30px; width: 45px;
height: 30px; height: 45px;
border-radius: 10px; border-radius: 10px;
margin-top: 8px;
margin-right: 10px; margin-right: 10px;
} }

View File

@ -4,14 +4,14 @@
<div class="page-con-left"> <div class="page-con-left">
<div class="stand-head" ref="headref"> <div class="stand-head" ref="headref">
<div class="stand-head-left"> <div class="stand-head-left">
<el-image class="imges" src="https://file.ysaix.com:7868//src/assets/images/高中语文必修上册.jpg" /> <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">{{booktitle}}</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>
<el-switch class="stand-head-right-row-switch" v-model="isOpenClass" inline-prompt active-text="公开" inactive-text="非公" /> <!-- <el-switch class="stand-head-right-row-switch" v-model="isOpenClass" inline-prompt active-text="公开" inactive-text="非公" /> -->
</div> </div>
</div> </div>
</div> </div>
@ -68,8 +68,10 @@
</div> </div>
</div> </div>
</div> </div>
<el-dialog v-model="dialogVisible" append-to-body :show-close="false" width="550"> <el-dialog v-model="dialogVisible" title="切换教材" append-to-body width="550">
<ChooseTextbook @change-book="getData" @node-click="getData" /> <div class="booklist">
<div :class="{'item': true,'active': booksel === idx}" v-for="item,idx in bookList" :key="idx" @click="bookChange(item)">{{item.edustage + item.edusubject}}</div>
</div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
@ -82,7 +84,7 @@ import { listEvaluationclue } from '@/api/teaching/classwork'
import { uploadServer, getJSONFile } from '@/utils/common' import { uploadServer, getJSONFile } from '@/utils/common'
import { ElNotification } from 'element-plus' import { ElNotification } from 'element-plus'
import ChooseTextbook from "@/components/choose-textbook/index.vue"; import ChooseTextbook from "@/components/choose-textbook/index.vue";
import { listEvaluation } from '@/api/classManage/index'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
const userStore = useUserStore() const userStore = useUserStore()
const sourceStore = useResoureStore() const sourceStore = useResoureStore()
@ -101,6 +103,10 @@ const searchref = ref(null);
const listHeight = ref(0); const listHeight = ref(0);
const dialogVisible = ref(false); const dialogVisible = ref(false);
const booktitle = ref(''); const booktitle = ref('');
const bookInfo = ref(null);
const booksel = ref(0);
const bookList = ref([])
const searchOptions = [{ const searchOptions = [{
value: '0', value: '0',
@ -109,7 +115,7 @@ const searchOptions = [{
value: '1', value: '1',
label: '按内容量', label: '按内容量',
}]; }];
const standList = ref([]) const standList = ref([]);
const showData = ref([]); const showData = ref([]);
// //
@ -234,16 +240,41 @@ const getData = (data) => {
// ID // ID
localStorage.setItem('unitId', JSON.stringify({ levelFirstId, levelSecondId})) localStorage.setItem('unitId', JSON.stringify({ levelFirstId, levelSecondId}))
} }
onMounted(() => { //
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(item.fileurl !== ''){
bookList.value.push({...item,avartar: import.meta.env.VITE_APP_BUILD_BASE_PATH + item.avartar})
}
})
booksel.value = bookList.value.findIndex(item => item.edustage === edustage && item.edusubject === edusubject)
}
const bookChange = async (item, idx) => {
booksel.value = idx
bookInfo.value = {...item}
booktitle.value = `${item.edustage + item.edusubject}课程标准`
pdfUrl.value = '';
const filepath = import.meta.env.VITE_APP_RES_FILE_PATH + item.fileurl.replace('.txt','.pdf')
await loadPdfAnimation(filepath)
dialogVisible.value = false
}
const loadPdfAnimation = (path) => {
const timer = setTimeout(() => {
pdfUrl.value = path
clearTimeout(timer);
},2000)
}
onMounted(async () => {
await getAllSubject();
const { edustage, edusubject } = userStore.user; const { edustage, edusubject } = userStore.user;
booktitle.value = `${edustage + edusubject}课程标准` booktitle.value = `${edustage + edusubject}课程标准`
const filePath = `${import.meta.env.VITE_APP_RES_FILE_PATH}${edustage}-${edusubject}-课标.pdf` const filePath = `${import.meta.env.VITE_APP_RES_FILE_PATH}${edustage}-${edusubject}-课标.pdf`
const timer = setTimeout(() => { await loadPdfAnimation(filePath)
pdfUrl.value = filePath
clearTimeout(timer);
},2000)
if(cardref.value && headref.value){ if(cardref.value && headref.value){
const cardH = cardref.value.offsetHeight; const cardH = cardref.value.offsetHeight;
const headh = headref.value.offsetHeight; const headh = headref.value.offsetHeight;
@ -492,4 +523,23 @@ onMounted(() => {
} }
} }
} }
.booklist{
width: 100%;
height: 500px;
padding-top: 1px;
overflow: auto;
.item{
width: 100%;
height: auto;
padding: 8px 16px;
background-color: #ffffff;
border-top: 1px solid #f1f1f1;
font-size: 14px;
color: #3b3b3b;
}
.active{
background-color: #409eff;
color: #ffffff;
}
}
</style> </style>