Merge branch 'main' into zhuhao_dev
# Conflicts: # src/renderer/src/views/prepare/index.vue
This commit is contained in:
commit
c8f1047124
|
@ -1,13 +1,17 @@
|
|||
import { app, shell, BrowserWindow, ipcMain } from 'electron'
|
||||
import { app, shell, BrowserWindow, ipcMain, session } from 'electron'
|
||||
import { join } from 'path'
|
||||
import { electronApp, optimizer, is } from '@electron-toolkit/utils'
|
||||
import icon from '../../resources/icon.png?asset'
|
||||
import File from './file'
|
||||
|
||||
File({ app, shell, BrowserWindow, ipcMain })
|
||||
function createWindow() {
|
||||
// Create the browser window.
|
||||
const mainWindow = new BrowserWindow({
|
||||
|
||||
let mainWindow, loginWindow
|
||||
|
||||
//登录窗口
|
||||
function createLoginWindow() {
|
||||
if (loginWindow) return
|
||||
loginWindow = new BrowserWindow({
|
||||
width: 888,
|
||||
height: 520,
|
||||
show: false,
|
||||
|
@ -20,53 +24,153 @@ function createWindow() {
|
|||
nodeIntegration: true
|
||||
}
|
||||
})
|
||||
const loginURL = is.dev ? `http://localhost:5173/#/login` : `file://${__dirname}/index.html/login`
|
||||
loginWindow.loadURL(loginURL)
|
||||
|
||||
loginWindow.once('ready-to-show', () => {
|
||||
loginWindow.show()
|
||||
})
|
||||
|
||||
loginWindow.on('closed', () => {
|
||||
loginWindow = null
|
||||
})
|
||||
}
|
||||
//主窗口
|
||||
function createMainWindow() {
|
||||
mainWindow = new BrowserWindow({
|
||||
width: 1200,
|
||||
height: 700,
|
||||
show: false,
|
||||
frame: false,
|
||||
autoHideMenuBar: true,
|
||||
...(process.platform === 'linux' ? { icon } : {}),
|
||||
webPreferences: {
|
||||
preload: join(__dirname, '../preload/index.js'),
|
||||
sandbox: false,
|
||||
nodeIntegration: true
|
||||
}
|
||||
})
|
||||
|
||||
mainWindow.on('ready-to-show', () => {
|
||||
mainWindow.show()
|
||||
})
|
||||
|
||||
|
||||
|
||||
mainWindow.webContents.setWindowOpenHandler((details) => {
|
||||
shell.openExternal(details.url)
|
||||
return { action: 'deny' }
|
||||
})
|
||||
mainWindow.webContents.openDevTools()
|
||||
// HMR for renderer base on electron-vite cli.
|
||||
// Load the remote URL for development or the local html file for production.
|
||||
|
||||
if (is.dev && process.env['ELECTRON_RENDERER_URL']) {
|
||||
mainWindow.loadURL(process.env['ELECTRON_RENDERER_URL'])
|
||||
|
||||
// mainWindow.loadURL('https://file.ysaix.com:7868/')
|
||||
|
||||
} else {
|
||||
// mainWindow.loadURL('https://file.ysaix.com:7868/')
|
||||
mainWindow.loadFile(join(__dirname, '../renderer/index.html'))
|
||||
}
|
||||
}
|
||||
|
||||
// This method will be called when Electron has finished
|
||||
// initialization and is ready to create browser windows.
|
||||
// Some APIs can only be used after this event occurs.
|
||||
app.whenReady().then(() => {
|
||||
// Set app user model id for windows
|
||||
// 作业窗口相关-开发中
|
||||
let workWindow
|
||||
function createWork(data) {
|
||||
if (workWindow) return
|
||||
workWindow = new BrowserWindow({
|
||||
width: 650,
|
||||
height: 500,
|
||||
show: false,
|
||||
frame: true,
|
||||
|
||||
autoHideMenuBar: true,
|
||||
...(process.platform === 'linux' ? { icon } : {}),
|
||||
webPreferences: {
|
||||
sandbox: false,
|
||||
nodeIntegration: true
|
||||
}
|
||||
})
|
||||
|
||||
workWindow.webContents.session.cookies.set(
|
||||
{
|
||||
url: 'https://file.ysaix.com:7868',
|
||||
name: 'Admin-Token',
|
||||
value: data
|
||||
},
|
||||
function (error) {
|
||||
if (error) {
|
||||
console.error('Set cookie failed:', error)
|
||||
} else {
|
||||
console.log('Cookie set successfully.')
|
||||
}
|
||||
}
|
||||
)
|
||||
workWindow.loadURL(
|
||||
'https://file.ysaix.com:7868/teaching/classtaskassign?titleName=%E4%BD%9C%E4%B8%9A%E5%B8%83%E7%BD%AE'
|
||||
)
|
||||
|
||||
workWindow.once('ready-to-show', () => {
|
||||
workWindow.show()
|
||||
})
|
||||
workWindow.on('closed', () => {
|
||||
workWindow = null
|
||||
})
|
||||
}
|
||||
|
||||
// 初始化完成
|
||||
app.on('ready', () => {
|
||||
// 设置应用程序用户模型标识符
|
||||
electronApp.setAppUserModelId('com.electron')
|
||||
|
||||
// Default open or close DevTools by F12 in development
|
||||
// and ignore CommandOrControl + R in production.
|
||||
// see https://github.com/alex8088/electron-toolkit/tree/master/packages/utils
|
||||
//一个新的browserWindow 被创建时触发
|
||||
app.on('browser-window-created', (_, window) => {
|
||||
optimizer.watchWindowShortcuts(window)
|
||||
})
|
||||
|
||||
//窗口 最大、最小、关闭
|
||||
ipcMain.on('minimize-window', () => {
|
||||
if (loginWindow) {
|
||||
loginWindow.minimize()
|
||||
}
|
||||
if (mainWindow) {
|
||||
mainWindow.minimize()
|
||||
}
|
||||
})
|
||||
|
||||
ipcMain.on('maximize-window', () => {
|
||||
mainWindow.isMaximized() ? mainWindow.unmaximize() : mainWindow.maximize()
|
||||
})
|
||||
|
||||
createWindow()
|
||||
ipcMain.on('close-window', () => {
|
||||
if (loginWindow) {
|
||||
loginWindow.destroy()
|
||||
}
|
||||
if (mainWindow) {
|
||||
mainWindow.destroy()
|
||||
}
|
||||
})
|
||||
|
||||
// 打开主窗口
|
||||
ipcMain.on('openMainWindow', () => {
|
||||
if (!mainWindow) {
|
||||
createMainWindow()
|
||||
}
|
||||
|
||||
loginWindow.destroy()
|
||||
loginWindow = null
|
||||
})
|
||||
// 打开登录窗口
|
||||
ipcMain.on('openLoginWindow', () => {
|
||||
if (!loginWindow) {
|
||||
createLoginWindow()
|
||||
}
|
||||
mainWindow.destroy()
|
||||
loginWindow.show()
|
||||
loginWindow.focus()
|
||||
})
|
||||
|
||||
//打开作业窗口
|
||||
ipcMain.on('openWork', (e, data) => {
|
||||
createWork(data)
|
||||
})
|
||||
|
||||
createLoginWindow()
|
||||
app.on('activate', function () {
|
||||
// On macOS it's common to re-create a window in the app when the
|
||||
// dock icon is clicked and there are no other windows open.
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||
if (BrowserWindow.getAllWindows().length === 0) createLoginWindow()
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -78,35 +182,3 @@ app.on('window-all-closed', () => {
|
|||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
ipcMain.on('toggle-top', (event) => {
|
||||
const win = BrowserWindow.getFocusedWindow();
|
||||
const isAlwaysOnTop = win.isAlwaysOnTop();
|
||||
win.setAlwaysOnTop(!isAlwaysOnTop);
|
||||
event.sender.send('top-status-changed', !isAlwaysOnTop);
|
||||
})
|
||||
|
||||
|
||||
ipcMain.on('minimize-window', () => {
|
||||
const win = BrowserWindow.getFocusedWindow();
|
||||
win.minimize();
|
||||
});
|
||||
|
||||
ipcMain.on('maximize-window', () => {
|
||||
const win = BrowserWindow.getFocusedWindow();
|
||||
if (win.isMaximized()) {
|
||||
win.unmaximize();
|
||||
} else {
|
||||
win.maximize();
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.on('close-window', () => {
|
||||
const win = BrowserWindow.getFocusedWindow();
|
||||
win.close();
|
||||
});
|
||||
ipcMain.on('set-winsize', (e, {x, y})=>{
|
||||
const win = BrowserWindow.getFocusedWindow();
|
||||
win.setSize(x,y);
|
||||
win.center()
|
||||
})
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
@font-face {
|
||||
font-family: "iconfont"; /* Project id 2794390 */
|
||||
src: url('iconfont.woff2?t=1721179711733') format('woff2'),
|
||||
url('iconfont.woff?t=1721179711733') format('woff'),
|
||||
url('iconfont.ttf?t=1721179711733') format('truetype'),
|
||||
url('iconfont.svg?t=1721179711733#iconfont') format('svg');
|
||||
src: url('iconfont.woff2?t=1721698955462') format('woff2'),
|
||||
url('iconfont.woff?t=1721698955462') format('woff'),
|
||||
url('iconfont.ttf?t=1721698955462') format('truetype'),
|
||||
url('iconfont.svg?t=1721698955462#iconfont') format('svg');
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
|
@ -14,6 +14,10 @@
|
|||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.icon-lingdang:before {
|
||||
content: "\e613";
|
||||
}
|
||||
|
||||
.icon-yidongdaozu:before {
|
||||
content: "\e67d";
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -5,6 +5,13 @@
|
|||
"css_prefix_text": "icon-",
|
||||
"description": "",
|
||||
"glyphs": [
|
||||
{
|
||||
"icon_id": "17990800",
|
||||
"name": "铃铛",
|
||||
"font_class": "lingdang",
|
||||
"unicode": "e613",
|
||||
"unicode_decimal": 58899
|
||||
},
|
||||
{
|
||||
"icon_id": "1207918",
|
||||
"name": "移动到组",
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
/>
|
||||
<missing-glyph />
|
||||
|
||||
<glyph glyph-name="lingdang" unicode="" d="M257.7 243.70000000000005h510.6c17.9 0 32.5 14.5 32.5 32.5V480.9c0 143.2-104.6 261.9-241.5 284 2.1 5.5 3.3 11.6 3.3 17.8 0 27.4-22.2 49.6-49.6 49.6s-49.6-22.2-49.6-49.6c0-6.3 1.2-12.3 3.3-17.8-136.9-22.1-241.5-140.9-241.5-284v-204.7c0-17.9 14.6-32.5 32.5-32.5zM513-63.60000000000002c44.4 0 80.3 36 80.3 80.3H432.7c0-44.4 35.9-80.3 80.3-80.3zM911.7 115L895 148.29999999999995c-14.8 29.7-47.7 52.1-74.5 52.1h-615c-26.8 0-59.7-22.4-74.5-52.1L114.3 115c-17.5-35.1-6.6-65.9 25.9-65.9h745.6c32.5 0 43.5 30.8 25.9 65.9z" horiz-adv-x="1024" />
|
||||
|
||||
<glyph glyph-name="yidongdaozu" unicode="" d="M904.448 270.272 119.616 270.272c-23.68 0-44.736-14.656-52.48-36.48C65.024 227.968 64 221.952 64 216c0-16.32 7.616-32.192 21.184-42.688l293.248-225.728c24.128-18.56 59.008-14.464 78.016 9.088 18.944 23.552 14.848 57.664-9.28 76.224L288 156.544l616 0c30.72 0 56 29.44 56 59.456C960 246.016 935.168 270.272 904.448 270.272zM119.552 497.728l784.832 0c23.68 0 44.736 14.656 52.48 36.48C958.976 540.032 960 546.048 960 552c0 16.32-7.616 32.192-21.184 42.688l-293.248 225.728c-24.128 18.56-59.008 14.464-78.016-9.088C548.608 787.776 552.64 753.6 576.832 735.04L736 611.456 120 611.456C89.28 611.456 64 582.016 64 552 64 521.984 88.832 497.728 119.552 497.728z" horiz-adv-x="1024" />
|
||||
|
||||
<glyph glyph-name="shanchu" unicode="" d="M736.653061-33.959184H287.346939c-45.97551 0-83.591837 37.616327-83.591837 83.591837V540.734694h616.489796v-491.102041c0-45.97551-37.616327-83.591837-83.591837-83.591837zM245.55102 498.938776v-449.306123c0-22.987755 18.808163-41.795918 41.795919-41.795918h449.306122c22.987755 0 41.795918 18.808163 41.795919 41.795918V498.938776H245.55102zM407.510204 101.877551c-11.493878 0-20.897959 9.404082-20.897959 20.897959V384c0 11.493878 9.404082 20.897959 20.897959 20.897959s20.897959-9.404082 20.897959-20.897959v-261.22449c0-11.493878-9.404082-20.897959-20.897959-20.897959zM616.489796 101.877551c-11.493878 0-20.897959 9.404082-20.897959 20.897959V384c0 11.493878 9.404082 20.897959 20.897959 20.897959s20.897959-9.404082 20.897959-20.897959v-261.22449c0-11.493878-9.404082-20.897959-20.897959-20.897959zM846.367347 498.938776H177.632653c-45.97551 0-83.591837 37.616327-83.591837 83.591836v31.346939c0 45.97551 37.616327 83.591837 83.591837 83.591837h668.734694c45.97551 0 83.591837-37.616327 83.591837-83.591837v-31.346939c0-45.97551-37.616327-83.591837-83.591837-83.591836zM177.632653 655.673469c-22.987755 0-41.795918-18.808163-41.795918-41.795918v-31.346939c0-22.987755 18.808163-41.795918 41.795918-41.795918h668.734694c22.987755 0 41.795918 18.808163 41.795918 41.795918v31.346939c0 22.987755-18.808163 41.795918-41.795918 41.795918H177.632653zM650.44898 655.673469h-276.89796c-28.734694 0-52.244898 23.510204-52.244898 52.244898v41.795919c0 28.734694 23.510204 52.244898 52.244898 52.244898h276.89796c28.734694 0 52.244898-23.510204 52.244898-52.244898v-41.795919c0-28.734694-23.510204-52.244898-52.244898-52.244898z m-276.89796 104.489796c-5.746939 0-10.44898-4.702041-10.448979-10.448979v-41.795919c0-5.746939 4.702041-10.44898 10.448979-10.448979h276.89796c5.746939 0 10.44898 4.702041 10.448979 10.448979v41.795919c0 5.746939-4.702041 10.44898-10.448979 10.448979h-276.89796z" horiz-adv-x="1024" />
|
||||
|
|
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 50 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -64,6 +64,8 @@ const defaultProps = {
|
|||
const curBookId = ref(-1)
|
||||
//当前教材名称
|
||||
const curBookName = ref('')
|
||||
//当前教材封面图
|
||||
const curBookImg = ref('')
|
||||
// 上册
|
||||
const volumeOne = ref([])
|
||||
// 下册
|
||||
|
@ -110,9 +112,10 @@ const getSubjectContent = async () => {
|
|||
}
|
||||
|
||||
//选择教材
|
||||
const changeBook = ({ id, itemtitle }) => {
|
||||
const changeBook = ({ id, itemtitle, avartar }) => {
|
||||
curBookId.value = id
|
||||
curBookName.value = itemtitle
|
||||
curBookImg.value = BaseUrl + avartar
|
||||
getTreeData()
|
||||
setTimeout(() => {
|
||||
dialogVisible.value = false
|
||||
|
@ -144,7 +147,8 @@ const emitChangeBook = () => {
|
|||
const data = {
|
||||
textBook: {
|
||||
curBookId: curBookId.value,
|
||||
curBookName: curBookName.value
|
||||
curBookName: curBookName.value,
|
||||
curBookImg: curBookImg.value
|
||||
},
|
||||
node: curNode
|
||||
}
|
||||
|
@ -236,6 +240,7 @@ const getSubject = async () => {
|
|||
// 默认第一个
|
||||
curBookName.value = subjectList.value[0].itemtitle
|
||||
curBookId.value = subjectList.value[0].id
|
||||
curBookImg.value = BaseUrl + subjectList.value[0].avartar
|
||||
}
|
||||
|
||||
|
||||
|
@ -264,7 +269,8 @@ const handleNodeClick = (data, node) => {
|
|||
let curData = {
|
||||
textBook: {
|
||||
curBookId: curBookId.value,
|
||||
curBookName: curBookName.value
|
||||
curBookName: curBookName.value,
|
||||
curBookImg: curBookImg.value
|
||||
},
|
||||
node: toRaw(currentNode)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
<template>
|
||||
<div class="header-tool flex">
|
||||
<span title="最小化" @click="minimizeWindow"><i class="iconfont icon-zuixiaohua"></i></span>
|
||||
<span v-if="isHasMax" :title="isMaxSize ? '向下还原' : '最大化'" @click="maximizeWindow">
|
||||
<i class="iconfont" :class="isMaxSize ? 'icon-zuidahua' : 'icon-window-max_line'"></i></span>
|
||||
<span class="close" title="关闭" @click="closeWindow"><i class="iconfont icon-close"></i></span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
|
||||
const props = defineProps({
|
||||
isHasMax: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
})
|
||||
const isMaxSize = ref(false)
|
||||
|
||||
// 最小化
|
||||
const minimizeWindow = () => {
|
||||
ipcRenderer?.send('minimize-window')
|
||||
}
|
||||
//最大化
|
||||
const maximizeWindow = () => {
|
||||
ipcRenderer?.send('maximize-window')
|
||||
isMaxSize.value = !isMaxSize.value
|
||||
}
|
||||
//关闭
|
||||
const closeWindow = () => {
|
||||
ipcRenderer?.send('close-window')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.header-tool {
|
||||
-webkit-app-region: no-drag;
|
||||
|
||||
span {
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
padding: 2px 10px;
|
||||
|
||||
&:hover {
|
||||
background-color: #c4c4c4;
|
||||
}
|
||||
}
|
||||
|
||||
.close {
|
||||
&:hover {
|
||||
background-color: #fb4a3e;
|
||||
|
||||
.iconfont {
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -14,12 +14,7 @@
|
|||
</div>
|
||||
|
||||
<div class="right-section flex">
|
||||
<div class="header-tool flex">
|
||||
<span title="最小化" @click="minimizeWindow"><i class="iconfont"></i></span>
|
||||
<span :title="isMaxSize ? '向下还原' : '最大化'" @click="maximizeWindow"><i class="iconfont">{{ isMaxSize ? '' :
|
||||
'' }}</i></span>
|
||||
<span class="close" title="关闭" @click="closeWindow"><i class="iconfont"></i></span>
|
||||
</div>
|
||||
<WindowTools/>
|
||||
<div class="user flex">
|
||||
<div class="avatar-container">
|
||||
<el-dropdown @command="handleCommand" class="right-menu-item hover-effect" trigger="click">
|
||||
|
@ -46,11 +41,11 @@
|
|||
import { ref, watch } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
import WindowTools from '@/components/window-tools/index.vue'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
||||
const userStore = useUserStore()
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
const isMaxSize = ref(false)
|
||||
const userStore = useUserStore()
|
||||
const router = useRouter()
|
||||
const currentRoute = ref('')
|
||||
|
||||
|
@ -81,19 +76,6 @@ watch(
|
|||
{ immediate: true }
|
||||
)
|
||||
|
||||
// 最小化
|
||||
const minimizeWindow = () => {
|
||||
ipcRenderer.send('minimize-window')
|
||||
}
|
||||
//最大化
|
||||
const maximizeWindow = () => {
|
||||
ipcRenderer?.send('maximize-window')
|
||||
isMaxSize.value = !isMaxSize.value
|
||||
}
|
||||
//关闭
|
||||
const closeWindow = () => {
|
||||
ipcRenderer.send('close-window')
|
||||
}
|
||||
|
||||
const changePage = (url) => {
|
||||
router.push(url)
|
||||
|
@ -118,11 +100,11 @@ function logout() {
|
|||
type: 'warning'
|
||||
}).then(() => {
|
||||
userStore.logOut().then(() => {
|
||||
// location.href = '/index#/login';
|
||||
router.replace('/login')
|
||||
// router.replace('/login')
|
||||
ipcRenderer && ipcRenderer.send('openLoginWindow')
|
||||
}).catch(()=>{
|
||||
router.replace('/login')
|
||||
// location.href = '/index#/login';
|
||||
// router.replace('/login')
|
||||
ipcRenderer && ipcRenderer.send('openLoginWindow')
|
||||
})
|
||||
}).catch(() => { });
|
||||
}
|
||||
|
@ -213,25 +195,6 @@ watch(()=> userStore.avatar,() => {
|
|||
padding-bottom: 5px;
|
||||
flex-direction: column;
|
||||
|
||||
.header-tool {
|
||||
-webkit-app-region: no-drag;
|
||||
span {
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
padding: 2px 10px;
|
||||
&:hover {
|
||||
background-color: #c4c4c4;
|
||||
}
|
||||
}
|
||||
.close{
|
||||
&:hover{
|
||||
background-color: #fb4a3e;
|
||||
.iconfont{
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.user {
|
||||
.user-info {
|
||||
|
|
|
@ -18,8 +18,6 @@ import uploaderState from '@/store/modules/uploader'
|
|||
import { ref } from 'vue'
|
||||
let uploaderStore = ref(uploaderState())
|
||||
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
ipcRenderer ? ipcRenderer .send('set-winsize', { x: 1200, y: 700 }) : ''
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
@ -12,7 +12,7 @@ export const constantRoutes = [
|
|||
{
|
||||
path: '/',
|
||||
component: Layout,
|
||||
redirect: '/login',
|
||||
redirect: '/resource',
|
||||
children: [
|
||||
{
|
||||
path: '/resource',
|
||||
|
|
|
@ -4,6 +4,7 @@ import { getToken } from '@/utils/auth'
|
|||
import errorCode from '@/utils/errorCode'
|
||||
import { tansParams, blobValidate } from '@/utils/ruoyi'
|
||||
import cache from '@/plugins/cache'
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
||||
|
@ -81,7 +82,7 @@ service.interceptors.response.use(res => {
|
|||
ElMessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => {
|
||||
isRelogin.show = false;
|
||||
useUserStore().logOut().then(() => {
|
||||
location.href = '/index#/login';
|
||||
ipcRenderer && ipcRenderer.send('openLoginWindow')
|
||||
})
|
||||
}).catch(() => {
|
||||
isRelogin.show = false;
|
||||
|
|
|
@ -7,10 +7,7 @@
|
|||
<img class="welcome-img" :src="leftBg2" />
|
||||
</div>
|
||||
<div class="box-item login">
|
||||
<div class="header-tool flex">
|
||||
<span @click="minimizeWindow" title="最小化"><i class="iconfont"></i></span>
|
||||
<span @click="closeWindow" title="关闭"><i class="iconfont"></i></span>
|
||||
</div>
|
||||
<WindowTools :isHasMax="false"/>
|
||||
<div class="login-title">账号登录</div>
|
||||
<el-form ref="formRef" class="login-form" :model="loginForm" :rules="rules" size="large">
|
||||
<el-form-item prop="username">
|
||||
|
@ -38,19 +35,16 @@
|
|||
</template>
|
||||
<script setup>
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import Cookies from 'js-cookie'
|
||||
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import leftBg2 from '@/assets/images/login/left-bg2.png'
|
||||
import WindowTools from '@/components/window-tools/index.vue'
|
||||
import SelectSubject from '@/components/select-subject/index.vue'
|
||||
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
const formRef = ref()
|
||||
const userStore = useUserStore()
|
||||
const router = useRouter()
|
||||
const isMaxSize = ref(false)
|
||||
const btnLoading = ref(false)
|
||||
const isSubject = ref(false)
|
||||
//表单
|
||||
|
@ -65,8 +59,6 @@ const rules = reactive({
|
|||
password: [{ required: true, trigger: 'blur', message: '请输入您的密码' }]
|
||||
})
|
||||
|
||||
ipcRenderer ? ipcRenderer.send('set-winsize', { x: 888, y: 520 }) : ''
|
||||
|
||||
//登录
|
||||
const submitForm = async (formEl) => {
|
||||
if (!formEl) return
|
||||
|
@ -90,13 +82,12 @@ const submitForm = async (formEl) => {
|
|||
await userStore.getInfo()
|
||||
if(userStore.user.edustage || userStore.user.edusubject){
|
||||
ElMessage.success('登录成功')
|
||||
router.push('/resource')
|
||||
ipcRenderer && ipcRenderer.send('openMainWindow')
|
||||
}
|
||||
else{
|
||||
isSubject.value = true
|
||||
}
|
||||
|
||||
|
||||
}finally{
|
||||
btnLoading.value = false
|
||||
}
|
||||
|
@ -107,7 +98,7 @@ const submitForm = async (formEl) => {
|
|||
const successEditSubject = ()=>{
|
||||
isSubject.value = false
|
||||
ElMessage.success('登录成功')
|
||||
router.push('/resource')
|
||||
ipcRenderer && ipcRenderer.send('openMainWindow')
|
||||
}
|
||||
|
||||
const getCookie = () => {
|
||||
|
@ -122,19 +113,6 @@ const getCookie = () => {
|
|||
onMounted(()=>{
|
||||
getCookie()
|
||||
})
|
||||
// 最小化
|
||||
const minimizeWindow = () => {
|
||||
ipcRenderer.send('minimize-window')
|
||||
}
|
||||
//最大化
|
||||
const maximizeWindow = () => {
|
||||
ipcRenderer.send('maximize-window')
|
||||
isMaxSize.value = !isMaxSize.value
|
||||
}
|
||||
//关闭
|
||||
const closeWindow = () => {
|
||||
ipcRenderer.send('close-window')
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.login-container {
|
||||
|
|
|
@ -2,19 +2,27 @@
|
|||
<div v-loading="isLoading" class="page-resource flex">
|
||||
<ChooseTextbook @change-book="nodeClick" @node-click="nodeClick" />
|
||||
<div class="page-right">
|
||||
<div class="header-top flex">
|
||||
<div class="textbook-img">
|
||||
<el-image style="width: 80px; height: 110px" :src="curBookImg" />
|
||||
</div>
|
||||
<div class="top-item">
|
||||
<el-button class="btn">教材研读</el-button>
|
||||
<el-button class="btn">电子课本</el-button>
|
||||
<el-button class="btn">高考研读</el-button>
|
||||
<el-button class="btn">教学大模型</el-button>
|
||||
</div>
|
||||
<el-button type="primary" class="to-class-btn">
|
||||
<i class="iconfont icon-lingdang"></i>上课</el-button>
|
||||
</div>
|
||||
<div class="prepare-body-header">
|
||||
|
||||
<div>
|
||||
<label style="font-size: 15px">共{{ currentFileList.length }}个文件</label>
|
||||
<el-popover placement="top-start" :width="250" trigger="hover">
|
||||
<template #default>
|
||||
<div>
|
||||
<el-button
|
||||
v-if="lastAsyncAllTime"
|
||||
type="success"
|
||||
size="small"
|
||||
:icon="Check"
|
||||
circle
|
||||
/>
|
||||
<el-button v-if="lastAsyncAllTime" type="success" size="small" :icon="Check" circle />
|
||||
{{ lastAsyncAllTime ? toTimeText(lastAsyncAllTime) + '同步成功' : '' }}
|
||||
</div>
|
||||
</template>
|
||||
|
@ -29,38 +37,22 @@
|
|||
</el-popover>
|
||||
</div>
|
||||
<div style="display: flex">
|
||||
<el-button>布置作业</el-button>
|
||||
<el-button @click="isDialogOpen = true">上传资料</el-button>
|
||||
<el-button type="primary" style="margin-left: 10px" @click="createFile"
|
||||
>新建课件</el-button
|
||||
>
|
||||
<el-button type="primary" style="margin-left: 10px" @click="createFile">新建课件</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-checkbox-group
|
||||
v-model="checkFileList"
|
||||
class="prepare-body-main"
|
||||
:style="{ 'margin-bottom': checkFileList.length > 0 ? '40px' : '0' }"
|
||||
>
|
||||
<file-list-item
|
||||
v-for="(item, index) in currentFileList"
|
||||
:key="index"
|
||||
:item="item"
|
||||
:index="index"
|
||||
@on-move="onMoveSingleFile"
|
||||
@on-delete="deleteTalk"
|
||||
>
|
||||
<el-checkbox-group v-model="checkFileList" class="prepare-body-main"
|
||||
:style="{ 'margin-bottom': checkFileList.length > 0 ? '40px' : '0' }">
|
||||
<file-list-item v-for="(item, index) in currentFileList" :key="index" :item="item" :index="index"
|
||||
@on-move="onMoveSingleFile" @on-delete="deleteTalk">
|
||||
<el-checkbox label="" :value="item" />
|
||||
</file-list-item>
|
||||
</el-checkbox-group>
|
||||
<file-oper-batch
|
||||
v-show="checkFileList.length > 0"
|
||||
<file-oper-batch v-show="checkFileList.length > 0"
|
||||
:indeterminate="checkFileList.length > 0 && checkFileList.length < currentFileList.length"
|
||||
:choose="checkFileList"
|
||||
:check-all="isCheckAll"
|
||||
@click-delete="clickDelete"
|
||||
@click-move="clickMove"
|
||||
@cancel="checkFileList = []"
|
||||
@click-choose="clickChoose"
|
||||
></file-oper-batch>
|
||||
:choose="checkFileList" :check-all="isCheckAll" @click-delete="clickDelete" @click-move="clickMove"
|
||||
@cancel="checkFileList = []" @click-choose="clickChoose"></file-oper-batch>
|
||||
</div>
|
||||
<MoveFile v-model="isMoveDialogOpen" @on-submit="chooseMoveCata" />
|
||||
<uploadDialog v-model="isDialogOpen" @submit-file="submitFile" />
|
||||
|
@ -104,7 +96,9 @@ export default {
|
|||
levelSecondId: null,
|
||||
fileSource: '个人',
|
||||
fileRoot: '备课'
|
||||
}
|
||||
},
|
||||
// 当前教材封面图
|
||||
curBookImg: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -276,6 +270,8 @@ export default {
|
|||
},
|
||||
nodeClick(data) {
|
||||
if (this.currentNode.id === data.node.id) return
|
||||
this.curBookImg = data.textBook.curBookImg
|
||||
console.log(data.textBook)
|
||||
this.checkFileList = []
|
||||
let cata = parseCataByNode(data.node)
|
||||
this.currentNode = data.node
|
||||
|
@ -341,6 +337,7 @@ export default {
|
|||
height: 100%;
|
||||
|
||||
.page-right {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
|
@ -352,6 +349,55 @@ export default {
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.header-top {
|
||||
height: 150px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: linear-gradient(#97c4ed, #7aa8e5);
|
||||
padding-right: 20px;
|
||||
.textbook-img{
|
||||
height: 120px;
|
||||
background-color: #ffffff;
|
||||
padding: 5px;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
margin-right: 20px;
|
||||
}
|
||||
.top-item{
|
||||
width: 230px;
|
||||
|
||||
flex-wrap: wrap;
|
||||
.btn{
|
||||
width: 102px;
|
||||
background: none;
|
||||
color: #ffffff;
|
||||
border-width: 2px;
|
||||
border-color: #ffffff;
|
||||
&:hover{
|
||||
background: rgba(255, 255, 255, 0.3)
|
||||
}
|
||||
&:first-child{
|
||||
margin-left: 12px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
&:nth-child(2){
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.to-class-btn{
|
||||
width: 130px;
|
||||
height: 80px;
|
||||
margin-left: 25px;
|
||||
font-size: 18px;
|
||||
.icon-lingdang{
|
||||
margin-right: 5px;
|
||||
color: #ffffff;
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.prepare-body-header {
|
||||
height: 60px;
|
||||
width: 100%;
|
||||
|
@ -360,6 +406,7 @@ export default {
|
|||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
padding: 0 20px;
|
||||
|
||||
}
|
||||
|
||||
.prepare-body-main {
|
||||
|
|
Loading…
Reference in New Issue