Merge pull request 'zhuhao_dev' (#260) from zhuhao_dev into main

Reviewed-on: #260
This commit is contained in:
朱浩 2024-09-24 16:23:23 +08:00
commit 09159ae2d8
8 changed files with 134 additions and 75 deletions

View File

@ -1,5 +1,5 @@
# 页面标题
VITE_APP_TITLE = 文枢课堂
VITE_APP_TITLE = AIX智慧课堂
# 生产环境配置
VITE_APP_ENV = 'production'

View File

@ -1,5 +1,5 @@
# 页面标题
VITE_APP_TITLE = AIX智慧课堂
VITE_APP_TITLE = 文枢课堂
# 生产环境配置
VITE_APP_ENV = 'production'

View File

@ -1,10 +1,10 @@
appId: com.electron.app
productName: 文枢课堂
productName: AIx
directories:
output: dist
buildResources: build
win:
executableName: 文枢课堂
executableName: AIx
icon: resources/logo2.ico
files:
- '!**/.vscode/*'

View File

@ -1,10 +1,10 @@
appId: com.electron.app
productName: AIx
productName: 文枢课堂
directories:
output: dist
buildResources: build
win:
executableName: AIx
executableName: 文枢课堂
icon: resources/logo2.ico
files:
- '!**/.vscode/*'

View File

@ -1,6 +1,6 @@
{
"name": "aix-win",
"version": "2.0.6",
"version": "2.1.1",
"description": "",
"main": "./out/main/index.js",
"author": "example.com",

View File

@ -273,9 +273,14 @@ function handleAll() {
})
// 用于监听-状态管理变化-同步所有窗口
ipcMain.handle('pinia-state-change', (e, storeName, jsonStr) => {
console.log('pinia-state-change-1', storeName, jsonStr)
for(const curWin of BrowserWindow.getAllWindows()){
const id = curWin.webContents.id
const bool = id !== e.sender.id && !curWin.isDestroyed()
if (id === e.sender.id) {
console.log('pinia-state-change-2', 'windows-send', curWin.type)
}
if (bool) { // 除了消息发送窗口和销毁的窗口 其他都发送
curWin.webContents.send('pinia-state-set', storeName, jsonStr)
}

View File

@ -7,16 +7,10 @@
</div>
<div class="change-tab">
<ul class="flex">
<li
v-for="(item, index) in routeHeader.nowRouter"
:key="index"
class="flex"
: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 class="flex" :class="[activeId == menu.path ? 'active-li' : '', menu.disabled ? 'disabled' : '']"
v-for="menu in headerMenus" :key="menu.id" @click="clickMenu(menu)">
<i class="iconfont" :class="menu.icon"></i>
<span class="text">{{ menu.name }}</span>
</li>
</ul>
</div>
@ -25,14 +19,9 @@
<div class="right-section flex">
<WindowTools />
<div class="user flex">
<div class="avatar-container">
<el-dropdown
class="right-menu-item hover-effect"
trigger="click"
@command="handleCommand"
>
<div class="avatar-wrapper">
<div class="avatar-wrapper flex">
<el-dropdown class="right-menu-item hover-effect" @command="handleCommand">
<img :src="dev_api + userStore.user.avatar" class="user-avatar" style="float: left" />
<template #dropdown>
<el-dropdown-menu>
@ -65,17 +54,8 @@
</div>
<div class="user-depname">{{ userStore.user.deptName }}</div>
</div>
<template #dropdown>
<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>
@ -83,13 +63,13 @@
</template>
<script setup>
import { ref, watch } from 'vue'
import { ref, watch, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import { ElMessageBox, ElMessage } from 'element-plus'
import { ArrowDown } from '@element-plus/icons-vue'
import WindowTools from '@/components/window-tools/index.vue'
import useUserStore from '@/store/modules/user'
import routerStore from '@/store/modules/route'
import { updateUserInfo } from '@/api/system/user'
import outLink from '@/utils/linkConfig'
import logoIco from '@/assets/images/logo.png'
import { listEvaluation } from '@/api/classManage/index'
@ -104,20 +84,22 @@ const userStore = useUserStore()
const router = useRouter()
const currentRoute = ref('')
const dev_api = ref(import.meta.env.VITE_APP_BASE_API)
const userSubjectList = ref([])
const handleOutLink = (path, type, name) => {
if (!path) return
if (type === 'hash') {
router.push(path)
} else {
// key linkConfig.js
let configObj = outLink().getBaseData()
let fullPath = configObj.fullPath + path
fullPath = fullPath.replaceAll('//', '/')
const { levelFirstId, levelSecondId } = JSON.parse(localStorage.getItem('unitId'))
let unitId = levelSecondId ? levelSecondId :levelFirstId
if(name == '教材分析' || name == '高考研究'){
fullPath += `?unitId=${unitId}`
let unitId = levelSecondId ? levelSecondId : levelFirstId
if (name == '教材分析' || name == '考试分析') {
fullPath += `?unitId=${unitId}`
}
//
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: '主页',
path: '/homepage'
name: '工作台',
id: 1,
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'
},
{
icon: 'icon-beike icon-prepare',
name: '备课',
path: '/prepare'
},
{
icon: 'icon-jiangke1 icon-teach',
name: '授课',
path: '/teach'
name: '朋友圈',
id: 4,
icon: 'icon-pengyouquan1',
disabled: true
}
])*/
]
const clickMenu = ({ id, disabled, path }) => {
if (disabled) return
activeId.value = id
router.push(path)
}
//
watch(
() => router.currentRoute.value,
(newValue) => {
currentRoute.value = newValue.path
currentRoute.value = newValue
activeId.value = newValue.path
},
{ immediate: true }
)
@ -195,20 +190,48 @@ function logout() {
ipcRenderer && ipcRenderer.send('openLoginWindow')
})
})
.catch(() => {})
.catch(() => { })
}
const emits = defineEmits(['setLayout'])
function 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>
<style lang="scss" scoped>
.title-bar {
height: 80px;
background: #ebf0f9;
justify-content: space-between;
align-items: center;
-webkit-app-region: drag;
@ -216,27 +239,41 @@ function setLayout() {
.left-section {
display: flex;
align-items: center;
align-items: flex-start;
flex-direction: column;
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 {
-webkit-app-region: no-drag;
margin-left: 20px;
ul {
li {
padding: 3px 13px;
cursor: pointer;
flex-direction: column;
border-radius: 8px;
margin: 0 5px;
margin: 0 10px;
.text {
font-size: 13px;
font-weight: bold;
}
.iconfont {
font-size: 22px;
font-size: 26px;
}
.icon-resource {
@ -256,12 +293,20 @@ function setLayout() {
}
&:hover {
background: #d3e3fb;
color: #409eff;
}
}
.disabled {
cursor: not-allowed;
color: #bfbfbf;
&:hover {
color: #bfbfbf;
}
}
.active-li {
background: #d3e3fb;
color: #409eff;
}
}
@ -271,11 +316,7 @@ function setLayout() {
-webkit-app-region: no-drag;
}
.title {
color: #4b73df;
font-size: 18px;
padding: 0 20px;
}
}
.right-section {
@ -287,11 +328,25 @@ function setLayout() {
flex-direction: column;
.user {
padding-right: 10px;
.user-info {
padding-right: 5px;
align-items: center;
align-items: flex-start;
flex-direction: column;
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 {
display: flex;
align-items: center;
.user-avatar {
width: 30px;
height: 30px;
width: 45px;
height: 45px;
border-radius: 10px;
margin-top: 8px;
margin-right: 10px;
}

View File

@ -207,7 +207,6 @@ export default {
},
openFileWin(items) {
if (items.fileFlag === 'apt') {
console.log(this.curNode);
let curBook = JSON.parse(localStorage.getItem('curBook'))
const path="/teaching/aptindex?id="+items.fileId + "&unitId=" + this.curNode.id + "&bookId=" + curBook.id;
let configObj = outLink().getBaseData()