Compare commits

...

77 Commits

Author SHA1 Message Date
朱浩 cdf12cf213 区分生产和测试版本,测试版会直接显示测试版文字 2024-09-03 16:37:39 +08:00
朱浩 59ca00d6d1 Merge branch 'main' into zhuhao_dev
# Conflicts:
#	package.json
2024-09-03 16:15:07 +08:00
zhengdegang 5433e47d0b Merge pull request '修复bug-数据共享' (#168) from zdg into main
Reviewed-on: #168
2024-09-03 13:19:35 +08:00
zdg eb3778dde2 修复bug-数据共享 2024-09-03 13:18:40 +08:00
zhengdegang 411ef757e2 Merge pull request 'zdg' (#167) from zdg into main
Reviewed-on: #167
2024-09-02 22:23:07 +08:00
zdg 0201385e75 Merge branch 'main' of http://27.128.240.72:3000/zhuhao/AIx_Smarttalk into zdg 2024-09-02 22:22:14 +08:00
zdg ea9af1440e 数据库共享:结合 pinia + electron-store
关闭开发 本地文件日志,只有生产有日志文件记录
2024-09-02 22:22:03 +08:00
zdg b4c2751e8c 注释代码放开 2024-09-02 18:35:16 +08:00
yangws c5257b760a Merge pull request 'fix:隐藏掉班级中心所有的操作按钮;' (#166) from yangws into main
Reviewed-on: #166
2024-09-02 16:58:33 +08:00
yangws 22239090ea fix:隐藏掉班级中心所有的操作按钮; 2024-09-02 16:57:54 +08:00
zdg 1d808950b5 优化bug 2024-09-02 16:33:25 +08:00
zhengdegang cb0d60b93e Merge pull request 'zdg' (#165) from zdg into main
Reviewed-on: #165
2024-09-02 13:53:21 +08:00
zdg d65af70a34 Merge branch 'main' of http://27.128.240.72:3000/zhuhao/AIx_Smarttalk into zdg 2024-09-02 13:51:36 +08:00
zdg 3f4e9c35b0 崩溃等,日志文件配置 2024-09-02 13:51:25 +08:00
zhengdegang a133c322f3 Merge pull request 'zdg' (#164) from zdg into main
Reviewed-on: #164
2024-09-02 11:15:52 +08:00
zdg b5d41050ae 数据共享-修改成 session local
永久和临时
2024-09-02 11:14:47 +08:00
朱浩 0e5ca5eff2 Merge branch 'main' into zhuhao_dev 2024-08-31 14:13:56 +08:00
zdg fa77c6cc6b 版本 2024-08-30 17:29:15 +08:00
lyc ff97a2bef6 Merge pull request 'lyc-dev' (#163) from lyc-dev into main 2024-08-30 14:29:52 +08:00
lyc 05c567d1cd console 2024-08-30 14:28:55 +08:00
lyc 1a6abfaa50 预约课程-时间限制 2024-08-30 14:15:15 +08:00
zhengdegang 2ae200cc9e Merge pull request 'zdg' (#162) from zdg into main
Reviewed-on: #162
2024-08-30 13:46:48 +08:00
zdg 177df96d69 更新-logo 2024-08-30 13:45:01 +08:00
zdg 571bfc98f7 bug: 335 优化动画 2024-08-30 13:35:25 +08:00
yangws b249df2dff Merge pull request 'fix:修改老师创建查看自己小组的权限;' (#161) from yangws into main
Reviewed-on: #161
2024-08-30 09:33:01 +08:00
yangws 1871e7e565 fix:修改老师创建查看自己小组的权限; 2024-08-30 09:32:22 +08:00
lyc bb56c3fdab Merge pull request 'lyc-dev' (#160) from lyc-dev into main 2024-08-29 16:50:05 +08:00
lyc df8f4fcf92 Merge branch 'main' into lyc-dev 2024-08-29 16:48:39 +08:00
lyc d6b4ae011d 预约课程-默认时间-时间限制 2024-08-29 16:45:17 +08:00
yangws bf7f740aaf Merge pull request 'fix:无数据时处理;' (#159) from yangws into main
Reviewed-on: #159
2024-08-28 14:07:56 +08:00
yangws e6a0859f87 fix:无数据时处理; 2024-08-28 14:07:14 +08:00
zhengdegang 3d8dc4320d Merge pull request '更新作业推送' (#158) from zdg into main
Reviewed-on: #158
2024-08-27 11:38:46 +08:00
zdg 1518d9c3ae 更新作业推送 2024-08-27 11:36:30 +08:00
lyc 23878f5843 Merge pull request '教学研究室-打开教材分析' (#157) from lyc-dev into main 2024-08-26 14:39:56 +08:00
lyc 144da0ace9 教学研究室-打开教材分析 2024-08-26 14:34:35 +08:00
zhengdegang 46098aa733 Merge pull request 'zdg' (#156) from zdg into main
Reviewed-on: #156
2024-08-26 11:50:11 +08:00
zdg 13e755bb9a Merge branch 'main' of http://27.128.240.72:3000/zhuhao/AIx_Smarttalk into zdg 2024-08-26 11:48:41 +08:00
zdg b5ce949172 恢复 2024-08-26 11:48:18 +08:00
zdg d033c217d6 数据共享配置 渲染器和主进程 2024-08-26 11:47:10 +08:00
yangws edfdf8b9ad Merge pull request 'fix:年级不允许切换;' (#155) from yangws into main
Reviewed-on: #155
2024-08-26 09:31:02 +08:00
yangws 59be0c07d1 fix:年级不允许切换; 2024-08-26 09:30:26 +08:00
朱浩 e985c2e7af Merge branch 'main' into zhuhao_dev 2024-08-23 12:01:51 +08:00
朱浩 0ea628d174 二期:打包IM 2024-08-23 12:01:43 +08:00
朱浩 d4982d47c7 二期:打包IM 2024-08-23 12:01:21 +08:00
yangws 0ad99e9ac2 Merge pull request 'feat:修改固定住自己所选的学科学段;' (#154) from yangws into main
Reviewed-on: #154
2024-08-23 11:28:52 +08:00
yangws be222a2ba6 feat:修改固定住自己所选的学科学段; 2024-08-23 11:28:26 +08:00
lyc b922219602 Merge pull request 'lyc-dev' (#153) from lyc-dev into main 2024-08-23 11:22:52 +08:00
lyc 386c4e09c6 冲突 2024-08-23 11:21:57 +08:00
zhengdegang b738ade9a4 Merge pull request 'zdg' (#152) from zdg into main
Reviewed-on: #152
2024-08-23 10:45:00 +08:00
zdg 6f6d56b37b Merge branch 'main' of http://27.128.240.72:3000/zhuhao/AIx_Smarttalk into zdg 2024-08-23 10:43:57 +08:00
zdg c1f81a8e5c 更新 点赞,疑惑 2024-08-23 10:43:44 +08:00
lyc d003ecf8ce Merge branch 'main' into lyc-dev 2024-08-23 09:56:28 +08:00
lyc 146784bf26 增加一个预览文件 2024-08-23 09:56:14 +08:00
yangws 88e63f376c Merge pull request 'add:新增第三方对接素材;' (#151) from yangws into main
Reviewed-on: #151
2024-08-23 09:45:04 +08:00
yangws 99ee438fd7 add:新增第三方对接素材; 2024-08-23 09:44:03 +08:00
lyc 2279bbb904 布置作业修改 2024-08-22 10:43:05 +08:00
lyc b0d969546a Merge branch 'main' into lyc-dev 2024-08-22 09:43:10 +08:00
lyc 8ec96996c6 增加预览pdf 2024-08-22 09:42:55 +08:00
zhengdegang 968b5d3e43 Merge pull request 'zdg' (#150) from zdg into main
Reviewed-on: #150
2024-08-22 09:29:49 +08:00
zdg c0fd0ae9d3 Merge branch 'main' of http://27.128.240.72:3000/zhuhao/AIx_Smarttalk into zdg 2024-08-22 09:28:17 +08:00
zdg 86cd50b8a3 im-点赞 疑惑 作业布置 2024-08-22 09:14:21 +08:00
zhengdegang 9240c055f4 Merge pull request 'zdg' (#149) from zdg into main
Reviewed-on: #149
2024-08-21 09:21:06 +08:00
zdg 6d77d54bc1 Merge branch 'main' of http://27.128.240.72:3000/zhuhao/AIx_Smarttalk into zdg 2024-08-21 09:18:15 +08:00
zdg c57f21461a 点赞动画优化 2024-08-21 09:18:00 +08:00
lyc d669b6ee42 Merge pull request '教材选择不区分上下册' (#148) from lyc-dev into main 2024-08-20 17:11:00 +08:00
lyc 13598615c7 教材选择不区分上下册 2024-08-20 14:24:18 +08:00
zdg a80a3b006c Merge branch 'zdg' of http://27.128.240.72:3000/zhuhao/AIx_Smarttalk into zdg 2024-08-20 14:21:29 +08:00
zdg a2e72b855b 优化 2024-08-20 14:21:25 +08:00
zhangxuelin 1e0ff00503 1 2024-08-20 10:22:42 +08:00
zhangxuelin d30b4a230a Merge branch 'zdg' of http://27.128.240.72:3000/zhuhao/AIx_Smarttalk into zdg 2024-08-20 10:22:05 +08:00
zhangxuelin b8ea091bb5 最小化pdf 2024-08-20 10:22:02 +08:00
zdg 04a03b0c43 配置到公共环境,所有环境都使用 2024-08-20 09:54:24 +08:00
zdg f7ad8d4c71 Merge branch 'zdg' of http://27.128.240.72:3000/zhuhao/AIx_Smarttalk into zdg 2024-08-19 17:15:09 +08:00
朱浩 f38a14bc0b Merge branch 'zdg' into zhuhao_dev
# Conflicts:
#	package.json
#	src/renderer/src/plugins/shareStore.js
2024-08-19 17:00:42 +08:00
朱浩 f98fa5a3f3 二期:打包IM 2024-08-19 16:30:57 +08:00
zdg 6fb7369ce5 配置im 打包 2024-08-19 14:37:18 +08:00
zdg 49c4c7245a 打包chat-im 2024-08-19 14:21:42 +08:00
66 changed files with 3140 additions and 822 deletions

View File

@ -1,5 +1,5 @@
# 页面标题
VITE_APP_TITLE = AIx数字平台
VITE_APP_TITLE = AIx数字平台(测试版)
# 生产环境配置
VITE_APP_ENV = 'production'

View File

@ -1,7 +1,11 @@
appId: com.electron.app
productName: AIx
directories:
output: dist
buildResources: build
win:
executableName: AIx
icon: resources/logo2.ico
files:
- '!**/.vscode/*'
- '!src/*'
@ -10,9 +14,6 @@ files:
- '!{.env,.env.*,.npmrc,pnpm-lock.yaml}'
asarUnpack:
- resources/**
win:
executableName: AIx
icon: resources/logo2.ico
nsis:
oneClick: false
allowToChangeInstallationDirectory: true
@ -45,3 +46,9 @@ publish:
url: https://prev.ysaix.com:7868/src/assets/smarttalk/
electronDownload:
mirror: https://npmmirror.com/mirrors/electron/
# 额外依赖打包到输出目录
extraFiles:
- from: ./node_modules/im_electron_sdk/lib/
to: ./resources
filter:
- '**/*'

View File

@ -45,3 +45,9 @@ publish:
url: http://localhost:3000
electronDownload:
mirror: https://npmmirror.com/mirrors/electron/
# 额外依赖打包到输出目录
extraFiles:
- from: ./node_modules/im_electron_sdk/lib/
to: ./resources
filter:
- '**/*'

View File

@ -45,3 +45,9 @@ publish:
url: https://file.ysaix.com:7868/src/assets/smarttalk/
electronDownload:
mirror: https://npmmirror.com/mirrors/electron/
# 额外依赖打包到输出目录
extraFiles:
- from: ./node_modules/im_electron_sdk/lib/
to: ./resources
filter:
- '**/*'

View File

@ -1,6 +1,6 @@
{
"name": "aix-win",
"version": "1.1.2",
"version": "1.1.6",
"description": "An Electron application with Vue",
"main": "./out/main/index.js",
"author": "example.com",
@ -30,6 +30,7 @@
"crypto-js": "^4.2.0",
"electron-dl-manager": "^3.0.0",
"electron-log": "^5.1.7",
"electron-store": "8.0.0",
"electron-updater": "^6.1.7",
"element-plus": "^2.7.6",
"fabric": "^5.3.0",
@ -43,6 +44,7 @@
"pinia-plugin-persistedstate": "^3.2.1",
"spark-md5": "^3.0.2",
"vue-router": "^4.4.0",
"xgplayer": "^3.0.19",
"xlsx": "^0.18.5"
},
"devDependencies": {
@ -62,80 +64,5 @@
"vite-plugin-windicss": "^1.9.3",
"vue": "^3.4.30",
"windicss": "^3.5.6"
},
"build": {
"files": [
"src/app",
"bundle",
"icon"
],
"appId": "aix-win",
"mac": {
"gatekeeperAssess": false,
"hardenedRuntime": true,
"entitlements": "./signing/entitlements.mac.plist",
"entitlementsInherit": "./signing/entitlements.mac.plist",
"extendInfo": {
"NSMicrophoneUsageDescription": "Please give us access to your microphone",
"NSCameraUsageDescription": "Allow your conversational partners to see you in a Grape Call. You can turn off your video anytime during a call."
},
"icon": "./icon/im_electron_logo.png",
"extraFiles": [
{
"from": "./node_modules/im_electron_sdk/lib/",
"to": "./Resources",
"filter": [
"**/*"
]
},
{
"from": "./icon/",
"to": "./Resources",
"filter": [
"**/*"
]
}
]
},
"win": {
"icon": "./resources/logo.ico",
"target": [
{
"target": "nsis",
"arch": [
"x64"
]
}
],
"extraFiles": [
{
"from": "./node_modules/im_electron_sdk/lib/",
"to": "./resources",
"filter": [
"**/*"
]
}
]
},
"linux": {
"target": "deb",
"extraFiles": [
{
"from": "./node_modules/im_electron_sdk/lib/",
"to": "./resources",
"filter": [
"**/*"
]
},
{
"from": "node_modules/trtc-electron-sdk/build/Release/",
"to": "./resources",
"filter": [
"**/*"
]
}
]
}
}
}

BIN
resources/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

@ -3,7 +3,7 @@
*/
// import { ipcMain } from 'electron'
// const TimMain = require('im_electron_sdk/dist/main')
// import TimMain from 'im_electron_sdk/dist/main'
import TimMain from 'im_electron_sdk/dist/main'
// import {TIMErrCode} from 'im_electron_sdk/dist/enumbers'
const sdkappidDef = 1600034736 // 可以去腾讯云即时通信IM控制台申请

View File

@ -3,13 +3,19 @@ import { join } from 'path'
import { electronApp, optimizer, is } from '@electron-toolkit/utils'
import icon from '../../resources/icon.png?asset'
import File from './file'
// import chat from './chat' // chat封装
import Logger from './logger' // 日志封装
import chat from './chat' // chat封装
import Store from './store' // Store封装
import updateInit from './update'
// 代理 electron/remote
// 第一步引入remote
import remote from '@electron/remote/main'
// 第二步: 初始化remote
remote.initialize()
import updateInit from './update'
// 日志配置-初始化(日志直接绑定到console上)
if(!is.dev) Logger.initialize()
// 持久化数据-初始化
Store.initialize()
File({ app, shell, BrowserWindow, ipcMain })
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true'
@ -135,6 +141,11 @@ async function createLinkWin(data) {
.then(() => {})
.catch((error) => {})
data.fullPath = data.fullPath.replaceAll('//', '/')
if (data.fullPath.indexOf('?') !== -1) {
data.fullPath += '&urlSource=smarttalk'
}else {
data.fullPath += '?urlSource=smarttalk'
}
linkWin[data.key].loadURL(data.fullPath)
linkWin[data.key].once('ready-to-show', () => {
@ -149,8 +160,8 @@ async function createLinkWin(data) {
// 初始化完成
app.on('ready', () => {
appWatchError() // 监听app错误
process.env.LANG = 'en_US.UTF-8'
process.env['ELECTRON_DISABLE_SANDBOX'] = true;
// 设置应用程序用户模型标识符
electronApp.setAppUserModelId('com.electron')
@ -230,14 +241,14 @@ app.on('window-all-closed', () => {
// 监听全局事件
function handleAll() {
// const chatInstance = chat.initialize() // im-chat 实例
const chatInstance = chat.initialize() // im-chat 实例
// 新窗口创建-监听
ipcMain.on('new-window', (e, data) => {
const { id, type } = data
const win = BrowserWindow.fromId(id)
win.type = type // 绑定独立标识
remote.enable(win.webContents) // 开启远程服务
// chatInstance.enable(win.webContents) // 开启im-chat
chatInstance.enable(win.webContents) // 开启im-chat
})
// 用于监听-状态管理变化-同步所有窗口
ipcMain.handle('pinia-state-change', (e, storeName, jsonStr) => {
@ -256,3 +267,34 @@ function handleAll() {
win.webContents.send('pinia-state-set', storeName, jsonStr)
})
}
// app 崩溃监听器
function appWatchError() {
// 渲染进程崩溃
app.on('renderer-process-crashed', (event, webContents, killed) => {
console.error(
`APP-ERROR:renderer-process-crashed; event: ${JSON.stringify(event)}; webContents:${JSON.stringify(
webContents
)}; killed:${JSON.stringify(killed)}`
)
})
// GPU进程崩溃
app.on('gpu-process-crashed', (event, killed) => {
console.error(`APP-ERROR:gpu-process-crashed; event: ${JSON.stringify(event)}; killed: ${JSON.stringify(killed)}`)
})
// 渲染进程结束
app.on('render-process-gone', async (event, webContents, details) => {
console.error(
`APP-ERROR:render-process-gone; event: ${JSON.stringify(event)}; webContents:${JSON.stringify(
webContents
)}; details:${JSON.stringify(details)}`
)
})
// 子进程结束
app.on('child-process-gone', async (event, details) => {
console.error(`APP-ERROR:child-process-gone; event: ${JSON.stringify(event)}; details:${JSON.stringify(details)}`)
})
}

52
src/main/logger.js Normal file
View File

@ -0,0 +1,52 @@
/**
* @description 日志配置
* @author zdg
* @date 2021-07-05 14:07:01
*/
// import log from 'electron-log'
import log from 'electron-log/main'
import { app } from 'electron'
import path from 'path'
// 关闭控制台打印
// 日志控制台等级默认值false
log.transports.console.level = false
// log.transports.console.level = 'info'
// 日志文件等级默认值false
log.transports.file.level = 'info'
// 日志文件名默认main.log
// log.transports.file.fileName = 'main.log';
// 日志大小默认10485761M达到最大上限后备份文件并重命名为main.old.log有且仅有一个备份文件
log.transports.file.maxSize = 10 * 1024 * 1024; // 文件最大不超过 10M
// 自定义日志文件滚动策略
log.transports.file.rollSize = 10 * 1024 * 1024; // 10MB
// 日志格式,默认:[{y}-{m}-{d} {h}:{i}:{s}.{ms}] [{level}]{scope} {text}
log.transports.file.format = '[{y}-{m}-{d} {h}:{i}:{s}.{ms}] [{level}]{scope} {text}'
let date = new Date()
let dateStr = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
// 文件位置及命名方式
// 默认位置为C:\Users\[user]\AppData\Roaming\[appname]\electron_log\
// 文件名为:年-月-日.log
// 自定义文件保存位置为安装目录下 \log\年-月-日.log
// log.transports.file.resolvePathFn = () => 'logs\\' + dateStr+ '.log';
log.transports.file.resolvePathFn = () => path.join(app.getPath('userData'), `logs/${dateStr}.log`)
// 有六个日志级别error, warn, info, verbose, debug, silly。默认是silly
export const logger = {
error: (...args) => log.error(...args),
warn: (...args) => log.warn(...args),
info: (...args) => log.info(...args),
verbose: (...args) => log.verbose(...args),
debug: (...args) => log.debug(...args),
silly: (...args) => log.silly(...args)
}
export function initialize(bool = true, type = 'all') {
log.initialize() // 为渲染器进行初始化
if (bool) { // 是否替换默认的console
if (type == 'all') Object.assign(console, log.functions)
else { // 替换指定类型
console[type] = log[type]
}
}
}
export default { initialize }

61
src/main/store.js Normal file
View File

@ -0,0 +1,61 @@
/**
* @description 解决 主进程|渲染进程 数据共享
*/
import Store from 'electron-store' // 持久化存储
// 设置ipc与渲染器通信
Store.initRenderer()
// 默认共享数据
const defaultData = {
session: { // 缓存(临时sessionStorage)
model: 'select', // 悬浮球-当前模式
showBoardAll: false, // 全屏画板-是否显示
isPdfWin: false, // pdf窗口是否打开
isToolWin: false, // 工具窗口是否打开
curSubjectNode: {
data: {}, // 当前教材节点 (包含当前教材 单元)
querySearch: {} // 查询资源所需参数
}
},
local: { // 本地(永久localStorage)
},
}
// 初始化
export function initialize(){
// 缓存数据-sessionStore
const sessionStore = new Store({
name: 'session-store', // 存储文件名
fileExtension: 'ini', // 文件后缀名
encryptionKey: 'BvPLmgCC4DSIG0KkTec5', // 数据加密-防止用户直接改配置
beforeEachMigration: (store, context) => { // 版本迁移回调
console.log(`[session-store] 迁移从 ${context.fromVersion}${context.toVersion}`);
},
migrations: { // 版本变化
'0.0.0': store => {
// store.set('debugPhase', true);
}
}
})
sessionStore.clear() // 先清除-所有缓存数据
sessionStore.set(defaultData.session) // 初始化-默认数据
// 缓存数据-localStore
const localStore = new Store({
name: 'local-store', // 存储文件名
fileExtension: 'ini', // 文件后缀名
encryptionKey: '6CyoHQmUaPmLzvVsh', // 数据加密-防止用户直接改配置
beforeEachMigration: (store, context) => { // 版本迁移回调
console.log(`[local-store] 迁移从 ${context.fromVersion}${context.toVersion}`);
},
migrations: { // 版本变化
'0.0.0': store => {
// store.set('debugPhase', true);
}
}
})
localStore.set(defaultData.local) // 初始化-默认数据
return {sessionStore, localStore}
}
export default { initialize }

View File

@ -1,10 +1,10 @@
import { contextBridge } from 'electron'
import { electronAPI } from '@electron-toolkit/preload'
// import TimRender from 'im_electron_sdk/dist/renderer' // im渲染部分实例
import TimRender from 'im_electron_sdk/dist/renderer' // im渲染部分实例
// Custom APIs for renderer
const api = {
preloadPath: __dirname, // 当前preload地址
// getTimRender: () => new TimRender(), // im渲染部分实例
getTimRender: () => new TimRender(), // im渲染部分实例
}
// Use `contextBridge` APIs to expose Electron APIs to
// renderer only if context isolation is enabled, otherwise

View File

@ -2,13 +2,13 @@
<html>
<head>
<meta charset="UTF-8" />
<title>AIx智慧教育</title>
<title>%VITE_APP_TITLE%</title>
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<!-- <meta
http-equiv="Content-Security-Policy"
content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:"
/> -->
<meta http-equiv="Content-Security-Policy" content="connect-src *; default-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src * 'self' data: blob:" />
<meta http-equiv="Content-Security-Policy" content="connect-src *; default-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *;img-src * 'self' data: blob:" />
</head>

View File

@ -13,9 +13,11 @@ export class ApiService {
if (!!data) config[method=='get'?'params':'data'] = data
if (!!option) Object.assign(config, option)
// 特殊格式处理
if (type == 'file') config.headers = { 'Content-Type': 'multipart/form-data' }
else if (type == 'json') config.headers = { 'Content-Type': 'application/json' }
else if (type == 'form') config.headers = { 'Content-Type': 'application/x-www-form-urlencoded' }
let headers
if (type == 'file') headers = { 'Content-Type': 'multipart/form-data' }
else if (type == 'json') headers = { 'Content-Type': 'application/json' }
else if (type == 'form') headers = { 'Content-Type': 'application/x-www-form-urlencoded' }
headers && (config.headers = { ...config.headers, ...headers })
return request(config)
}
}

View File

@ -50,7 +50,7 @@ export function getClassmain(id) {
// 获取小组列表
export function listClassgroup(query) {
return request({
url: '/education/classgroup/list',
url: '/education/classgroup/new/list',
method: 'get',
params: query
})
@ -160,10 +160,12 @@ export function deleteSmartReserv(id) {
})
}
export function startClass(id, ex3) {
const params = {id}
!!ex3 && (params.ex3 = ex3)
return request({
url: '/smarttalk/classReserv/startClass',
method: 'get',
params: {id, ex3}
params
})
}
export function endClass(id) {

View File

@ -0,0 +1,64 @@
//查询第三方课件的接口
import request from '@/utils/request'
//获取学科
export const getSubjects = (params) => {
return request({
url: '/smarttalk/cnjy/getSubjects',
method: 'get',
params
})
}
//获取教材版本
export const getTextbookVersion = (params) => {
return request({
url: '/smarttalk/cnjy/getVersions',
method: 'get',
params
})
}
//获得书籍
export const getTextbook = (params) => {
return request({
url: '/smarttalk/cnjy/getBooks',
method: 'get',
params
})
}
//获取书籍章节
export const getBook = (params) => {
return request({
url: '/smarttalk/cnjy/getChapters',
method: 'get',
params
})
}
//获取知识点信息
export const getKnowledge = (params) => {
return request({
url: '/smarttalk/cnjy/getKnowledgePoints',
method: 'get',
params
})
}
//查询列表资源
export const getBookList = (params) => {
return request({
url: '/smarttalk/cnjy/getDocuments',
method: 'post',
params
})
}
//获取图片路径
export const getImgPath = (params) => {
return request({
url: '/smarttalk/cnjy/getPreview',
method: 'get',
params
})
}

View File

@ -1,9 +1,9 @@
@font-face {
font-family: "iconfont"; /* Project id 2794390 */
src: url('iconfont.woff2?t=1723453634574') format('woff2'),
url('iconfont.woff?t=1723453634574') format('woff'),
url('iconfont.ttf?t=1723453634574') format('truetype'),
url('iconfont.svg?t=1723453634574#iconfont') format('svg');
src: url('iconfont.woff2?t=1724212790213') format('woff2'),
url('iconfont.woff?t=1724212790213') format('woff'),
url('iconfont.ttf?t=1724212790213') format('truetype'),
url('iconfont.svg?t=1724212790213#iconfont') format('svg');
}
.iconfont {
@ -14,6 +14,90 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-yiwen:before {
content: "\e687";
}
.icon-yiwen-01:before {
content: "\e688";
}
.icon-yihuo:before {
content: "\e689";
}
.icon-a-yiwen:before {
content: "\e6b1";
}
.icon-zan:before {
content: "\e658";
}
.icon-zan1:before {
content: "\e659";
}
.icon-zan2:before {
content: "\e65a";
}
.icon-zan3:before {
content: "\e65c";
}
.icon-zan4:before {
content: "\e67c";
}
.icon-yizan:before {
content: "\e67e";
}
.icon-zan5:before {
content: "\e67f";
}
.icon-zan-yizan:before {
content: "\e680";
}
.icon-zan6:before {
content: "\e681";
}
.icon-MBEfenggeduosetubiao-xihuan:before {
content: "\e682";
}
.icon-zan7:before {
content: "\e683";
}
.icon-zan11:before {
content: "\e6ff";
}
.icon-zan8:before {
content: "\e684";
}
.icon-dianzan-red:before {
content: "\e685";
}
.icon-zan9:before {
content: "\e69e";
}
.icon-zanping:before {
content: "\100ae";
}
.icon-zan10:before {
content: "\e686";
}
.icon-arrangement:before {
content: "\e656";
}

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,153 @@
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "20574719",
"name": "疑问",
"font_class": "yiwen",
"unicode": "e687",
"unicode_decimal": 59015
},
{
"icon_id": "21052326",
"name": "yiwen-01",
"font_class": "yiwen-01",
"unicode": "e688",
"unicode_decimal": 59016
},
{
"icon_id": "30456317",
"name": "疑惑",
"font_class": "yihuo",
"unicode": "e689",
"unicode_decimal": 59017
},
{
"icon_id": "33439935",
"name": "[疑问]",
"font_class": "a-yiwen",
"unicode": "e6b1",
"unicode_decimal": 59057
},
{
"icon_id": "1242129",
"name": "赞",
"font_class": "zan",
"unicode": "e658",
"unicode_decimal": 58968
},
{
"icon_id": "1741390",
"name": "赞",
"font_class": "zan1",
"unicode": "e659",
"unicode_decimal": 58969
},
{
"icon_id": "3159200",
"name": "赞",
"font_class": "zan2",
"unicode": "e65a",
"unicode_decimal": 58970
},
{
"icon_id": "3402139",
"name": "赞",
"font_class": "zan3",
"unicode": "e65c",
"unicode_decimal": 58972
},
{
"icon_id": "4931286",
"name": "赞 (1)",
"font_class": "zan4",
"unicode": "e67c",
"unicode_decimal": 59004
},
{
"icon_id": "4942300",
"name": "已赞",
"font_class": "yizan",
"unicode": "e67e",
"unicode_decimal": 59006
},
{
"icon_id": "5806181",
"name": "赞",
"font_class": "zan5",
"unicode": "e67f",
"unicode_decimal": 59007
},
{
"icon_id": "7172310",
"name": "赞-已赞",
"font_class": "zan-yizan",
"unicode": "e680",
"unicode_decimal": 59008
},
{
"icon_id": "7293361",
"name": "赞2",
"font_class": "zan6",
"unicode": "e681",
"unicode_decimal": 59009
},
{
"icon_id": "8705087",
"name": "MBE风格多色图标-喜欢",
"font_class": "MBEfenggeduosetubiao-xihuan",
"unicode": "e682",
"unicode_decimal": 59010
},
{
"icon_id": "10024138",
"name": "赞",
"font_class": "zan7",
"unicode": "e683",
"unicode_decimal": 59011
},
{
"icon_id": "11055391",
"name": "赞",
"font_class": "zan11",
"unicode": "e6ff",
"unicode_decimal": 59135
},
{
"icon_id": "11086734",
"name": "赞",
"font_class": "zan8",
"unicode": "e684",
"unicode_decimal": 59012
},
{
"icon_id": "23592614",
"name": "点赞",
"font_class": "dianzan-red",
"unicode": "e685",
"unicode_decimal": 59013
},
{
"icon_id": "26327261",
"name": "赞",
"font_class": "zan9",
"unicode": "e69e",
"unicode_decimal": 59038
},
{
"icon_id": "27804883",
"name": "赞评",
"font_class": "zanping",
"unicode": "100ae",
"unicode_decimal": 65710
},
{
"icon_id": "29252894",
"name": "赞",
"font_class": "zan10",
"unicode": "e686",
"unicode_decimal": 59014
},
{
"icon_id": "4978988",
"name": "作业-布置作业",

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 264 KiB

After

Width:  |  Height:  |  Size: 337 KiB

View File

@ -75,8 +75,7 @@ const curBookImg = ref('')
const curBookPath = ref('')
//
const volumeOne = ref([])
//
const volumeTwo = ref([])
//
const currentNode = reactive({
data:{}
@ -111,9 +110,11 @@ const getSubjectContent = async () => {
//
await getSubject()
//
volumeOne.value = data.filter(item => item.level == 1 && item.semester == '上册')
//
volumeTwo.value = data.filter(item => item.level == 1 && item.semester == '下册')
/**
* 不区分上下册
* 2024/08/20调整
*/
volumeOne.value = data.filter(item => item.level == 1)
getTreeData()
}
@ -132,12 +133,8 @@ const changeBook = ({ id, itemtitle, avartar, fileurl }) => {
const getTreeData = () => {
//
let upData = transData(volumeOne.value)
let downData = transData(volumeTwo.value)
if(upData.length && downData.length){
treeData.value = [...upData,...downData]
}
else if(upData.length || downData.length){
treeData.value = upData.length ? upData : downData
if(upData.length){
treeData.value = [...upData]
}
else{
treeData.value = []

View File

@ -0,0 +1,291 @@
<template>
<div class="book-wrap">
<el-scrollbar height="100%">
<div class="book-name">
<el-dropdown style="width: 100%;height: 100%">
<div class="el-dropdown-link flex" style="width: 100%;height: 100%;justify-content: space-between;align-items: center">
<span>{{titleName}}</span>
<!-- <i class="iconfont icon-xiangyou"></i>-->
</div>
<!-- 学科学段选择-->
<template #dropdown>
<div style="width: 300px;padding: 20px">
<ThirdIndex @getVertion="getVertion"></ThirdIndex>
</div>
</template>
</el-dropdown>
</div>
<div class="book-list" v-loading="treeLoading">
<el-tree ref="refTree" :data="treeData" :props="defaultProps" node-key="id"
:default-expanded-keys="defaultExpandedKeys" :current-node-key="node.currentNodeId" highlight-current
@node-click="handleNodeClick">
</el-tree>
</div>
</el-scrollbar>
</div>
</template>
<script setup>
import ThirdIndex from './third/index.vue'
import {nextTick, reactive, ref,onMounted,watch} from 'vue'
import {getBook, getTextbook} from '@/api/file/third'
import useThirdStore from '@/store/modules/thirdTextbook'
import useUserStore from '@/store/modules/user'
const useThird = useThirdStore()
const useStore = useUserStore()
const emit = defineEmits(['nodeClick'])
const titleName = ref('')
//
const treeData = ref([])
//
const defaultExpandedKeys = ref([])
const treeLoading = ref(false)
const node = reactive({
//
currentNode:{
data:{}
},
// ID
currentNodeId:0,
//
currentNodeName:''
})
//bookid
const bookId = ref(0)
//
const getVertion = (data) => {
const arr = [...data]
treeData.value = arr.map(item => {
return {
level:0,
id: item.versionId,
name: item.versionName,
childs: []
}
})
nextTick(() => {
defaultExpandedKeys.value = [treeData.value[0].id]
node.currentNode.data = treeData.value[0]
node.currentNodeId = treeData.value[0].id
node.currentNodeName = treeData.value[0].name
treeLoading.value = false
})
}
//
const getCurrent = (data) => {
if(!data || data.length == 0) return
nextTick(() => {
defaultExpandedKeys.value = [data[0].id]
node.currentNode.data = data[0]
node.currentNodeId = data[0].id
node.currentNodeName = data[0].name
})
}
//
const textbook = async (item) => {
treeLoading.value = true
const res = await getTextbook({versionId:item.id})
if(res.code === 200){
item.childs = res.data.map(items => {
return {
level:1,
id: items.bookId,
name: items.bookName,
childs: []
}
})
getCurrent(item.childs)
treeLoading.value = false
}
}
//
const grade = async (item) => {
treeLoading.value = true
bookId.value = item.id
const res = await getBook({bookId:item.id})
if(res.code === 200){
item.childs = res.data.map(items => {
return {
...items,
}
})
getLastLevelData(item.childs)
getCurrent(item.childs)
treeLoading.value = false
}
}
const getLastLevelData = (tree) => {
let lastLevelData = [];
//
function traverseTree(nodes) {
nodes.forEach((node) => {
//
if (node.childs && node.childs.length > 0) {
traverseTree(node.childs);
} else {
//
lastLevelData.push(node);
}
});
}
//
traverseTree(tree);
//
return lastLevelData;
}
//
const handleNodeClick = (data,node) => {
/**
* data : 当前节点数据
* node : 当前节点对象 包含当前节点所有数据 parent属性 指向父节点Node对象
*/
switch(node.data.level){
case 0: textbook(data); break;
case 1: grade(data); break;
default: {
getCurrent(data.childs);
//
emit('nodeClick',{
chapterId:data.id,
bookId:bookId.value,
stage:data.stage,
subjectId:data.subjectId,
})
break;
}
}
}
//
onMounted(() => {
titleName.value = `${useStore.user.edustage}-${useStore.user.edusubject}`
treeLoading.value = true
//loading
setTimeout(() => {
treeLoading.value = false
},2000)
})
//
watch(() => useThird,() => {
titleName.value = `${useStore.user.edustage}-${useStore.user.edusubject}`
},{deep:true})
const defaultProps = {
children: 'childs',
label: 'name',
class: 'textbook-tree'
}
</script>
<style lang="scss" scoped>
.book-wrap {
width: 300px;
height: 100%;
background: #ffffff;
border-radius: 10px;
box-shadow: 0px 0px 20px 0px rgba(99, 99, 99, 0.06);
display: flex;
flex-direction: column;
position: relative;
.book-name {
background-color: #ffffff;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 45px;
padding: 0 15px;
z-index: 1;
justify-content: space-between;
align-items: center;
color: #3b3b3b;
cursor: pointer;
border-bottom: solid #f4f5f7 1px;
font-size: 15px;
font-weight: 600;
border-radius: 10px 10px 0 0;
}
.book-list {
padding: 45px 10px 0 10px;
flex: 1;
}
}
:deep(.choose-dialog) {
border-radius: 10px;
}
.choose-book-header {
justify-content: space-between;
font-size: 15px;
font-weight: bold;
.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;
font-size: 13px;
}
&:hover {
background: #f4f7f9;
}
}
.active-item {
background-color: #f4f7f9;
.book-name {
color: #368fff;
font-weight: bold
}
}
.textbook-img {
width: 55px;
height: 70px;
display: flex;
align-items: center;
justify-content: center;
}
}
:deep(.el-tree-node) {
.el-tree-node__content {
height: 40px;
border-radius: 10px;
&:hover {
background-color: #eaf3ff;
}
}
}
.tree-label {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
:deep(.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content) {
background-color: #eaf3ff !important;
color: #409EFF
}
</style>

View File

@ -0,0 +1,73 @@
<template>
<el-tabs v-model="active" class="demo-tabs" @tab-change="handleClick">
<template v-for="(item,index) in gradeList" :key="index">
<el-tab-pane :label="item.label" :name="item.value" disabled>
<SelectSubject ref="selectSubject" :subjectList="subjectList" @clickTag="getTagId"></SelectSubject>
</el-tab-pane>
</template>
</el-tabs>
</template>
<script setup>
import {ref,onMounted} from 'vue'
import { gradeList } from '@/utils/resourceDict'
import SelectSubject from './selectSubject.vue'
import {getSubjects,getTextbookVersion} from '@/api/file/third'
import useThirdStore from '@/store/modules/thirdTextbook'
import useUserStore from '@/store/modules/user'
const useThird = useThirdStore()
const useStore = useUserStore()
const emit = defineEmits(['getVertion'])
const active = ref(1)
//
const subjectList = ref([])
//id
const textbookVersionId = ref(0)
//
const handleClick = (tab) => {
console.log(tab,'tab')
getSubject(tab)
}
//
const getSubject = (value) => {
const currentIndex = gradeList.findIndex(item => item.value === value)
getSubjects({stage:value}).then(res => {
if(res.code === 200){
if(res.data.length === 0) return
subjectList.value = res.data.map(item => {
return {
...item,
gradeName:gradeList[currentIndex].label
}
})
const nameIndex = subjectList.value.findIndex(item => item.subjectName === useStore.user.edusubject)
getTagId({subjectId:subjectList.value[nameIndex].subjectId,subjectName:subjectList.value[nameIndex].subjectName})
if(textbookVersionId.value === 0){
getTagId(subjectList.value[0])
}
}
})
}
//
const getTagId = (item) => {
textbookVersionId.value = item.subjectId
const currentIndex = gradeList.findIndex(item => item.value === active.value)
getTextbookVersion({stage:active.value,subjectId:textbookVersionId.value}).then(res => {
if(res.code === 200){
emit('getVertion',res.data)
useThird.getSelectBookInfo({...item,activeGrade:active.value,gradeName:gradeList[currentIndex].label})
}
})
}
onMounted(() => {
const currentIndex = gradeList.findIndex(item => item.label === useStore.user.edustage)
//
getSubject(gradeList[currentIndex].value)
active.value = gradeList[currentIndex].value
})
</script>
<style scoped>
</style>

View File

@ -0,0 +1,35 @@
<template>
<template v-for="item in subjectList" :key="item.subjectId">
<el-tag
:type="useStore.user.edusubject === item.subjectName && useStore.user.edustage === item.gradeName ? 'primary' : 'info'"
effect="dark"
round
class="tagItem"
:style="useStore.user.edusubject === item.subjectName && useStore.user.edustage === item.gradeName ? {'cursor': 'pointer'} : {'cursor': 'no-Drop'}"
>
{{ item.subjectName }}
</el-tag>
</template>
</template>
<script setup name="selectSubject">
import useUserStore from "@/store/modules/user";
const useStore = useUserStore()
const props = defineProps({
subjectList: {
type: Array,
default: () => []
}
})
const emit = defineEmits(['clickTag'])
// const clickTag = (item) => {
// emit('clickTag',item)
// }
</script>
<style scoped>
.tagItem{
margin-right: 5px;
margin-top: 5px;
}
</style>

View File

@ -0,0 +1,124 @@
<template>
<el-drawer v-model="model" class="preview-drawer" title="title" :modal="false" :with-header="false" append-to-body
size="50%">
<div class="flex drawer-header">
<div>
<div class="flex file-name">
<FileImage :size="30" :file-name="'row.fileName'" />
<span class="name">{{ row.fileShowName }}</span>
</div>
<div class="flex file-tag">
<el-tag type="info" class="tag">{{ row.fileSuffix }}</el-tag>
<el-tag type="info" class="tag">{{ row.fileFlag }}</el-tag>
</div>
</div>
<div class="header-close" @click="onClose"><i class="iconfont icon-guanbi"></i></div>
</div>
<div class="drawer-content">
<!-- <iframe src="./aaa.pdf" width="600px" height="600px"></iframe> -->
<!-- <div ref="playerRef" class="video-box"></div> -->
<!-- <video src="" controls autoplay></video> -->
<el-image style="width: 100%;" src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg" />
</div>
</el-drawer>
</template>
<script setup>
import { watch, ref, nextTick } from 'vue'
import Player from 'xgplayer'
import 'xgplayer/dist/index.min.css'
import FileImage from '@/components/file-image/index.vue'
const model = defineModel()
const props = defineProps({
row: {
type: Object,
default(){
return {}
}
},
})
const playerRef = ref();
const handleClose = () => {
}
//
const onClose = () => {
model.value = false
}
const init = () => {
nextTick(() => {
//
let player = new Player({
el: playerRef.value,
url: '//sf1-cdn-tos.huoshanstatic.com/obj/media-fe/xgplayer_doc_video/mp4/xgplayer-demo-360p.mp4',
width: '100%',
autoplay: false,// false
videoAttributes: {// video
crossOrigin: 'anonymous',// CORS
},
cssFullscreen: false,
loop:true,// false
commonStyle:{
progressColor: '#cccccce6',//
},
});
})
}
watch(model, (newVal) => {
if (newVal) {
// init()
}
})
</script>
<style lang="scss" scoped>
:deep(.el-drawer__body) {
padding: 0;
}
.preview-drawer {
padding: 0;
}
.drawer-header {
justify-content: space-between;
align-items: center;
background-color: #fff;
.file-name {
align-items: center;
margin-bottom: 5px;
.name {
margin-left: 5px;
}
}
.file-tag {
.tag {
margin-right: 10px;
}
}
.header-close {
cursor: pointer;
.icon-guanbi {
font-size: 20px;
}
}
}
.drawer-content {
margin-top: 10px;
}
.video-box {
width: 100%;
height: 300px
}
</style>

View File

@ -88,8 +88,6 @@ const curBookId = ref(-1)
const curBookName = ref('')
//
const volumeOne = ref([])
//
const volumeTwo = ref([])
//
const currentNode = reactive({
data: {}
@ -127,9 +125,12 @@ const getSubjectContent = async () => {
//
getSubject()
//
volumeOne.value = data.filter(item => item.level == 1 && item.semester == '上册')
//
volumeTwo.value = data.filter(item => item.level == 1 && item.semester == '下册')
/**
* 不区分上下册
* 2024/08/20调整
*/
volumeOne.value = data.filter(item => item.level == 1)
getTreeData()
}
@ -160,13 +161,8 @@ const isHaveUnit = (id) => {
const getTreeData = () => {
//
let upData = transData(volumeOne.value)
let downData = transData(volumeTwo.value)
if(upData.length && downData.length){
treeData.value = [...upData,...downData]
}
else if(upData.length || downData.length){
treeData.value = upData.length ? upData : downData
if(upData.length){
treeData.value = [...upData]
}
else{
treeData.value = []

View File

@ -100,12 +100,17 @@ const renderPage = async (canvasobj) => {
})
}
//
const savaDataStore = () => {
const savaDataStore = (type) => {
if(!toolState.isToolWin){
toolState.isPdfWin=false
toolState.showBoardAll=true //
if(type=='rest'){
ipcRenderer.invoke('tool-sphere:reset') //tool
ipcRenderer.send('open-PDF:minimize')
ipcRenderer.send('open-PDF:close')
}else{
ipcRenderer.invoke('open-PDF:minimize')
}
return
}
imgarr.value.forEach((a) => {
@ -139,8 +144,15 @@ const savaDataStore = () => {
Promise.all(promises).then(res=>{
toolState.isPdfWin=false
toolState.showBoardAll=true //
// ipcRenderer.send('open-PDF:minimize')
if(type=='rest'){
ipcRenderer.invoke('tool-sphere:reset') //tool
ipcRenderer.send('open-PDF:close')
}else{
ipcRenderer.send('open-PDF:minimize')
}
// ipcRenderer.send('open-PDF:close')
})
}
const updatePage = (canvasobj) => {
@ -371,16 +383,7 @@ defineExpose({
savaDataStore
})
watchEffect(() => {
setTimeout(() => {
console.log(toolState,'监听')
}, 300)
if(toolState.isPdfWin){
// if(toolState.isToolWin){
// ispointer.value=false
// }else{
// ispointer.value=true
// }
watchToolState() //
}
})

View File

@ -0,0 +1,323 @@
<template>
<el-dialog v-model="model" center top="10vh" width="600px" :show-close="false" destroy-on-close append-to-body
style="border-radius: 10px; padding: 10px 15px">
<template #header>
<div class="homerwork-header flex">
<span>{{ title }}</span>
<i class="iconfont icon-guanbi" @click="cloneDialog(ruleFormRef)"></i>
</div>
</template>
<div v-loading="setLoading">
<el-form :model="form" label-width="80px" ref="ruleFormRef" :rules="rules">
<el-form-item label="班级" prop="grade">
<el-scrollbar max-height="200px" style="width: 100%">
<el-tree :props="defaultProps" :load="getLoad" node-key="id" highlight-current @check="handleCheckChange"
lazy show-checkbox />
</el-scrollbar>
</el-form-item>
<el-form-item label="选中学生" prop="student">
<el-scrollbar max-height="200px">
<el-tag v-for="(tag, index) in studentList" :key="tag.studentid" closable type="primary"
@close="delStudent(index)">
{{ tag.name }}
</el-tag>
</el-scrollbar>
</el-form-item>
<el-form-item label="完成要求" prop="feedback">
<el-radio-group v-model="form.feedback">
<el-radio value="必做" size="large">必做</el-radio>
<el-radio value="选做" size="large">选做</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="截止时间" prop="deaddate">
<el-date-picker v-model="form.deaddate" value-format="YYYY-MM-DD HH:mm" format="YYYY-MM-DD HH:mm"
time-format="HH:mm" type="datetime" :clearable="false" placeholder="请选择截止时间" />
</el-form-item>
<el-form-item label="推荐用时" prop="timelength">
<el-input-number v-model="form.timelength" :min="1" :max="500" />
</el-form-item>
</el-form>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click.stop="cloneDialog(ruleFormRef)">取消</el-button>
<el-button type="primary" @click.stop="onSubmit(ruleFormRef)"> 确定 </el-button>
</div>
</template>
</el-dialog>
</template>
<script setup>
import { onMounted, reactive, ref } from 'vue'
import { ElMessage } from 'element-plus'
import { listClassmain, listClassgroup } from '@/api/classManage/index'
import { saveByClassWorkArray } from '@/api/teaching/classwork'
import useUserStore from '@/store/modules/user'
import { uniqBy, groupBy } from 'lodash'
const model = defineModel({ type: Boolean, default: false })
const props = defineProps({
entpcourseid: {
default: ''
},
row: {
default: ''
},
title: {
type: String,
default: '布置作业'
}
})
const emit = defineEmits(['on-close', 'on-success'])
const ruleFormRef = ref('')
//
const defaultProps = {
children: 'children',
label: 'label',
isLeaf: 'leaf'
}
// loading
const setLoading = ref(false)
//
const userInfo = useUserStore().user
//
const gradeList = ref([])
//
const studentList = ref([])
//
const form = reactive({
feedback: '必做',
deaddate: '',
timelength: 1
})
//
const validateGrade = (rule, value, callback) => {
if (studentList.value.length == 0) {
callback(new Error('请勾选班级或者学生'))
} else {
callback()
}
}
const validateStudent = (rule, value, callback) => {
if (studentList.value.length == 0) {
callback(new Error('学生不能为空'))
} else {
callback()
}
}
const rules = reactive({
grade: [{ validator: validateGrade, trigger: 'blur' }],
student: [{ validator: validateStudent, trigger: 'blur' }]
})
//
const getGradeList = async () => {
let { rows } = await listClassmain({
classuserid: userInfo.userId,
pageSize: 100,
status: 'open'
})
rows.forEach((item) => {
item.label = item.caption
item.level = 0
item.leaf = false
item.children = []
item.classstudentlist = JSON.parse('[' + item.classstudentlist + ']')
item.classstudentlist.forEach((el) => {
el.classId = item.id
})
})
return rows
}
//
const getLoad = async (node, resolve) => {
//
if (node.level == 0) {
gradeList.value = await getGradeList()
resolve(gradeList.value)
}
//
if (node.level == 1) {
listClassgroup({ classid: node.key, orderby: 'orderidx', pageSize: 100 }).then((res) => {
if (res.rows.length > 0) {
let ary = []
res.rows.forEach((item) => {
if (item.parentid === 0) {
//studentGroup
let studentGroup = JSON.parse('[' + item.studentlist + ']')
studentGroup.forEach((el) => {
el.label = el.name
el.leaf = true
el.level = 2
el.id = el.studentid
el.classId = item.classid
})
ary.push({
label: item.groupname,
leaf: false,
...item,
level: 1,
// children
children: studentGroup
})
}
})
resolve(ary)
} else {
//
let students = node.data.classstudentlist
students.forEach((item) => {
item.label = item.name
item.level = 2
item.leaf = true
})
resolve(students)
}
})
}
//
if (node.level == 2) {
resolve(node.data.children)
}
}
//
const handleCheckChange = (data, checked) => {
studentList.value = []
//
let checkNodes = checked.checkedNodes
let ary = []
checkNodes.forEach((item) => {
//
if (item.level == 0) {
ary = [...ary, ...item.classstudentlist]
}
//
if (item.level == 1) {
ary = [...ary, ...item.children]
}
//
if (item.level == 2) {
ary = [...ary, item]
}
})
studentList.value = uniqBy(ary, 'studentid')
}
//
const delStudent = (index) => {
studentList.value.splice(index, 1)
}
const onSubmit = (formEl) => {
if (!formEl) return
formEl.validate((valid) => {
if (valid) {
/**
* 根据学生列表中的classId分班
* studentList 为选中的所有学生 这些学生可能来自不同班级
*/
let gradeObj = groupBy(studentList.value, 'classId')
//
let ary = []
for (const value in gradeObj) {
// AIx web
let obj = {
id: 0,
parentid: props.row.id,
classid: value,
classcourseid: 0,
entpcourseid: props.entpcourseid,
studentlist: JSON.stringify(gradeObj[value]),
feedback: form.feedback,
workkey: '',
timelength: form.timelength,
weights: 1,
deaddate: form.deaddate,
workdate: getCurrentDate(),
uniquekey: props.row.uniquekey,
entpcourseworklist: '[' + props.row.entpcourseworklist + ']',
needMsgNotifine: 'false',
msgkey: 'newclasswork',
title: '作业任务',
msgcontent: '',
teachername: userInfo.nickName,
unixstamp: new Date().getTime(),
worktype: props.row.worktype
}
ary.push(obj)
}
setLoading.value = true
saveByClassWorkArray({
classworkarray: JSON.stringify(ary)
})
.then((res) => {
setLoading.value = false
ElMessage.success('操作成功')
emit('on-success', res.data)
cloneDialog(formEl)
})
.catch(() => {
setLoading.value = false
})
} else {
return false
}
})
}
const expandedKeys = ref([])
const checkedKeys = ref([])
//
const cloneDialog = (formEl) => {
studentList.value = []
checkedKeys.value = []
expandedKeys.value = []
formEl.resetFields()
model.value = false
}
//
const getCurrentDate = () => {
const now = new Date()
const year = now.getFullYear()
let month = now.getMonth() + 1 // 0+1
let day = now.getDate()
if (month < 10) {
month = '0' + month
}
if (day < 10) {
day = '0' + day
}
return `${year}-${month}-${day}`
}
onMounted(() => {
//
form.deaddate = getCurrentDate() + ' ' + '10:00:00'
})
</script>
<style lang="scss" scoped>
.homerwork-header {
justify-content: space-between;
font-size: 15px;
font-weight: bold;
.icon-guanbi {
font-size: 20px;
cursor: pointer;
}
}
.el-tag {
margin-right: 10px;
margin-bottom: 10px;
}
.dialog-footer {
padding-bottom: 10px;
}
:deep(.el-checkbox) {
transform: scale(1.3);
}
</style>

View File

@ -10,7 +10,7 @@
class="flex"
:style="{'color' : item.color}"
:class="currentRoute === item.url ? 'active-li' : ''"
@click="handleOutLink(item.url,item.type)"
@click="handleOutLink(item.url,item.type, item.name)"
>
<i :class="item.img"></i>
<span class="text">{{ item.name }}</span>
@ -57,6 +57,7 @@ import WindowTools from '@/components/window-tools/index.vue'
import useUserStore from '@/store/modules/user'
import routerStore from '@/store/modules/route'
import outLink from '@/utils/linkConfig'
const routeHeader = routerStore()
const { ipcRenderer } = window.electron || {}
const userStore = useUserStore()
@ -64,7 +65,7 @@ const router = useRouter()
const currentRoute = ref('')
const dev_api = ref(import.meta.env.VITE_APP_BASE_API)
const handleOutLink = (path, type) => {
const handleOutLink = (path, type, name) => {
if (!path) return
if (type === 'hash') {
router.push(path)
@ -73,6 +74,11 @@ const handleOutLink = (path, type) => {
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}`
}
//
ipcRenderer.send('openWindow', {
key: path,

View File

@ -12,10 +12,14 @@ import 'virtual:windi.css'
import { store } from '@/store'
import App from './App.vue'
import router from './router'
import log from 'electron-log/renderer' // 渲染进程日志-文件记录
if(process.env.NODE_ENV != 'development') { // 非开发环境,将日志打印到日志文件
Object.assign(console, log.functions) // 渲染进程日志-控制台替换
}
const app = createApp(App)
app.use(router)
.use(store)
.use(ElementPlus, { locale: zhLocale }).mount('#app')

View File

@ -382,12 +382,12 @@ const TIMResult= {
* | 名称 | 含义 | number |
* | ---- | ---- | ---- |
* | kTIMLog_Off | 关闭日志输出 | 0 |
* | kTIMLog_Test | 失败IM SDK未初始化 | 1 |
* | kTIMLog_Verbose | 失败IM SDK未初始化 | 2 |
* | kTIMLog_Debug | 接口调用失败错误的Json格式或Json Key | 3 |
* | kTIMLog_Info | 接口调用失败参数错误 | 4 |
* | kTIMLog_Warn | 接口调用失败无效的会话 | 5 |
* | kTIMLog_Error | 接口调用失败无效的群组 | 6 |
* | kTIMLog_Test | 全量日志 | 1 |
* | kTIMLog_Verbose| 开发调试过程中一些详细信息日志 | 2 |
* | kTIMLog_Debug | 调试日志 | 3 |
* | kTIMLog_Info | 信息日志 | 4 |
* | kTIMLog_Warn | 警告日志 | 5 |
* | kTIMLog_Error | 错误日志 | 6 |
* | kTIMLog_Assert | 断言日志 | 7 |
*/
const TIMLogLevel= {

View File

@ -0,0 +1,420 @@
/**
* @description im 事件监听
* @author zdg
* @date 2023-07-07
*/
// @ts-ignore
const API = window?.api || {}
const timRenderInstance = API?.getTimRender?.() || {}
// im 事件监听
export class IMListeners {
// 初始化监听
static initListeners(callback) {
/**
* 注销消息监听事件
*/
timRenderInstance.TIMRemoveRecvNewMsgCallback()
/**
* @brief 增加接收新消息回调
* @param cb 新消息回调函数请参考[TIMRecvNewMsgCallback](TIMCloudCallback.h)
* @param user_data 用户自定义数据ImSDK只负责传回给回调函数cb不做任何处理
*
* @note
* 如果用户是登录状态ImSDK收到新消息会通过此接口设置的回调抛出另外需要注意抛出的消息不一定是未读的消息
* 只是本地曾经没有过的消息例如在另外一个终端已读拉取最近联系人消息时可以获取会话最后一条消息如果本地没有会通过此方法抛出
* 在用户登录之后ImSDK会拉取离线消息为了不漏掉消息通知需要在登录之前注册新消息通知
*/
timRenderInstance.TIMAddRecvNewMsgCallback({
callback:(args)=>{
callback({
type: 'TIMAddRecvNewMsgCallback',
data: JSON.parse(args[0])
})
},
user_data: "test"
})
/**
* @brief 1.3 设置消息已读回执回调
* @param cb 消息已读回执回调请参考[TIMMsgReadedReceiptCallback](TIMCloudCallback.h)
* @param user_data 用户自定义数据ImSDK只负责传回给回调函数cb不做任何处理
*
* @note
* 发送方发送消息接收方调用接口[TIMMsgReportReaded]()上报该消息已读发送方ImSDK会通过此接口设置的回调抛出
*/
timRenderInstance.TIMSetMsgReadedReceiptCallback({
callback:(args)=>{
callback({
type: 'TIMSetMsgReadedReceiptCallback',
data: JSON.parse(args[0])
})
},
user_data: "test"
})
/**
* @brief 1.4 设置接收的消息被撤回回调
* @param cb 消息撤回通知回调,请参考[TIMMsgRevokeCallback](TIMCloudCallback.h)
* @param user_data 用户自定义数据ImSDK只负责传回给回调函数cb不做任何处理
*
* @note
* 发送方发送消息接收方收到消息此时发送方调用接口[TIMMsgRevoke]()撤回该消息接收方的ImSDK会通过此接口设置的回调抛出
*/
timRenderInstance.TIMSetMsgRevokeCallback({
callback:(args)=>{
callback({
type: 'TIMSetMsgRevokeCallback',
data: JSON.parse(args[0])
});
},
user_data: "test"
})
/**
* @brief 1.5 设置消息内元素相关文件上传进度回调
* @param cb 文件上传进度回调请参考[TIMMsgElemUploadProgressCallback](TIMCloudCallback.h)
* @param user_data 用户自定义数据ImSDK只负责传回给回调函数cb不做任何处理
*
* @note
* 设置消息元素上传进度回调当消息内包含图片声音文件视频元素时ImSDK会上传这些文件并触发此接口设置的回调用户可以根据回调感知上传的进度
*/
timRenderInstance.TIMSetMsgElemUploadProgressCallback({
callback:(args)=>{
try{
const [message, index, cur_size, total_size, user_data] = JSON.parse(args)
callback({
type: 'TIMSetMsgElemUploadProgressCallback',
data: {
message: JSON.parse(message),
index,
cur_size,
total_size,
user_data
}
})
}catch(err){
throw err;
}
},
user_data: "test"
})
/**
* @brief 1.6 设置群组系统消息回调
* @param cb 群消息回调请参考[TIMGroupTipsEventCallback](TIMCloudCallback.h)
* @param user_data 用户自定义数据ImSDK只负责传回给回调函数cb不做任何处理
*
* @note
* 群组系统消息事件包括 加入群退出群踢出群设置管理员取消管理员群资料变更群成员资料变更此消息是针对所有群组成员下发的
*/
timRenderInstance.TIMSetGroupTipsEventCallback({
callback:(args)=>{
callback({
type: 'TIMSetGroupTipsEventCallback',
data: JSON.parse(args[0])
})
},
})
/**
* @brief 1.7 设置群组属性变更回调
* @param cb 群组属性变更回调请参考[TIMGroupAttributeChangedCallback](TIMCloudCallback.h)
* @param user_data 用户自定义数据ImSDK只负责传回给回调函数cb不做任何处理
*
* @note
* 某个已加入的群的属性被修改了会返回所在群组的所有属性该群所有的成员都能收到
*/
timRenderInstance.TIMSetGroupAttributeChangedCallback({
callback: (...args) => {callback({ type: 'TIMSetGroupAttributeChangedCallback', data: args })},
userData: ""
})
/**
* @brief 1.8 设置会话事件回调
* @param cb 会话事件回调请参考[TIMConvEventCallback](TIMCloudCallback.h)
* @param user_data 用户自定义数据ImSDK只负责传回给回调函数cb不做任何处理
*
* @note
* > 会话事件包括
* >> 会话新增
* >> 会话删除
* >> 会话更新
* >> 会话开始
* >> 会话结束
* > 任何产生一个新会话的操作都会触发会话新增事件例如调用接口[TIMConvCreate]()创建会话接收到未知会话的第一条消息等
* 任何已有会话变化的操作都会触发会话更新事件例如收到会话新消息消息撤回已读上报等
* 调用接口[TIMConvDelete]()删除会话成功时会触发会话删除事件
*/
timRenderInstance.TIMSetConvEventCallback({
callback:(args)=>{
callback({
type: 'TIMSetConvEventCallback',
data: {
type:args[0],
data:args[1]!=="" ? JSON.parse(args[1]) : []
}
})
},
user_data:"TIMSetConvEventCallback"
})
/**
* @brief 1.9 设置会话未读消息总数变更的回调
* @param cb 会话未读消息总数变更的回调请参考[TIMConvTotalUnreadMessageCountChangedCallback](TIMCloudCallback.h)
* @param user_data 用户自定义数据ImSDK只负责传回给回调函数cb不做任何处理
*
*/
timRenderInstance.TIMSetConvTotalUnreadMessageCountChangedCallback({
callback:(args)=>{
callback({
type: 'TIMSetConvTotalUnreadMessageCountChangedCallback',
data: args[0]
})
}
})
/**
* @brief 1.10 设置网络连接状态监听回调
* @param cb 连接事件回调请参考[TIMNetworkStatusListenerCallback](TIMCloudCallback.h)
* @param user_data 用户自定义数据ImSDK只负责传回给回调函数cb不做任何处理
*
* @note
* > 当调用接口 [TIMInit]() ImSDK会去连接云后台此接口设置的回调用于监听网络连接的状态
* > 网络连接状态包含四个正在连接连接失败连接成功已连接这里的网络事件不表示用户本地网络状态仅指明ImSDK是否与即时通信IM云Server连接状态
* > 可选设置如果要用户感知是否已经连接服务器需要设置此回调用于通知调用者跟通讯后台链接的连接和断开事件另外如果断开网络等网络恢复后会自动重连自动拉取消息通知用户用户无需关心网络状态仅作通知之用
* > 只要用户处于登录状态ImSDK内部会进行断网重连用户无需关心
*/
timRenderInstance.TIMSetNetworkStatusListenerCallback({
callback: (...args) => {callback({ type: 'TIMSetNetworkStatusListenerCallback', data: args })},
userData: ""
})
/**
* @brief 1.11 设置被踢下线通知回调
* @param cb 踢下线回调请参考[TIMKickedOfflineCallback](TIMCloudCallback.h)
* @param user_data 用户自定义数据ImSDK只负责传回给回调函数cb不做任何处理
*
* @note
* > 用户如果在其他终端登录会被踢下线这时会收到用户被踢下线的通知出现这种情况常规的做法是提示用户进行操作退出或者再次把对方踢下线
* > 用户如果在离线状态下被踢下次登录将会失败可以给用户一个非常强的提醒登录错误码ERR_IMSDK_KICKED_BY_OTHERS6208开发者也可以选择忽略这次错误再次登录即可
* > 用户在线情况下的互踢情况
* + 用户在设备1登录保持在线状态下该用户又在设备2登录这时用户会在设备1上强制下线收到 TIMKickedOfflineCallback 回调
* 用户在设备1上收到回调后提示用户可继续调用login上线强制设备2下线这里是在线情况下互踢过程
* > 用户离线状态互踢:
* + 用户在设备1登录没有进行logout情况下进程退出该用户在设备2登录此时由于用户不在线无法感知此事件
* 为了显式提醒用户避免无感知的互踢用户在设备1重新登录时会返回ERR_IMSDK_KICKED_BY_OTHERS6208错误码表明之前被踢是否需要把对方踢下线
* 如果需要则再次调用login强制上线设备2的登录的实例将会收到 TIMKickedOfflineCallback 回调
*/
timRenderInstance.TIMSetKickedOfflineCallback({
callback: (...args) => {
callback({
type: 'TIMSetKickedOfflineCallback',
data: args
});
},
userData: ""
})
/**
* @brief 1.12 设置票据过期回调
* @param cb 票据过期回调请参考[TIMUserSigExpiredCallback](TIMCloudCallback.h)
* @param user_data 用户自定义数据ImSDK只负责传回给回调函数cb不做任何处理
*
* @note
* 用户票据可能会存在过期的情况如果用户票据过期此接口设置的回调会调用
* [TIMLogin]()也将会返回70001错误码开发者可根据错误码或者票据过期回调进行票据更换
*/
timRenderInstance.TIMSetUserSigExpiredCallback({
callback: (...args) => {callback({ type: 'TIMSetUserSigExpiredCallback', data: args })},
userData: ""
})
/**
* @brief 1.13 设置添加好友的回调
* @param cb 添加好友回调请参考[TIMOnAddFriendCallback](TIMCloudCallback.h)
* @param user_data 用户自定义数据ImSDK只负责传回给回调函数cb不做任何处理
*
* @note
* 此回调为了多终端同步例如A设备B设备都登录了同一帐号的ImSDKA设备添加了好友B设备ImSDK会收到添加好友的推送ImSDK通过此回调告知开发者
*/
timRenderInstance.TIMSetOnAddFriendCallback({
callback: (...args) => {
console.log('=====添加好友=====', args)
callback({ type: 'TIMSetOnAddFriendCallback', data: args })
},
userData: ""
})
/**
* @brief 1.14 设置删除好友的回调
* @param cb 删除好友回调请参考[TIMOnDeleteFriendCallback](TIMCloudCallback.h)
* @param user_data 用户自定义数据ImSDK只负责传回给回调函数cb不做任何处理
*
* @note
* 此回调为了多终端同步例如A设备B设备都登录了同一帐号的ImSDKA设备删除了好友B设备ImSDK会收到删除好友的推送ImSDK通过此回调告知开发者
*/
timRenderInstance.TIMSetOnDeleteFriendCallback({
callback: (...args) => {callback({ type: 'TIMSetOnDeleteFriendCallback', data: args })},
userData: ""
})
/**
* @brief 1.15 设置更新好友资料的回调
* @param cb 更新好友资料回调请参考[TIMUpdateFriendProfileCallback](TIMCloudCallback.h)
* @param user_data 用户自定义数据ImSDK只负责传回给回调函数cb不做任何处理
*
* @note
* 此回调为了多终端同步例如A设备B设备都登录了同一帐号的ImSDKA设备更新了好友资料B设备ImSDK会收到更新好友资料的推送ImSDK通过此回调告知开发者
*/
timRenderInstance.TIMSetUpdateFriendProfileCallback({
callback: (...args) => {callback({ type: 'TIMSetUpdateFriendProfileCallback', data: args })},
userData: ""
})
/**
* @brief 1.16 设置好友添加请求的回调
* @param cb 好友添加请求回调请参考[TIMFriendAddRequestCallback](TIMCloudCallback.h)
* @param user_data 用户自定义数据ImSDK只负责传回给回调函数cb不做任何处理
*
* @note
* 当前登入用户设置添加好友需要确认时如果有用户请求加当前登入用户为好友会收到好友添加请求的回调ImSDK通过此回调告知开发者如果多终端登入同一帐号每个终端都会收到这个回调
*/
timRenderInstance.TIMSetFriendAddRequestCallback({
callback: (...args) => {
console.log('=====添加好友请求=====', JSON.parse(args[0][0]));
callback({
type: 'TIMSetFriendAddRequestCallback',
data: JSON.parse(args[0][0])
})
},
userData: ""
})
/**
* @brief 1.17 设置好友申请删除的回调
* @param cb 好友申请删除回调请参考[TIMFriendApplicationListDeletedCallback](TIMCloudCallback.h)
* @param user_data 用户自定义数据ImSDK只负责传回给回调函数cb不做任何处理
*
* @note
* 1. 主动删除好友申请
* 2. 拒绝好友申请
* 3. 同意好友申请
* 4. 申请加别人好友被拒绝
*/
timRenderInstance.TIMSetFriendApplicationListDeletedCallback({
callback: (...args) => {callback({ type: 'TIMSetFriendApplicationListDeletedCallback', data: args })},
userData: ""
})
/**
* @brief 1.18 设置好友申请已读的回调
* @param cb 好友申请已读回调请参考[TIMFriendApplicationListReadCallback](TIMCloudCallback.h)
* @param user_data 用户自定义数据ImSDK只负责传回给回调函数cb不做任何处理
*
* @note
* 如果调用 setFriendApplicationRead 设置好友申请列表已读会收到这个回调主要用于多端同步
*/
timRenderInstance.TIMSetFriendApplicationListReadCallback({
callback: (...args) => {callback({ type: 'TIMSetFriendApplicationListReadCallback', data: args })},
userData: ""
})
/**
* @brief 1.19 设置黑名单新增的回调
* @param cb 黑名单新增的回调请参考[TIMFriendBlackListAddedCallback](TIMCloudCallback.h)
* @param user_data 用户自定义数据ImSDK只负责传回给回调函数cb不做任何处理
*
*/
timRenderInstance.TIMSetFriendBlackListAddedCallback({
callback: (...args) => {callback({ type: 'TIMSetFriendBlackListAddedCallback', data: args })},
userData: ""
})
/**
* @brief 1.20 设置黑名单删除的回调
* @param cb 黑名单删除的回调请参考[TIMFriendBlackListDeletedCallback](TIMCloudCallback.h)
* @param user_data 用户自定义数据ImSDK只负责传回给回调函数cb不做任何处理
*
*/
timRenderInstance.TIMSetFriendBlackListDeletedCallback({
callback: (...args) => {callback({ type: 'TIMSetFriendBlackListDeletedCallback', data: args })},
userData: ""
})
/**
* @brief 1.22 设置消息在云端被修改后回传回来的消息更新通知回调
* @param cb 消息更新回调请参考[TIMMsgUpdateCallback](TIMCloudCallback.h)
* @param user_data 用户自定义数据ImSDK只负责传回给回调函数cb不做任何处理
*
* @note
* > 当您发送的消息在服务端被修改后ImSDK会通过该回调通知给您
* > 您可以在您自己的服务器上拦截所有即时通信IM消息 [发单聊消息之前回调](https://cloud.tencent.com/document/product/269/1632)
* > 设置成功之后即时通信IM服务器会将您的用户发送的每条消息都同步地通知给您的业务服务器
* > 您的业务服务器可以对该条消息进行修改例如过滤敏感词如果您的服务器对消息进行了修改ImSDK就会通过此回调通知您
*/
timRenderInstance.TIMSetMsgUpdateCallback({
callback: (...args) => {callback({ type: 'TIMSetMsgUpdateCallback', data: args })},
userData: ""
})
timRenderInstance.TIMOnInvited({
callback:(data)=>{
callback({
type: 'TIMOnInvited',
data: data
})
}
})
timRenderInstance.TIMOnRejected({
callback:(data)=>{
callback({
type: 'TIMOnRejected',
data: data
})
}
})
timRenderInstance.TIMOnAccepted({
callback:(data)=>{
callback({
type: 'TIMOnAccepted',
data: data
})
}
})
timRenderInstance.TIMOnCancelled({
callback:(data)=>{
callback({
type: 'TIMOnCancelled',
data: data
})
}
})
timRenderInstance.TIMOnTimeout({
callback:(data)=>{
callback({
type: 'TIMOnTimeout',
data: data
})
}
})
}
}
export default { timRenderInstance, initListeners: IMListeners.initListeners }

View File

@ -8,6 +8,8 @@
// const TimRender = require('im_electron_sdk/dist/render')
import * as TYPES from './enumbers' // sdk相关枚举
import MsgEnum from './msgEnum' // 消息相关枚举(自定义)
import IMListeners from './imLiseners' // im消息-监听器
// @ts-ignore
const API = window.api
// TIM生成签名
// import * as GenerateUserSig from './userSig' // 引入签名生成器
@ -24,29 +26,33 @@ export class ImChat {
}
defOption = { // 默认配置
// 日志等级-全量日志
log_level: TYPES.TIMLogLevel.kTIMLog_Test,
log_level: TYPES.TIMLogLevel.kTIMLog_Off,
// 群组类型-会议群Meeting成员上限 6000 人
group_type: TYPES.TIMGroupType.kTIMGroup_ChatRoom,
}
/**
* @description 构造函数
* @param {number} SDKAppID
* @param {string} userSig
* @param {string} userID
* @param {boolean} isInit
*/
constructor(SDKAppID, userSig, userID, isInit) {
this.SDKAppID = SDKAppID
this.userSig = userSig
// const sig = 'eJwtjN0KgjAYQN9l16Vzcz8I3RhE9J*JV94IW-ZV6nASWfTurfTynAPnjdLNyXvoFkWIeBhN-gxK1x2cYdCMTQnlYmxW3QpjQKEo4BhjGgrKh6KfBlrtPGOMuDTYDqqfE26BWUjEeIHSrW1cL-SulHd5KI7zxDbpdh1cX0nuX7JK7HtroNerZhnnPpYz9PkCe5Mx1w__'
// this.userSig = sig
this.userID = userID
window.test = this
// this.timGroupId = '@TGS#3CYWMK2ON' // 测试使用
if (isInit) return this.init()
// window.test = this
if (isInit) this.init()
}
// 设置配置
async setConfig() {
await this.timChat.TIMSetConfig({ // TIMSetConfigParam
json_config: { // JSONCongfig
set_config_log_level: this.defOption.log_level,
set_config_callback_log_level: this.defOption.log_level,
// set_config_is_log_output_console: true,
set_config_log_level: TYPES.TIMLogLevel.kTIMLog_Test,
set_config_callback_log_level: TYPES.TIMLogLevel.kTIMLog_Error,
set_config_is_log_output_console: true,
// set_config_user_config: { // 用户配置
// user_config_is_read_receipt: true, // true表示要收已读回执事件
// user_config_is_sync_report: true, // true表示服务端要删掉已读状态
@ -62,7 +68,6 @@ export class ImChat {
// 日志监听
this.timChat.TIMSetLogCallback({
callback: data => {
// console.log('[im-chat]', data[1])
this.setConsole('%cchat-log ', data[1])
},
user_data: ''
@ -73,44 +78,57 @@ export class ImChat {
return new Promise(async(resolve, reject) => {
try {
if(!API) reject('preload api获取失败, 初始化-未完成')
this.timChat = await API.getTimRender()
await this.timChat.TIMInit({
// electron_log:true,
})
console.log('[im-chat]初始化成功')
// this.timChat = await API.getTimRender()
this.timChat = IMListeners.timRenderInstance
const code = await this.timChat.TIMInit()
if (code == 0) { // 初始化成功
this.setConsole('%cim-chat: init', '初始化成功')
this.status.isConnect = true
this.setConfig() // 设置日志级别
resolve(this)
} else { // 失败具体请看code
console.error('[im-chat]:初始化失败', code)
reject(code)
}
} catch (error) {reject(error)}
})
}
// 生成签名
genTestUserSig() {
const options = {
SDKAppID: this.SDKAppID,
secretKey: this.secretKey,
userID: this.userID,
// const options = {
// SDKAppID: this.SDKAppID,
// secretKey: this.secretKey,
// userID: this.userID,
// }
// const { userSig } = GenerateUserSig.genTestUserSig(options)
// this.userSig = userSig
}
const { userSig } = GenerateUserSig.genTestUserSig(options)
this.userSig = userSig
}
// 监听
/**
* @description 监听消息
* @param {Function} callback
*/
watch(callback) {
// 先移除监听
this.timChat.TIMRemoveRecvNewMsgCallback()
// 消息监听
this.timChat.TIMAddRecvNewMsgCallback({
callback, user_data: this.toStr('msg')
})
// 群消息监听
// 群组系统消息事件包括 加入群、退出群、踢出群、设置管理员、取消管理员、群资料变更、群成员资料变更。此消息是针对所有群组成员下发的
this.timChat.TIMSetGroupTipsEventCallback({
// callback, user_data: this.toStr('msg-group')
callback: (data) => {
// console.log('群消息', group_tips_event)
this.setConsole('%c群消息', data)
},
})
// // 先移除监听
// this.timChat.TIMRemoveRecvNewMsgCallback()
// // 消息监听
// this.timChat.TIMAddRecvNewMsgCallback({
// callback, user_data: this.toStr('msg')
// })
// // 群消息监听
// // 群组系统消息事件包括 加入群、退出群、踢出群、设置管理员、取消管理员、群资料变更、群成员资料变更。此消息是针对所有群组成员下发的
// this.timChat.TIMSetGroupTipsEventCallback({
// // callback, user_data: this.toStr('msg-group')
// callback: (data) => {
// // console.log('群消息', group_tips_event)
// this.setConsole('%c群消息', data)
// },
// })
if (this.timChat && this.status.isConnect) { // 连接成功允许监听
this.setConsole('%cim-chat: watch', '监听成功')
IMListeners.initListeners(callback)
} else {
this.setConsole('%cim-chat: watch', '监听失败, 未连接')
}
}
// 登录
login() {
@ -127,18 +145,19 @@ export class ImChat {
const res = await this.timChat.TIMLogin(option)
if (res && res.code == 0) {
// console.log('登录成功', res)
this.setConsole('%cim-chat: login', '登录成功')
this.status.isLogin = true
resolve({status:0, msg:'登录成功', data:res})
} else reject(res)
} else {
if (status == 1) { // 已登录
console.log('已登录')
this.setConsole('%cim-chat: login', '已登录')
resolve({status, msg:'已登录'})
} else if (status == 2) { // 登录中
console.log('登录中')
this.setConsole('%cim-chat: login', '登录中')
resolve({status, msg:'登录中'})
} else if (status == 4) { // 登出中
console.log('登出中')
this.setConsole('%cim-chat: login', '登出中')
resolve({status, msg:'登出中'})
}
}
@ -150,16 +169,20 @@ export class ImChat {
logout() {
if (!this.timChat) return
return this.timChat.TIMLogout().then(res => {
console.log('登出成功', res)
this.setConsole('%cim-chat: logout', '登出成功')
this.status.isLogin = false
this.timChat.TIMUninit() // 反初始化
return res
}).catch(error => {
console.log('登出失败', error)
this.setConsole('%cim-chat: logout', '登出失败', error)
return error
})
}
// 创建群组 群名和初始成员 userID
/**
* @description 创建群组 群名和初始成员 userID
* @param {any} name
* @param {any[]} memberList
*/
createGroup(name, memberList=[]) {
if (!this.timChat) return
if (!!this.timGroupId) return console.log('群组已存在')
@ -189,9 +212,10 @@ export class ImChat {
// @TGS#3XVNI6ZOG
return this.timChat.TIMGroupCreate(option).then(res => {
if (res && res.code == 0) {
this.setConsole('%c创建群组成功', res)
const timGroupId = res?.json_param?.create_group_result_groupid
if (!!timGroupId && timGroupId != 'undefined'){
this.setConsole('%c创建群组成功', timGroupId)
// this.setConsole('%c创建群组成功', timGroupId)
this.timGroupId = timGroupId
// this.setGroupMsgReceive()
}
@ -207,7 +231,10 @@ export class ImChat {
data: '', // 用户自定义数据
})
}
// 设置群消息接收
/**
* @description 设置群消息接收
* @param {string} timGroupId
*/
setGroupMsgReceive(timGroupId) {
if (!this.timGroupId) this.timGroupId = timGroupId || ''
if (!this.timGroupId) return console.log('timGroupId为空')
@ -227,7 +254,11 @@ export class ImChat {
return error
})
}
// 发送消息
/**
* @description 发送消息
* @param {any} conv_id
* @param {any} msg
*/
sendMsg(conv_id, msg) {
if (!conv_id) return console.log('conv_id为空')
if (typeof msg == 'object') msg = JSON.stringify(msg)
@ -246,15 +277,33 @@ export class ImChat {
user_data: '', // 用户自定义数据
// callback: (data) => {}
}
console.log('发送消息', option)
// console.log('发送消息', option)
this.setConsole('%cim-chat: 发送消息', option)
return this.timChat.TIMMsgSendMessageV2(option)
}
/**
* @description 发送群消息
* @param {any} msg
* @param {*} head
* @param {*} type
*/
sendMsgGroup(msg, head, type) {
const msgObj = this.getMsgObj(head, msg, type)
// console.log('发送群消息', msgObj)
return this.sendMsg(this.timGroupId, msgObj)
}
// 发送关闭(下课)消息
sendMsgClosed(){
const msg = this.getMsgObj(MsgEnum.HEADS.MSG_closed, '下课', MsgEnum.TYPES.TEACHER)
const msg = this.getMsgObj(MsgEnum.HEADS.MSG_closed, '下课')
return this.sendMsg(this.timGroupId, msg)
}
// 获取消息对象
/**
* @description 获取消息对象
* @param {string} msgHead
* @param {string} msg
* @param {string} type
* @param {string|number} sender
*/
getMsgObj(msgHead, msg, type, sender, option={}) {
if (!msgHead) throw new Error('msgHead is required')
if (!msg) throw new Error('msg is required')
@ -262,19 +311,27 @@ export class ImChat {
return {
msgKey: msgHead,
msgcontent: msg,
msgType: type ?? MsgEnum.TYPES.STUDENT, // 默认为学生
msgType: type || MsgEnum.TYPES.TEACHER, // 默认为老师
senduserid: sender ?? this.userID,
...option
}
}
// 设置控制台样式
/**
* @description 设置控制台样式
* @param {string} hearStr
* @param {string[]} args
*/
setConsole(hearStr,...args) {
const css = 'color: #fff;background-color:#2ccb92;padding:3px 5px;border-radius:3px;'
const time = new Date().toLocaleTimeString()
if (!hearStr) hearStr = '%c' + time
console.log(hearStr, css, ...args)
}
// 获取数据字符串
/**
* @description 获取数据字符串
* @param {*} data
* @returns
*/
toStr = (data) => {
if (typeof data === 'string') data = {type: data}
return JSON.stringify(data)

File diff suppressed because one or more lines are too long

View File

@ -95,6 +95,7 @@ export class MsgEnum {
// === 新定义-消息头 ===
/** @desc: 点赞 */
MSG_0001: 0x0001,
/** @desc: 疑惑 */
MSG_0002: 0x0002,
MSG_0003: 0x0003,
MSG_0004: 0x0004,
@ -109,6 +110,7 @@ export class MsgEnum {
MSG_0013: 0x000d,
MSG_0014: 0x000e,
MSG_0015: 0x000f,
/** @desc: 作业推送 */
MSG_0016: 0x0010,
MSG_0017: 0x0011,
MSG_0018: 0x0012,

View File

@ -1,44 +0,0 @@
/**
* @description: 生成签名|客户端计算 UserSig
* @author: zdg
* @date 2021-07-05 14:07:01
*/
// TIM生成签名
import LibGenerateTestUserSig from './lib-generate-test-usersig-es.min.js';
/**
* Signature expiration time, which should not be too short
* Time unit: second
* Default time: 7 * 24 * 60 * 60 = 604800 = 7days
*/
const EXPIRETIME = 604800;
/**
* Module: GenerateTestUserSig
*
* Description: Generates UserSig for testing. UserSig is a security signature designed by Tencent Cloud for its cloud services.
* It is calculated based on `SDKAppID`, `UserID`, and `EXPIRETIME` using the HMAC-SHA256 encryption algorithm.
*
* Attention: For the following reasons, do not use the code below in your commercial application.
*
* The code may be able to calculate UserSig correctly, but it is only for quick testing of the SDKs basic features, not for commercial applications.
* `SECRETKEY` in client code can be easily decompiled and reversed, especially on web.
* Once your key is disclosed, attackers will be able to steal your Tencent Cloud traffic.
*
* The correct method is to deploy the `UserSig` calculation code and encryption key on your project server so that your application can request from your server a `UserSig` that is calculated whenever one is needed.
* Given that it is more difficult to hack a server than a client application, server-end calculation can better protect your key.
*
* Reference: https://cloud.tencent.com/document/product/647/17275#Server
*/
function genTestUserSig(options) {
const { SDKAppID, secretKey, userID } = options;
const generator = new LibGenerateTestUserSig(SDKAppID, secretKey, EXPIRETIME);
const userSig = generator.genTestUserSig(userID);
return {
SDKAppID,
userSig,
};
}
export { genTestUserSig, EXPIRETIME };

View File

@ -3,13 +3,14 @@
*/
const isNode = typeof require !== 'undefined' // 是否支持node函数
const { ipcRenderer } = isNode?require('electron'):{} // app使用
import { sessionStore } from '@/utils/store'
// const Remote = isNode?require('@electron/remote'):{} // 远程模块
export function shareStorePlugin({store}) {
store.$subscribe((mutation, state) => { // 自动同步
// mutation 变量包含了变化前后的状态
// mutation.events: key newValue target oldValue oldTarget
// state 是变化后的状态
// console.log('store.$subscribe', mutation)
// console.log('store.$subscribe', mutation, state, store)
// 在存储变化的时候执行
// const storeName = store.$id
const storeName = mutation.storeId
@ -19,13 +20,15 @@ export function shareStorePlugin({store}) {
const { storeId: storeName, payload, events, type } = mutation // direct
// if (!Object.keys(payload).length) return
if (type != 'direct' || !events || Array.isArray(events) || !events.key) return
stateSync(storeName, events.key, events.newValue) // 需要同步
stateSync(storeName, events.key, events.newValue, state) // 需要同步
}
})
// 暴露方法-手动同步
store.stateSync = (storeName, key, value) => {
if (!storeName && !!key && !!value) stateSync(storeName, key, value)
else stateSyncAll(store)
const state = store.$state
if (!storeName && !!key && !!value) stateSync(storeName, key, value, state)
else stateSyncAll(store, state)
}
// 暴露方法-发送当前状态-新窗口
store.stateSyncInit = wid => stateSyncInit(wid, store)
@ -34,15 +37,19 @@ export function shareStorePlugin({store}) {
}
// 同步数据-发送给主线程-单独
function stateSync(storeName, key, value) {
function stateSync(storeName, key, value, state) {
// console.log('state-change', storeName, key, value)
let jsonStr = ''
let obj = {[key]:value}
window.test = obj
if (typeof key === 'string') jsonStr = JSON.stringify(obj)
else if (typeof value === 'object') jsonStr = JSON.stringify(key)
try {
const { data, keystr } = filterByKey(state, key, value)
const jsonStr = JSON.stringify(data) // 从新组装-json数据
// 更新本地数据-session
sessionStore.set(keystr, value)
// 通知主线程更新
ipcRenderer?.invoke('pinia-state-change', storeName, jsonStr)
// console.log('======',keystr, jsonStr )
} catch (error) {
console.log('state-change-error', error)
}
}
// 同步数据-发送给主线程-全量更新
@ -93,3 +100,29 @@ const circularSafeStringify = (obj) => {
});
}
// 过滤对象
const filterByKey = (obj, key, value) => {
let res = { data:{}, keystr:'' }
for (let k in obj) {
if (obj.hasOwnProperty(k)) {
const isEqual = JSON.stringify(obj[k]) === JSON.stringify(value) // 值是否相同
if (k === key && isEqual) {
// 如果匹配,则添加到新对象中
res.data[k] = obj[k];
res.keystr = k;
} else {
if (obj[k] !== null && typeof obj[k] === 'object') {
// 如果是对象,则递归处理
const {data, keystr} = filterByKey(obj[k], key, value)
if(!!keystr) {
res.data[k] = data
res.keystr = `${k}.${keystr}`
}
}
}
}
}
return res;
}
// 对象克隆
const objClone = (obj) => JSON.parse(JSON.stringify(obj))

View File

@ -0,0 +1,23 @@
import { defineStore } from 'pinia'
const useThirdStore = defineStore('third', {
state: () => ({
activeGrade:'',
gradeName:'',
subjectName:'',
textbookVersionId:''
}),
actions: {
// 登录
getSelectBookInfo(params){
this.activeGrade = params.activeGrade
this.gradeName = params.gradeName
this.subjectName = params.subjectName
this.textbookVersionId = params.textbookVersionId
}
},
persist: true
})
export default useThirdStore

View File

@ -2,6 +2,10 @@
* 工具类-窗口-状态管理
*/
import { defineStore } from 'pinia'
import { sessionStore } from '@/utils/tool'
// 默认数据
const defData = sessionStore.store || {}
export const useToolState = defineStore('tool', {
state: () => ({
@ -12,7 +16,8 @@ export const useToolState = defineStore('tool', {
curSubjectNode: {
data: {}, // 当前教材节点 (包含当前教材 单元)
querySearch: {} // 查询资源所需参数
}
},
...defData // 默认数据-覆盖上面的配置(不要删除, 会导致新窗口-获取状态失败)
}),
actions: {
}

View File

@ -76,3 +76,36 @@ export const toTimeText = (timeStamp, simple) => {
}
return timeText
}
/**
*
* @returns 当前年--
*/
export const getCurrentTime = (format)=> {
const now = new Date();
const year = now.getFullYear();
const month = (now.getMonth() + 1).toString().padStart(2, '0');
const day = now.getDate().toString().padStart(2, '0');
const hours = now.getHours().toString().padStart(2, '0');
const minutes = now.getMinutes().toString().padStart(2, '0');
if(format == 'YYYY-MM-DD'){
return `${year}-${month}-${day}`;
}
if(format == 'HH:mm'){
return `${hours}:${minutes}`;
}
}
/**
*
* @param {number} m 指定时间
* @returns 指定时间之后的 小时:分钟
*/
export const getAfterMinutes = (m) => {
const now = new Date();
const afterMinutes = new Date(now.getTime() + m * 60 * 1000);
let hours = afterMinutes.getHours();
hours = hours < 10 ? ('0' + hours) : hours
let minutes = afterMinutes.getMinutes();
minutes = minutes < 10 ? ('0' + minutes) : minutes
return `${hours}:${minutes}`;
}

View File

@ -7,7 +7,6 @@ export const hasPermission = (value, def = true) => {
if (!value) {
return def
}
const allCodeList = useUserStore().roles
// 如果不是数组直接判断pinia里的权限数组有没有相同的元素即可
if (!Array.isArray(value)) {

View File

@ -6,7 +6,11 @@ export const tabs = [
{
label: '校本资源',
value: '校本'
}
},
{
label: '第三方资源',
value: '第三方'
},
]
@ -67,3 +71,45 @@ export const resourceType = [
value: '教案'
}
]
// 年级划分
export const gradeList = [
{
label:'小学',
value:1
},
{
label:'初中',
value:2
},
{
label:'高中',
value:3
},
]
//课件类别
export const coursewareTypeList = [
{
label:'全部',
value:''
},
{
label:'课件',
value:3
},
{
label:'教案',
value:8
},
{
label:'试卷',
value:7
},
{
label:'学案',
value:4
},
{
label:'素材',
value:6
},
]

View File

@ -0,0 +1,25 @@
/**
* @description : 存储对象-本地存储 封装工具(渲染器)
* @author : zdg
* @date : 2024-09-03
*/
const isNode = typeof require !== 'undefined' // 是否支持node函数
const Store = isNode?require('electron-store'):null // 持久化存储
// 暴露sessionStore存储对象
export const sessionStore = Store ? new Store({
name: 'session-store', // 存储文件名
fileExtension: 'ini', // 文件后缀名
encryptionKey: 'BvPLmgCC4DSIG0KkTec5' // 数据加密-防止用户直接改配置
}) : {}
// 暴露localStore存储对象
export const localStore = Store ? new Store({
name: 'local-store', // 存储文件名
fileExtension: 'ini', // 文件后缀名
encryptionKey: '6CyoHQmUaPmLzvVsh' // 数据加密-防止用户直接改配置
}) : {}
export default {
sessionStore, localStore
}

View File

@ -11,14 +11,27 @@ const path = isNode?require('path'):{}
const Remote = isNode?require('@electron/remote'):{}
const { ipcRenderer } = isNode?require('electron'):window.electron || {}
const API = isNode?window.api:{} // preload-api
import { useToolState } from '@/store/modules/tool' // 获取store状态
// import { useToolState } from '@/store/modules/tool' // 获取store状态
// const Store = isNode?require('electron-store'):null // 持久化存储
import store from './store'
// 常用变量
const BaseUrl = isNode?process.env['ELECTRON_RENDERER_URL']+'/#':''
const isDev = isNode?process.env.NODE_ENV !== 'production':''
const toolState = useToolState() // 获取store状态
// const toolState = useToolState() // 获取store状态
// 暴露Remote中的属性
export const ipcMain = Remote?.ipcMain || {}
// 暴露sessionStore存储对象
export const sessionStore = store.sessionStore
// 暴露localStore存储对象
export const localStore = store.localStore
// 暴露Store存储对象
export const Store = store
/**
* 获取静态资源开发和生产环境
* @param {*} url
@ -110,11 +123,21 @@ export const createWindow = async (type, data) => {
wins_tool.setIgnoreMouseEvents(true, {forward: true}) // 忽略鼠标事件但是事件继续传递给窗口
wins_tool.setAlwaysOnTop(true,'screen-saver') // 将窗口设置为顶层窗口
wins_tool.setVisibleOnAllWorkspaces(true) // 如果窗口在所有工作区都可见
// win.webContents.openDevTools() // 打开调试工具
// wins_tool.webContents.openDevTools() // 打开调试工具
eventHandles(type, wins_tool) // 事件监听处理
return wins_tool
}
case 'open-PDF': { //课本展示-pdf
if(winPdf){ //判断是否已经打开
if (winPdf.isMinimized()){
winPdf.restore();
} else{
winPdf.focus();
// toolState.isPdfWin=true
}
return
}
const option = data.option||{}
const defOption = {
frame: false, // 要创建无边框窗口
@ -123,12 +146,6 @@ export const createWindow = async (type, data) => {
}
data.isConsole = true // 是否开启控制台
data.option = {...defOption, ...option}
if(winPdf){ //判断是否已经打开
// if (winPdf.isMinimized()) winPdf.restore();
winPdf.focus();
// toolState.isPdfWin=true
return
}
const win = await toolWindow(data)
win.type = type // 唯一标识
win.show()
@ -183,14 +200,17 @@ export function toolWindow({url, isConsole, isWeb=true, option={}}) {
mainWin.once('closed', () => { win.destroy()})
// 内部监听器
win.webContents.on('did-finish-load', () => {
setTimeout(() => {
toolState.stateSyncInit(win.id) // 同步状态
}, 200);
// setTimeout(() => {
// toolState.stateSyncInit(win.id) // 同步状态
// }, 200);
})
// 内部监听器-是否打印
if (!!isConsole) {
win.webContents.on('console-message', (e,leve,m,lin,s) => {
console.log(`[${win.type}]`,m)
if(m.startsWith('%c')){ // 特殊打印
const arr = m.match(/(%c[^ ]+)(?:\s+(.*;))(.*)/)
console.log(arr[1],arr[2],arr[3])
} else console.log(`[${win.type}]`,m)
})
}
})
@ -236,24 +256,34 @@ const eventHandles = (type, win) => {
break}
case 'open-PDF': {
// 最小化窗口 minimize()
Remote.ipcMain.once('open-PDF:minimize', () => {
Remote.ipcMain.handle('open-PDF:minimize', () => {
// winPdf=null
// win&&win.destroy()
win&&win.minimize(); //缩小功能
})
// 关闭窗口
Remote.ipcMain.once('open-PDF:close', () => {
winPdf=null
win&&win.destroy()
// win&&win.minimize(); //缩小功能
})
publicMethods() // 加载公共方法
const on = {
onClosed: () => {
Remote.ipcMain.removeHandler('open-PDF:minimize')
}
}
publicMethods(on) // 加载公共方法
break}
default:
break
}
}
const taskHandles = () => {
// const taskHandles = () => {
// // 设置任务栏上下文菜单
// const contextMenu = new Remote.Menu()
// contextMenu.append(new Remote.MenuItem({
// label: '关闭',
// click: () => {Remote.app.quit()}
// }))
}
// }

View File

@ -26,7 +26,10 @@
<i class="iconfont icon-xiayiye"></i>
<span class="texts">下一页</span>
</el-button>
</div>
<div class="pdf-btn-right">
<el-button @click="minimize" >最小化</el-button>
<el-button @click="minimize('rest')" >关闭</el-button>
</div>
</div>
</template>
@ -72,9 +75,10 @@ const navtopage = (type) => {
pdfCanvaslist.value.initPdf('rest')
}
//
const minimize = async () => {
await pdfCanvaslist.value.savaDataStore()
const minimize = async (type='minimize') => {
await pdfCanvaslist.value.savaDataStore(type)
}
const handleUpdate = (data) => {
numPagesTotal.value = data
if (numPagesTotal.value == 1) {
@ -100,9 +104,12 @@ const switchPageMode = () => {
}
}
onMounted(async () => {
const isDev = process.env.NODE_ENV == 'development'
toolState.isPdfWin=true //pdf
if (isDev)
pdfObj.pdfUrl = getStaticUrl('aaa.pdf', 'user', 'selfFile', true) //
else
pdfObj.pdfUrl = getStaticUrl(route.query.path, 'user', 'selfFile', true) //线
// pdfObj.pdfUrl = getStaticUrl('aaa.pdf', 'user', 'selfFile', true) //
textbookId.value = route.query.textbookId
pdfObj.bookId=textbookId.value
//
@ -138,7 +145,8 @@ const getUniqueArrayByLastOccurrence=(array)=> {
flex-wrap: wrap;
.pdf-btn {
position: absolute;
right: 0;
// right: 0;
left: 0;
bottom: 0;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
border-radius: 5px 0 0 0;
@ -163,5 +171,28 @@ const getUniqueArrayByLastOccurrence=(array)=> {
}
}
}
.pdf-btn-right{
position: absolute;
right: 0;
bottom: 0;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
border-radius: 5px 0 0 0;
button {
margin-left: 0;
border: none;
font-size: 16px;
// padding: 4px 7px;
border-radius: 0;
width: 80px;
height: 70px;
:deep(> span) {
display: block !important;
}
.iconfont {
font-size: 26px;
margin-bottom: 10px;
}
}
}
}
</style>

View File

@ -1,10 +1,10 @@
<template>
<el-card style="width: 100%;height: 100%">
<template #header>
<div class="card-header" style="text-align: left">
<el-button type="primary" @click="addGroup">新建分组</el-button>
</div>
</template>
<!-- <template #header>-->
<!-- <div class="card-header" style="text-align: left">-->
<!-- <el-button type="primary" @click="addGroup">新建分组</el-button>-->
<!-- </div>-->
<!-- </template>-->
<template v-if="groupList.length > 0">
<div style="font-size: 16px;font-weight: bold;color: #000;text-align: left;margin-bottom: 5px">可用分组</div>
<div class="groupList">

View File

@ -1,10 +1,10 @@
<template>
<el-card style="width: 100%;height: 100%">
<template #header>
<div style="text-align: left">
<el-button type="danger" @click="deleteClassRoom">删除班级</el-button>
</div>
</template>
<!-- <template #header>-->
<!-- <div style="text-align: left">-->
<!-- <el-button type="danger" @click="deleteClassRoom">删除班级</el-button>-->
<!-- </div>-->
<!-- </template>-->
<el-descriptions :column="1">
<el-descriptions-item label="班级名称">{{ classInfo.caption }}</el-descriptions-item>
<el-descriptions-item label="教师">

View File

@ -6,11 +6,12 @@
<div :style="{'max-height': (viewportHeight - 120) + 'px','overflow-y': 'auto'}">
<Aside :menuItems="menuItems" :classList="classList" @handleSelect="handleSelect"></Aside>
</div>
<template #footer>
<div>
<el-button @click="addClass" type="primary" :icon="Plus" >新增班级</el-button>
</div>
</template>
<!-- 隐藏操作按钮-->
<!-- <template #footer>-->
<!-- <div>-->
<!-- <el-button @click="addClass" type="primary" :icon="Plus" >新增班级</el-button>-->
<!-- </div>-->
<!-- </template>-->
</el-card>
</el-aside>
<el-main :style="{'min-height': (viewportHeight - 160) + 'px'}">

View File

@ -3,10 +3,10 @@
<el-card style="width: 100%;height: 100%;overflow-y: auto">
<template #header>
<div style="text-align: left;display: flex;justify-content: space-between">
<div>
<el-button type="primary" @click="addStudent(0)">新增学生</el-button>
<el-button type="primary" @click="importStudent()">导入学生</el-button>
</div>
<!-- <div>-->
<!-- <el-button type="primary" @click="addStudent(0)">新增学生</el-button>-->
<!-- <el-button type="primary" @click="importStudent()">导入学生</el-button>-->
<!-- </div>-->
<el-text class="mx-1">点击学生头像查看学生信息</el-text>
</div>
</template>
@ -54,27 +54,27 @@
<el-form-item label="电话" prop="parentmobile">
<el-input v-model="studentForm.parentmobile" placeholder="请输入电话" style="width: 50%"/>
</el-form-item>
<div>
<el-row :gutter="4">
<el-col :span="12">
<el-form-item label-width="100px" label="平台登录账号">
系统自动创建
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label-width="100px" label="平台登录密码">
系统自动创建默认为123123
</el-form-item>
</el-col>
</el-row>
</div>
<!-- <div>-->
<!-- <el-row :gutter="4">-->
<!-- <el-col :span="12">-->
<!-- <el-form-item label-width="100px" label="平台登录账号">-->
<!-- 系统自动创建-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="12">-->
<!-- <el-form-item label-width="100px" label="平台登录密码">-->
<!-- 系统自动创建默认为123123-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
<!-- </div>-->
</el-form>
<template #footer>
<el-button type="warning" v-show="studentForm.id > 0" @click="delStudent(1)">移出班级</el-button>
<el-button type="danger" v-show="studentForm.id > 0 && studentForm.editoruserid == userStore.userId" @click="delStudent(2)">删除学生</el-button>
<el-button @click="studentVisible = false"> </el-button>
<el-button type="primary" @click="btnStudentSave"> </el-button>
</template>
<!-- <template #footer>-->
<!-- <el-button type="warning" v-show="studentForm.id > 0" @click="delStudent(1)">移出班级</el-button>-->
<!-- <el-button type="danger" v-show="studentForm.id > 0 && studentForm.editoruserid == userStore.userId" @click="delStudent(2)">删除学生</el-button>-->
<!-- <el-button @click="studentVisible = false"> </el-button>-->
<!-- <el-button type="primary" @click="btnStudentSave"> </el-button>-->
<!-- </template>-->
</el-dialog>
<!-- 学生导入-->
<el-dialog title="学生导入" v-model="importVisiable" :width="600" append-to-body>

View File

@ -35,6 +35,7 @@
placeholder="请选择日期"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
:disabled-date="disabledDate"
/>
</el-col>
</el-form-item>
@ -53,6 +54,8 @@
range-separator="-"
start-placeholder="开始时间"
end-placeholder="结束时间"
:disabled-hours="disabledHours"
:disabled-minutes="disabledMinute"
/>
</el-col>
</el-form-item>
@ -81,6 +84,8 @@ import { ref, defineExpose, onMounted, reactive, computed, watch } from 'vue'
import { addSmartClassReserv, updateSmartClassReserv, listClassmain } from '@/api/classManage'
import useUserStore from '@/store/modules/user'
import { ElMessage } from 'element-plus'
import { getCurrentTime, getAfterMinutes } from '@/utils/date'
const emit = defineEmits(['addSuccess'])
const props = defineProps({
bookId: {
@ -143,6 +148,52 @@ const locationOptions = [
const locationMessage = computed(() => {
return locationOptions.find((item) => item.value === form.type).message
})
//
const disabledDate = (time)=> {
//
const today = new Date();
if (time.getTime() < today.getTime() - 8.64e7) {
// true
return true;
}
//
const oneMonthLater = new Date(today.getTime() + 30 * 24 * 60 * 60 * 1000);
if (time.getTime() > oneMonthLater.getTime()) {
return true;
}
return false;
}
// -
const disabledHours = ()=>{
if(getCurrentTime('YYYY-MM-DD') == form.day){
const arrs = []
for (let i = 0; i < 24; i++) {
if (new Date().getHours() <= i) continue;
arrs.push(i)
}
return arrs;
}
}
// -
const disabledMinute = (hour,role) => {
if(getCurrentTime('YYYY-MM-DD') == form.day){
const arrs = []
if(role == 'start'){
for (let i = 0; i < 60; i++) {
if (new Date().getMinutes() <= i) continue;
arrs.push(i)
}
return arrs;
}
else{
if(form.time[0]) return []
}
}
}
const openDialog = (data) => {
if (data) {
updateForm.value = data
@ -154,6 +205,11 @@ const openDialog = (data) => {
form.resource = data.classList.split(',').map((item) => parseInt(item))
form.classRoom = data.classRoom
}
else{
//
form.day = getCurrentTime('YYYY-MM-DD')
form.time = [getCurrentTime('HH:mm'), getAfterMinutes(45)]
}
centerDialogVisible.value = true
}
const closeDialog = () => {

View File

@ -1,332 +0,0 @@
<template>
<el-dialog v-model="dialogVisible" center top="10vh" width="600px" :show-close="false" append-to-body
style="border-radius: 10px; padding: 10px 15px;">
<template #header>
<div class="homerwork-header flex">
<span>{{ title }}</span>
<i class="iconfont icon-guanbi" @click="cloneDialog"></i>
</div>
</template>
<div v-loading="setLoading">
<el-form :model="form" label-width="80px" ref="ruleForm" :rules="rules">
<el-form-item label="班级" prop="grade">
<el-scrollbar max-height="200px" style="width: 100%;">
<el-tree ref="treeRef" :data="gradeList" :props="defaultProps" :load="getLoad" node-key="id"
@check="handleCheckChange" lazy show-checkbox />
</el-scrollbar>
</el-form-item>
<el-form-item label="选中学生" prop="student">
<el-scrollbar max-height="200px">
<el-tag v-for="(tag, index) in studentList" :key="tag.studentid" closable type="primary"
@close="delStudent(index)">
{{ tag.name }}
</el-tag>
</el-scrollbar>
</el-form-item>
<el-form-item label="完成要求" prop="feedback">
<el-radio-group v-model="form.feedback">
<el-radio value="必做" size="large">必做</el-radio>
<el-radio value="选做" size="large">选做</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="截止时间" prop="deaddate">
<el-date-picker v-model="form.deaddate" value-format="YYYY-MM-DD HH:mm" format="YYYY-MM-DD HH:mm"
time-format="HH:mm" type="datetime" :clearable="false" placeholder="请选择截止时间" />
</el-form-item>
<el-form-item label="推荐用时" prop="timelength">
<el-input-number v-model="form.timelength" :min="1" :max="500" />
</el-form-item>
</el-form>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click.stop="cloneDialog">取消</el-button>
<el-button type="primary" @click.stop="onSubmit('ruleForm')">
确定
</el-button>
</div>
</template>
</el-dialog>
</template>
<script>
import { ElMessage } from 'element-plus'
import { listClassmain, listClassgroup } from '@/api/classManage/index'
import { saveByClassWorkArray } from '@/api/teaching/classwork'
import useUserStore from '@/store/modules/user'
import { uniqBy, groupBy } from 'lodash'
export default {
props: {
modelValue: {
type: Boolean,
default: false
},
entpcourseid: {
default: ''
},
row: {
default: ''
},
title: {
type: String,
default: '布置作业'
}
},
data() {
return {
dialogVisible: false,
defaultProps: {
children: 'children',
label: 'label',
isLeaf: 'leaf',
},
setLoading: false,
//
userInfo: null,
//
gradeList: [],
curGradeId: '',
//
groupList: [],
//
studentList: [],
//
form: {
feedback: '必做',
deaddate: '',
timelength: 1
},
//
rules: {
grade: [
{ validator: this.validateGrade, trigger: 'blur' }
],
student: [
{ validator: this.validateStudent, trigger: 'blur' }
]
}
}
},
created() {
//
this.form.deaddate = this.getCurrentDate() + ' ' + '10:00:00'
this.userInfo = useUserStore().user
},
methods: {
//
getGradeList() {
listClassmain({ classuserid: this.userInfo.userId, pageSize: 100, status: 'open' }).then(res => {
let list = res.rows
list.forEach(item => {
item.label = item.caption
item.level = 0
item.children = []
item.classstudentlist = JSON.parse("[" + item.classstudentlist + "]")
item.classstudentlist.forEach(el => {
el.classId = item.id
})
})
this.gradeList = list
})
},
//
getLoad(node, resolve) {
if (node.level == 0) return resolve([])
//
if (node.level == 1) {
listClassgroup({ classid: node.key, orderby: 'orderidx', pageSize: 100 }).then(res => {
if (res.rows.length > 0) {
let ary = []
res.rows.forEach(item => {
if (item.parentid === 0) {
//studentGroup
let studentGroup = JSON.parse("[" + item.studentlist + "]")
studentGroup.forEach(el => {
el.label = el.name
el.leaf = true
el.level = 2,
el.id = el.studentid
el.classId = item.classid
})
ary.push({
label: item.groupname,
...item,
level: 1,
children: studentGroup
})
}
})
resolve(ary)
}
else {
resolve([])
}
})
}
//
if (node.level == 2) {
resolve(node.data.children)
}
},
//
handleCheckChange(data, checked) {
this.studentList = []
//
let checkNodes = checked.checkedNodes
let ary = []
checkNodes.forEach(item => {
//
if (item.level == 0) {
ary = [...ary, ...(item.classstudentlist)]
}
//
if (item.level == 1) {
ary = [...ary, ...(item.children)]
}
//
if (item.level == 2) {
ary = [...ary, item]
}
})
this.studentList = uniqBy(ary, 'studentid')
},
//
delStudent(index) {
this.studentList.splice(index, 1)
},
onSubmit(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
/**
* 根据学生列表中的classId分班
* studentList 为选中的所有学生 这些学生可能来自不同班级
*/
let gradeObj = groupBy(this.studentList, 'classId')
//
let ary = []
for (const value in gradeObj) {
// AIx web
let obj = {
id: 0,
parentid: this.row.id,
classid: value,
classcourseid: 0,
entpcourseid: this.entpcourseid,
studentlist: JSON.stringify(gradeObj[value]),
feedback: this.form.feedback,
workkey: "",
timelength: this.form.timelength,
weights: 1,
deaddate: this.form.deaddate,
workdate: this.getCurrentDate(),
uniquekey: this.row.uniquekey,
entpcourseworklist: "[" + this.row.entpcourseworklist + "]",
needMsgNotifine: 'false',
msgkey: 'newclasswork',
title: "作业任务",
msgcontent: '',
teachername: this.userInfo.nickName,
unixstamp: new Date().getTime(),
worktype: this.row.worktype
}
ary.push(obj)
}
this.setLoading = true
saveByClassWorkArray({
classworkarray: JSON.stringify(ary)
}).then(() => {
this.setLoading = false
ElMessage.success('操作成功')
this.cloneDialog()
}).catch(()=>{
this.setLoading = false
})
} else {
return false
}
})
},
//
cloneDialog() {
this.$emit('on-close')
this.studentList = []
this.$refs['ruleForm'].resetFields();
},
//
getCurrentDate() {
const now = new Date();
const year = now.getFullYear();
let month = now.getMonth() + 1; // 0+1
let day = now.getDate()
if(month < 10){
month = '0' + month
}
if(day < 10){
day = '0' + day
}
return `${year}-${month}-${day}`;
},
validateGrade(rule, value, callback) {
if (this.studentList.length == 0) {
callback(new Error('请勾选班级或者学生'));
}
else {
callback()
}
},
validateStudent(rule, value, callback) {
if (this.studentList.length == 0) {
callback(new Error('学生不能为空'));
}
else {
callback()
}
},
},
watch: {
modelValue(val) {
this.dialogVisible = val
if (val) {
this.getGradeList()
}
}
},
}
</script>
<style lang="scss" scoped>
.homerwork-header {
justify-content: space-between;
font-size: 15px;
font-weight: bold;
.icon-guanbi {
font-size: 20px;
cursor: pointer;
}
}
.el-tag {
margin-right: 10px;
margin-bottom: 10px;
}
.dialog-footer{
padding-bottom: 10px
}
:deep(.el-checkbox){
transform : scale(1.3)
}
:deep(.el-icon){
transform : scale(1.3)
}
</style>

View File

@ -114,7 +114,6 @@
v-model="setDialog"
:entpcourseid="entpcourseid"
:row="row"
@on-close="closeHomework"
/>
</div>
<reserv
@ -123,6 +122,7 @@
:book-id="uploadData.textbookId"
@add-success="initReserv"
></reserv>
<!-- <button @click="ipcMsgSend('tool-sphere:close')">测试</button> -->
</template>
<script setup>
import { Check } from '@element-plus/icons-vue'
@ -143,14 +143,15 @@ import { toTimeText } from '@/utils/date'
import { ElMessage } from 'element-plus'
import { parseCataByNode, creatPPT, asyncLocalFile } from '@/utils/talkFile'
import FileOperBatch from '@/views/prepare/container/file-oper-batch.vue'
import SetHomework from './container/set-homework.vue'
import SetHomework from '@/components/set-homework/index.vue'
import outLink from '@/utils/linkConfig'
import { createWindow } from '@/utils/tool'
import { createWindow, ipcMsgSend } from '@/utils/tool'
import { cloneDeep } from 'lodash'
import { delClasswork } from '@/api/teaching/classwork'
import { getSelfReserv, startClass } from '@/api/classManage'
import { useGetHomework } from '@/hooks/useGetHomework'
const toolStore = useToolState()
const fs = require('fs')
const { ipcRenderer } = window.electron || {}
@ -423,9 +424,9 @@ export default {
this.uploadData.levelSecondId = cata[1]
this.uploadData.levelThirdId = cata[2]
this.uploadData.textbookId = data.textBook.curBookId
const toolStore = useToolState()
toolStore.curSubjectNode.data = data
toolStore.curSubjectNode.querySearch = this.uploadData
//
this.$nextTick(() =>{ toolStore.curSubjectNode.querySearch = this.uploadData })
this.initHomeWork()
await this.asyncAllFile()
},
@ -487,13 +488,9 @@ export default {
this.isLoading = false
})
},
closeHomework() {
this.setDialog = false
},
// PDF-
async navtoPdf() {
if (toolStore.isPdfWin) return this.$message.error('您当前已打开课本,请勿重复操作')
// if (toolStore.isPdfWin) return this.$message.error('')
let path = await this.getBookPathFromServer()
createWindow('open-PDF', {
url: '/classBegins/index?textbookId=' + this.uploadData.textbookId + '&path=' + path
@ -501,7 +498,7 @@ export default {
},
// -
async openLesson() {
await startClass(this.curClassReserv.id)
// await startClass(this.curClassReserv.id)
createWindow('tool-sphere', {
url:
'/tool/sphere?entpcourseid=' +

View File

@ -7,12 +7,30 @@
@click="sourceStore.changeTab(item.value)">{{ item.label
}}</el-button>
</el-col>
<el-col :span="12" class="search-box flex">
<el-input v-model="sourceStore.query.fileName" @input="sourceStore.changeName" style="width: 240px"
<el-col :span="12" class="search-box flex" v-if="isThird">
<el-input v-model="sourceStore.thirdQuery.title" @input="onchangeInput()" style="width: 240px"
placeholder="请输入关键词" />
</el-col>
<el-col :span="12" class="search-box flex" v-else>
<el-input v-model="sourceStore.query.fileName" @input="onchangeInput()" style="width: 240px"
placeholder="请输入关键词" />
</el-col>
</el-row>
<el-row class="resoure-btns">
<!-- 第三方资源筛选-->
<el-row class="resoure-btns" v-if="isThird">
<el-col :span="24" class="query-row flex">
<div class="flex row-left">
<el-button v-for="item in coursewareTypeList" :key="item.id"
:type="sourceStore.thirdQuery.type == item.value ? 'primary' : ''" round
@click="sourceStore.thirdChangeType(item.value)">
{{item.label }}
</el-button>
</div>
</el-col>
</el-row>
<el-row class="resoure-btns" v-else>
<el-col :span="24" class="query-row flex">
<div class="flex row-left"> <el-select v-model="sourceStore.query.fileSuffix" @change="sourceStore.changeSuffix"
style="width: 110px">
@ -30,13 +48,36 @@
</div>
</el-col>
</el-row>
</div>
</template>
<script setup>
import {watch,ref,onMounted} from 'vue'
import useResoureStore from '../store'
import {coursewareTypeList} from '@/utils/resourceDict'
const isThird = ref(false)
const sourceStore = useResoureStore()
//
const debounce = (fn, t) => {
let timer;
return function (...args) {
if (timer) clearTimeout(timer);
timer = setTimeout(() => fn.apply(this, args), t);
};
};
//
const debouncedChangeName = debounce(sourceStore.changeName, 300);
const onchangeInput = () => {
debouncedChangeName()
}
onMounted(() => {
sourceStore.query.fileSource = '平台'
})
watch(() => sourceStore.query.fileSource,() => {
sourceStore.query.fileSource === '第三方'?isThird.value = true:isThird.value = false
})
</script>
<style lang="scss" scoped>
.resoure-search {

View File

@ -0,0 +1,260 @@
<template>
<div v-loading="sourceStore.loading" class="resource-list">
<el-scrollbar>
<el-empty v-if="!sourceStore.thirdResult.list.length" description="暂无数据" />
<ul>
<li
v-for="item in sourceStore.thirdResult.list"
:key="item.itemId"
class="list-item"
@click="handleRow"
>
<div class="item-left flex">
<div style="position: relative" @click="clickImg(item.itemId)">
<FileImage :file-name="item.fileType" :size="50" />
<el-icon style="position: absolute;top: 1px;right: 5px"><Search /></el-icon>
</div>
<div class="flex item-left-content">
<div class="name flex" :title="item.title">
<div></div>
<div
style="
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 200px;
"
>
{{ item.title }}
</div>
</div>
<div class="item-tags flex" style="margin-bottom: 5px;">
<el-text type="info" size="small" class="mr-10">标签</el-text>
<el-tag type="info" size="small" class="mr-10">{{ item.year }}</el-tag>
<el-tag type="info" size="small" class="mr-10">{{ item.typeName }}</el-tag>
<el-tag type="info" size="small" class="mr-10">{{ item.provinceName }}</el-tag>
</div>
<div class="item-tags flex">
<el-text type="info" size="small" class="mr-10">
<el-icon><Clock/></el-icon>
{{ timestampToDate(item.dateline) }}
</el-text>
<el-text type="info" size="small" class="mr-10">
<el-icon><View /></el-icon>
{{ item.viewCount }}人看过
</el-text>
<el-text type="info" size="small" class="mr-10">
<el-icon><Folder /></el-icon>
{{ item.formatSize }}
</el-text>
</div>
</div>
</div>
</li>
</ul>
</el-scrollbar>
<div class="pagination-box">
<el-pagination
v-model:current-page="sourceStore.thirdQuery.page"
v-model:page-size="sourceStore.thirdQuery.perPage"
:page-sizes="[10, 20, 30, 50]"
background
layout="total, sizes, prev, pager, next, jumper"
:total="sourceStore.thirdResult.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
<el-dialog v-model="isViewImg" width="80%" :modal-append-to-body="false" :append-to-body="false">
<div class="demo-image__lazy">
<el-image v-for="(url,index) in srcList" :key="index" :src="url" lazy />
</div>
</el-dialog>
<!-- <video width="550" controls autoplay loop>-->
<!-- <source src="https://sf1-cdn-tos.huoshanstatic.com/obj/media-fe/xgplayer_doc_video/mp4/xgplayer-demo-360p.mp4" type="video/mp4" />-->
<!-- </video>-->
</div>
</template>
<script setup>
import { ref } from 'vue'
// import { ElMessage, ElMessageBox } from 'element-plus'
import { Clock,View,Folder,Search } from '@element-plus/icons-vue'
import FileImage from '@/components/file-image/index.vue'
import { getFileSuffix } from '@/utils/ruoyi'
import useUserStore from '@/store/modules/user'
import useResoureStore from '../store'
import {getImgPath} from "@/api/file/third";
const userstore = useUserStore()
const sourceStore = useResoureStore()
// const userInfo = userstore.user
//
const isViewImg = ref(false)
//
const srcList = ref([])
// change
const handleSizeChange = (limit) => {
sourceStore.thirdQuery.perPage = limit
sourceStore.handleQuery()
}
const handleCurrentChange = (page) => {
sourceStore.thirdQuery.page = page
sourceStore.handleQuery()
}
//
function timestampToDate(timestamp) {
// 10
if (timestamp.toString().length === 10) {
timestamp *= 1000;
}
const date = new Date(timestamp);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); // 01
const day = String(date.getDate()).padStart(2, '0'); //
return `${year}-${month}-${day}`;
}
//
const clickImg = (id) => {
srcList.value = []
getImgPath({itemId:id}).then(res => {
if(res.code === 200){
isViewImg.value = true
res.data.forEach(item => {
item.subsets.forEach(previewItem => {
previewItem.previewFiles.forEach(fileItem => {
srcList.value.push(fileItem.fileUrl)
})
})
})
}
})
}
</script>
<style lang="scss">
::v-deep(.el-popover) {
min-width: 50px;
width: 50px !important;
}
.custom-popover {
width: 80px !important;
min-width: 80px !important;
padding: 5px !important;
.item-popover-item {
padding: 5px 0;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
cursor: pointer;
.iconfont {
margin-right: 5px;
color: #a2a2a2;
}
}
}
.resource-list {
flex: 1;
display: flex;
flex-direction: column;
overflow: auto;
.list-item {
flex: 1;
padding: 10px 20px;
border-bottom: solid #f1f1f1 1px;
display: flex;
justify-content: space-between;
align-items: center;
cursor: pointer;
&:hover {
background-color: rgba(144, 147, 153, 0.2);
cursor: pointer;
}
.item-left {
align-items: center;
flex: 1;
.icon {
font-size: 50px;
}
.item-left-content {
margin-left: 10px;
flex-direction: column;
flex: 1;
text-align: left;
}
.name {
font-size: 14px;
color: #3b3b3b;
margin-bottom: 5px;
}
.line {
width: 1px;
height: 15px;
background-color: #d9dce2;
}
.item-tags {
align-items: center;
}
.mr-10 {
margin-right: 10px;
}
.gray-text {
color: #909399;
font-size: 13px;
}
}
&:last-child {
border-bottom: none;
}
.item-btns {
display: flex;
align-items: center;
:deep(.item-popover) {
font-size: 12px;
flex-direction: column;
p {
text-align: center;
}
}
.icon-shenglvehao {
cursor: pointer;
font-size: 18px;
font-weight: bold;
margin-right: 10px;
}
.icon-jiahao {
font-size: 12px;
margin-right: 3px;
font-weight: bold;
}
}
}
.pagination-box {
display: flex;
justify-content: center;
height: 65px;
}
}
</style>

View File

@ -1,7 +1,8 @@
<template>
<div class="page-resource flex">
<!--左侧 教材 目录-->
<ChooseTextbook @change-book="getData" @node-click="getData" />
<Third v-if="isThird" @node-click="getDataOther"></Third>
<ChooseTextbook v-else @change-book="getData" @node-click="getData" />
<div class="page-right">
<!-- 搜索 -->
@ -18,7 +19,9 @@
>
</ResoureSearch>
<!-- 列表 -->
<ResoureList />
<!-- 第三方列表-->
<ThirdList v-if="isThird" />
<ResoureList v-else />
</div>
</div>
<!-- 上传弹窗 -->
@ -26,11 +29,13 @@
</template>
<script setup>
import { onMounted, ref, toRaw } from 'vue'
import { onMounted, ref, toRaw,watch } from 'vue'
import useResoureStore from './store'
import ChooseTextbook from '@/components/choose-textbook/index.vue'
import Third from '@/components/choose-textbook/third.vue'
import ResoureSearch from './container/resoure-search.vue'
import ResoureList from './container/resoure-list.vue'
import ThirdList from './container/third-list.vue'
import uploadDialog from '@/components/upload-dialog/index.vue'
import uploaderState from '@/store/modules/uploader'
import { createWindow } from '@/utils/tool'
@ -41,9 +46,8 @@ const toolStore = useToolState()
const openDialog = () => {
isDialogOpen.value = true
}
// onMounted(async () => {
// console.log('toolStore: ', toolStore.windowState)
// })
//
const isThird = ref(false)
//
const getData = (data) => {
@ -66,6 +70,15 @@ const getData = (data) => {
levelSecondId
}
sourceStore.handleQuery()
// ID
localStorage.setItem('unitId', JSON.stringify({ levelFirstId, levelSecondId}))
}
const getDataOther = (data) => {
sourceStore.thirdQuery.chapterId = data.chapterId
sourceStore.thirdQuery.bookId = data.bookId
sourceStore.thirdQuery.stage = data.stage
sourceStore.thirdQuery.subjectId = data.subjectId
sourceStore.handleQuery()
}
//
@ -92,6 +105,9 @@ const fileCallBack = (res) => {
onMounted(() => {
sourceStore.getCreate()
})
watch(() => sourceStore.query.fileSource,() => {
sourceStore.query.fileSource === '第三方'?isThird.value = true:isThird.value = false
})
</script>
<style lang="scss" scoped>

View File

@ -1,5 +1,6 @@
import { defineStore } from 'pinia'
import { getSmarttalkPage } from '@/api/file/index'
import { getBookList } from '@/api/file/third'
import { tabs, resourceType, resourceFormat } from '@/utils/resourceDict'
import useUserStore from '@/store/modules/user'
import { hasPermission } from '@/utils/hasPermission'
@ -60,15 +61,32 @@ export default defineStore('resource', {
isAsc: 'desc',
...structQuery
},
//第三方的查询条件
thirdQuery:{
page:1,
perPage:20,
chapterId:0,
bookId:0,
stage:0,
subjectId:0,
type:'',
title:''
},
result: {
list: [],
total: 0
}
},
//第三方的数据单独处理
thirdResult:{
list: [],
total: 0,
},
}),
actions: {
handleQuery() {
try {
this.loading = true
if(this.query.fileSource !== '第三方'){
let data = { ...this.query }
if (data.fileSuffix == -1) {
data.fileSuffix = ''
@ -77,6 +95,22 @@ export default defineStore('resource', {
this.result.total = res.total
this.result.list = res.rows
})
}else{
let data = JSON.parse(JSON.stringify(this.thirdQuery))
if (data.title) {
data.title.trim()
}else{
data.title = null
}
getBookList(data).then((res) => {
if(res.code === 200){
if(res.data.code === 0){
this.thirdResult.total = res.data.page.totalCount
this.thirdResult.list = [...res.data.data]
}
}
})
}
} finally {
this.loading = false
}
@ -90,6 +124,11 @@ export default defineStore('resource', {
this.query.fileFlag = val
this.handleQuery()
},
thirdChangeType(val) {
this.thirdQuery.type = val
this.handleQuery()
},
//第三方的切换类型区别开
changeSuffix(val) {
this.query.fileSuffix = val
this.handleQuery()
@ -99,12 +138,12 @@ export default defineStore('resource', {
this.handleQuery()
},
getCreate(){
if(this.query.fileSource == '平台'){
if(this.query.fileSource == '平台' || this.query.fileSource == '第三方' ){
this.isCreate = hasPermission(['platformmanager'])
}
else{
this.isCreate = hasPermission(['schoolteacher','headmaster'])
}
}
},
}
})

View File

@ -19,6 +19,7 @@ const emit = defineEmits(['update:modelValue'])
onMounted(async() => {
if (canvasRef.value) {
FabricVue.drawConfig.drawColors = ['red']
FabricVue.drawConfig.drawWidth = 3
FabricVue.boardConfig.mode = TYPES.ActionMode.OTHER
FabricVue.boardConfig.backgroundColor = 'transparent'
const option = { freeDrawingCursor: 'default' }
@ -28,7 +29,7 @@ onMounted(async() => {
const handleMode = (newVal, oldVal) => {
if(toolStore.isPdfWin){
if(newVal=='clear'){
emit('update:modelValue', oldVal)
setTimeout(() => emit('update:modelValue', oldVal), 10)
}
return
}
@ -46,7 +47,7 @@ const handleMode = (newVal, oldVal) => {
case 'clear': //
if(oldVal){
FabricVue.history?.clean()
emit('update:modelValue', oldVal)
setTimeout(() => emit('update:modelValue', oldVal), 10)
}
break

View File

@ -51,7 +51,7 @@
</el-scrollbar>
</div>
<SetHomework v-model="setDialog" :title="'推送作业'" :entpcourseid="entpcourseid" :row="curRow"
@on-close="closeHomework" />
@on-close="closeHomework" @on-success="successHomework"/>
</div>
<div class="homework flex" v-else>
<div class="unit-top flex">
@ -73,18 +73,17 @@
import { ref, onMounted, toRaw } from 'vue';
import { useRoute } from 'vue-router';
import useUserStore from '@/store/modules/user'
import { getSmarttalkPage, getPrepareById } from '@/api/file'
import SetHomework from '@/views/prepare/container/set-homework.vue'
import { getSmarttalkPage } from '@/api/file'
import SetHomework from '@/components/set-homework/index.vue'
import FileImage from '@/components/file-image/index.vue'
import { useGetHomework } from '@/hooks/useGetHomework'
import { ipcMsgSend } from '@/utils/tool'
import { ipcMsgSend, ipcMsgSend2, ipcMsgInvoke } from '@/utils/tool'
import { useToolState } from '@/store/modules/tool'
import { asyncLocalFile } from '@/utils/talkFile'
import Lesson from './lesson.vue';
import { parseCataByNode } from '@/utils/talkFile'
import outLink from '@/utils/linkConfig'
import MsgEnum from '@/plugins/imChat/msgEnum' //
import { ipcMsgSend2 } from '@/utils/tool'
const route = useRoute();
const usertore = useUserStore().user
const toolStore = useToolState()
@ -97,11 +96,9 @@ const dataList = ref([])
const setDialog = ref(false)
//
const resourceList = ref([])
//
//
const curRow = ref('')
const sendHomework = (row) => {
curRow.value = row
setTimeout(() => {
@ -110,12 +107,16 @@ const sendHomework = (row) => {
setDialog.value = true
}
//
const closeHomework = () => {
const closeHomework = async() => {
ipcMsgSend('tool-sphere:set:ignore', true)
setDialog.value = false
}
//
const successHomework = (data)=>{
// console.log('', data)
// im-(app|)
ipcMsgInvoke('im-chat:msg', data, MsgEnum.HEADS.MSG_0016)
}
// change
const changeChapter = async (data)=>{
const { res } = await useGetHomework(data)
dataList.value = res

View File

@ -4,7 +4,7 @@ import { onMounted, ref, reactive, watchEffect } from 'vue'
import { ImChat } from '@/plugins/imChat'
import useUserStore from '@/store/modules/user'
import * as http from '@/api/apiService' // api service
// import { ipcMsgSend, ipcHandle, ipcMain, ipcMsgInvoke } from '@/utils/tool' //
import { ipcMsgSend, ipcHandle, ipcMain, ipcMsgInvoke } from '@/utils/tool' //
const userStore = useUserStore()
const emits = defineEmits(['change'])
const props = defineProps({
@ -12,11 +12,10 @@ const props = defineProps({
})
const imChatObj = reactive({imChat:null})
onMounted(() => {
// console.log(imChatObj)
initImChat()
ipcMainHandle() // -ipcMain im
})
// im-chat
const initImChat = async () => {
const initImChat = async (timGroupId) => {
// console.log('im-chat', userStore.user.timuserid)
try {
const { timuserid, deptId, userId } = userStore.user
@ -31,29 +30,59 @@ const initImChat = async () => {
imChatObj.imChat = new ImChat(sdkAppId, sign, timuserid)
// im-chat
await imChatObj.imChat.init()
// im-chat
await imChatObj.imChat.login()
// im-chat
imChatObj.imChat.watch((res) => {
const [msg] = res[0]?JSON.parse(res[0]):[]
imChatObj.imChat.setConsole('%cchat-msg', msg)
//
if(msg.message_sender == '@TIM#SYSTEM'){
emits('change', 'msg-system', null, msg)
} else { // -
(msg?.message_elem_array||[]).forEach(o => {
const msgData = !!o.text_elem_content ? JSON.parse(o.text_elem_content)||'' : ''
emits('change', 'msg', msgData, msg)
})
}
imChatObj.imChat.setConsole('%cchat-msg', res)
msgHandle(res) //
})
// im-chat(-)
await imChatObj.imChat.login()
//
if (props.isGroup) await createGroup(groupName)
if (!timGroupId||props.isGroup) { //
await createGroup(groupName)
} else { // -id
imChatObj.imChat.timGroupId = timGroupId
}
return imChatObj.imChat
}
} catch (error) {
console.log('im-error: ', error)
}
}
//
const msgHandle = (msg) => {
const { type, data } = msg
switch(type) {
case 'TIMAddRecvNewMsgCallback': // data=[]
{
(data||[]).forEach(o => {
const msgArr = o?.message_elem_array||[]
msgArr.forEach(info => {
const msgType = info?.elem_type // TIMElemType
const msgData = !!info.text_elem_content ? JSON.parse(info.text_elem_content)||'' : ''
emits('change', 'msg', msgData, o, type, msgType)
})
})
}
break
case 'TIMSetConvEventCallback': // data = {data,type}
{
const convArr = data.data || []
convArr.forEach(o => {
const msgArr = o?.conv_last_msg?.message_elem_array||[]
msgArr.forEach(info => {
const msgType = info?.elem_type // TIMElemType
const msgData = !!info.text_elem_content ? JSON.parse(info.text_elem_content)||'' : ''
emits('change', 'msg', msgData, o?.conv_last_msg, type, msgType)
})
})
}
emits('change', 'msg-conv', msg)
break
}
//
emits('change', 'msgDef', msg)
}
//
const createGroup = async (groupName) => {
if (!imChatObj.imChat) return
@ -65,7 +94,15 @@ const logout = () => imChatObj.imChat?.logout()
//
const deleteGroup = () => imChatObj.imChat?.deleteGroup()
defineExpose({ logout, deleteGroup, imChatObj })
// -ipcMain im
const ipcMainHandle = () => {
ipcMain?.removeHandler?.('im-chat:msg') // ipcMain
ipcMain?.handle?.('im-chat:msg', (e, msg, head, type) => { // ipcMain
return imChatObj.imChat?.sendMsgGroup(msg, head, type)
})
}
defineExpose({ initImChat, logout, deleteGroup, imChatObj })
</script>
<template>

View File

@ -13,9 +13,8 @@
</template>
<script setup>
import { ref, onMounted, nextTick, markRaw, toRaw } from 'vue'
import { ref, onMounted, nextTick, toRaw } from 'vue'
import { useToolState } from '@/store/modules/tool'
import { parseCataByNode } from '@/utils/talkFile'
const emit = defineEmits(['changeChapter'])
const toolStore = useToolState()
@ -42,18 +41,17 @@ const getTreeData = () => {
evaluationList.value = JSON.parse(localStorage.getItem('evaluationList'))
//
let volumeOne = evaluationList.value.filter(item => item.level == 1 && item.semester == '上册')
//
let volumeTwo = evaluationList.value.filter(item => item.level == 1 && item.semester == '下册')
/**
* 不区分上下册
* 2024/08/20调整
*/
let volumeOne = evaluationList.value.filter(item => item.level == 1)
//
let upData = transData(volumeOne)
let downData = transData(volumeTwo)
if(upData.length && downData.length){
treeData.value = [...upData,...downData]
}
else if(upData.length || downData.length){
treeData.value = upData.length ? upData : downData
if(upData.length){
treeData.value = [...upData]
}
else{
treeData.value = []

View File

@ -1,8 +1,9 @@
<template>
<div class="warp" ref="btnRef">
<div class="warp" ref="btnRef" :style="isFold?'min-height:auto;':''">
<slot name="start"></slot>
<!-- 工具按钮 -->
<el-space direction="vertical">
<transition name="el-zoom-in-bottom">
<el-space direction="vertical" v-show="!isFold">
<template v-for="(item,index) in list">
<slot :name="item.prop" :item="item" :index="index">
<div class="c-btn flex flex-col items-center gap-2 p-2" @click.stop="clickHandel(item,$event)">
@ -13,7 +14,12 @@
</template>
<slot name="append"></slot>
</el-space>
<slot name="end"></slot>
</transition>
<slot name="end">
<span class="fold" @click="isFold=!isFold" :style="isFold?'margin: 5px;':''">
{{isFold?'<<<':'>>>'}}
</span>
</slot>
<!-- 内容部分 -->
<transition name="el-fade-in">
<div class="c-popover" :style="`--top: ${topPos}px;--height:${hPost}px;`" v-show="isVisible">
@ -54,6 +60,7 @@ const activeObj = ref(null) // 当前激活的按钮
const btnRef = ref(null) // -ref
const topPos = ref(30) // -
const hPost = ref(0) // -
const isFold = ref(false) //
let posBtnAll = {} //
// === ===
const list = computed(() => props.data.map((o,i) => {
@ -100,7 +107,7 @@ const clickHandel = (o, e) => {
min-width: 4em;
border-radius: 4em;
background-color: #121212;
.el-space{margin: 20px 0;}
.el-space{margin: 20px 0 0;}
.c-btn{
color: #d9dce3;
cursor: pointer;
@ -113,6 +120,20 @@ const clickHandel = (o, e) => {
background: #454545fa;
}
}
.fold{
display: block;
color: #ccc;
font-size: 14px;
padding: 3px 6px;
cursor: pointer;
user-select: none;
margin-bottom: 10px;
&:hover{
color: #409eff;
border-radius: 4px;
// background: #454545fa;
}
}
}
.c-popover{
--top: 30px;

View File

@ -1,28 +1,73 @@
<template>
<el-button v-if="props.test" type="primary" @click="trigger">测试</el-button>
<div ref="warpRef" class="c-warp">
<template v-for="i in sum">
<slot><el-icon><Star /></el-icon></slot>
<div v-if="props.test">
<el-button type="primary" @click="trigger" v-tap:trigger="">点赞</el-button>
<el-button type="primary" @click="trigger(2, '学生A')" v-tap:trigger="[2,'学生A']">疑惑</el-button>
</div>
<!-- 温度计-模式 -->
<div v-if="props.type == 2" class="c-anim">
<div class="item like" :style="`height:${wtData.like*5}px;`"></div>
<div class="item doubt" :style="`height:${wtData.doubt*5}px;`"></div>
</div>
<!-- (默认)弹幕-模式 -->
<div v-else ref="warpRef" class="c-warp">
<template v-for="(item, index) in iconCache.list">
<slot>
<el-icon v-if="props.def"><Star /></el-icon>
<div v-else class="item">
<svg class="icon" aria-hidden="true">
<use :xlink:href="`#icon-`+item.icon"></use>
</svg>
<!-- 学生姓名 -->
<div class="tip" v-if="item.name">
<span :title="item.name">{{item.name}}</span>
</div>
</div>
</slot>
</template>
</div>
</template>
<script setup>
// -
import { nextTick, ref } from 'vue'
import { ref, nextTick, useSlots, reactive } from 'vue'
import {Star} from '@element-plus/icons-vue'
const warpRef = ref(null)
const props = defineProps({ test: Boolean })
const sum = ref(0)
// === ===
const trigger = () => {
sum.value++
const slots = useSlots() //
const isSlot = !!Object.keys(slots).length // 使
const props = defineProps({
test: Boolean, // -
def: Boolean, // 使
type: String, // 1- 2-
tback: Number, // -退
tsleep: Number, // -退
})
let iconCache = reactive({list:[]}) //
let wtData = reactive({ // -
like: 0, doubt: 0,
timeout: {like: null, doubt: null}, // -
interval: {like: null, doubt: null}, // -
})
// === type 1: 2: ===
const trigger = async (type, name) => {
if (typeof type == 'string') { name = type; type = 1 } //
if (props.type == 2) { // -
weatherglassModel(type)
} else { // -
iconCache.list.push({
name,
icon: isSlot||props.def ? '' : getRandomIcon(type) //
})
nextTick(() => {
const el = warpRef.value.lastElementChild //
animInit(el)
const tipEl = el.querySelector('.tip') //
// console.log(el)
animInit(el, tipEl, type)
})
}
}
//
const animInit = (el) => {
const animInit = (el, tipEl, type) => {
const { height, width } = el.getBoundingClientRect()
const sumH = warpRef.value.clientHeight
const sumW = warpRef.value.clientWidth
@ -32,15 +77,25 @@ const animInit = (el) => {
let opacity = 0 //
let scale = 0 //
let transform = '' //
let transform2 = '' // -
let right = getRandom(5, maxw, false, true) // -
let isPlus = getRandomBool()?'':'-' // -
let isPlus2 = isPlus ? '' : '-' // --
let rotate = getRandom(0, 60, false, true) // -
let scaleMax = getRandom(0, 1, true, true)+1 // -
let scaleMax = getRandom(0.5, 1.5, true, true)+1 // -
setStatic(el,'position','absolute') // -
setStatic(el, 'right', right, 'px') // -
//
if (type === 1) { //
rotate = getRandom(0, 15, false, true) // -
scaleMax = getRandom(2.5, 3, true, true) // -
}
// console.log('zdg: ', right, isPlus, rotate, scaleMax, maxw)
const amFn = () => { // opacity: 0.5;
// if (bottom == 130) return
// -
if (bottom > maxH) {el.remove();return}
if (bottom > maxH) {el.remove();resetIconCache();return}
// : -
if (bottom < 101 && opacity < 1) opacity = toNumber(opacity + 0.01)
else if (bottom > maxH - 100 && opacity > 0) opacity = toNumber(opacity - 0.01)
@ -49,18 +104,69 @@ const animInit = (el) => {
// 退-
else if (bottom > maxH - (scaleMax/0.1) && scale > 0) scale = toNumber(scale - 0.1)
bottom++
// console.log('zdg: ', scale)
// console.log('zdg: ', scale) rotate(${isPlus2}${rotate}deg)
//
transform = `rotate(${isPlus}${rotate}deg) scale(${scale})`
setStatic(el, 'bottom', bottom, 'px')
setStatic(el, 'opacity', opacity)
setStatic(el, 'transform', transform)
if (!!tipEl && type) {
transform2 = `rotate(${isPlus2}${rotate}deg) scale(${toNumber(1/scale)})`
setStatic(tipEl, 'transform', transform2)
}
requestAnimationFrame(amFn)
}
amFn() //
}
// - 1: 2:
const weatherglassModel = async(type) => {
const field = type == 2 ? 'doubt' : 'like'
wtData[field]++
autoReduce(type)
}
// -
const autoReduce = type => {
const field = type == 2 ? 'doubt' : 'like'
const reduceFn = () => { // : 1s
wtData.interval[field] = setInterval(() => {
wtData[field]--
// -
if (wtData[field] <= 0) {
clearInterval(wtData.interval[field])
wtData[field] = 0
}
}, (props.tback||100))
}
if (!!wtData.timeout[field]) clearInterval(wtData.timeout[field]) //
if (!!wtData.interval[field]) clearInterval(wtData.interval[field]) //
wtData.timeout[field] = setTimeout(() => {
reduceFn()
}, (props.tsleep||20) * 1000)
}
// -
const setStatic = (el, type, val, end) => el.style[type] = val + (end || '')
//
const resetIconCache = () => {
const len = warpRef.value?.children?.length||0
if (!len && iconCache.list.length) iconCache.list = []
}
// -
const getRandomIcon = (type) => {
let iconArr = []
switch (type) {
case 2: // icon-
iconArr = ['yiwen', 'a-yiwen', 'yihuo', 'yiwen-01']
break
default:
iconArr = [ // icon-
'zan10', 'zanping', 'zan9', 'dianzan-red', 'zan8', 'zan11', 'zan7', 'MBEfenggeduosetubiao-xihuan',
'zan6', 'zan-yizan', 'zan5', 'yizan', 'zan4', 'zan3', 'zan2', 'zan1', 'zan'
]
break
}
const ind = getRandom(0, iconArr.length-1)
return iconArr[ind]||''
}
// isFloat isMax
const getRandom = (min, max, isFloat, isMax, pos=2) => {
const maxVal = isMax ? max - min + 1 : max - min
@ -71,11 +177,30 @@ const getRandom = (min, max, isFloat, isMax, pos=2) => {
const getRandomBool = () => Math.random() > 0.5
// -()
const toNumber = (v, pos = 2) => Number(v.toFixed(pos))
//
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
// -
const vTap = {
mounted(el, binding) {
const instance = binding.instance
const fn = binding.arg
const args = binding.value||[]
if (!fn) return
let cleId = null
el.addEventListener('mousedown', () => {
cleId = setInterval(() => {instance[fn](...args)}, 10);
})
el.addEventListener('mouseup', () => {
!!cleId && clearInterval(cleId)
})
}
}
//
defineExpose({ trigger })
</script>
<style lang="scss" scoped>
// -
.c-warp {
position: fixed;
right: 0;
@ -83,5 +208,66 @@ defineExpose({ trigger })
width: 30%;
height: 50%;
pointer-events: none;
.item{
display: inline-block;
.tip{
position: absolute;
padding: 3px 6px;
border-radius: 4px;
background: linear-gradient(90deg, #9fe597, #cce581);
font-size: 12px;
bottom: 0;
right: 0;
width: 65px;
transform-origin: right top;
span{
display: inline-block;
max-width: 100%;
overflow: hidden;
/* text-overflow: ellipsis; */
white-space: nowrap;
cursor: default;
}
&::before{
content: " ";
position: absolute;
width: 10px;
height: 10px;
z-index: -1;
box-sizing: border-box;
background: linear-gradient(45deg, #b2e68d, #bce689);
bottom: -3px;
left: 50%;
transform: translateX(-50%) rotate(45deg);
}
}
}
}
// -
.c-anim {
position: fixed;
// height: 90vh;
// border: 1px solid;
inset: auto auto 3em 1em;
display: flex;
gap: 10px;
align-items: flex-end;
.item{
flex: 1;
border-radius: 3px;
min-width: 15px;
// height: 500px;
&.like{
background-image: linear-gradient(to top, #fef0f0, #f56c6c);
// animation: striped-flow 5s linear infinite;
}
&.doubt{
background-image: linear-gradient(to top, #fdf6ec, #e6a23c);
}
}
}
@keyframes striped-flow {
0%{background-position: 0 500px;}
100%{background-position: 0 0;}
}
</style>

View File

@ -36,6 +36,7 @@ class Drag {
const {cx, cy} = this.getMousePos(e)
this.x = cx
this.y = cy
this.getCurPos() // 被拖拽元素初始坐标
// 手动-触发事件 v-drag-start
this.el.dispatchEvent(new CustomEvent('v-drag-start', {detail:{drag: this}}))
}
@ -85,12 +86,20 @@ class Drag {
}
// 获取移动后坐标
getPos(x, y) {
const w = this.max.w - this.toRound(this.el.clientWidth)
const h = this.max.h - this.toRound(this.el.clientHeight)
// 边界控制:图标元素
// const w = this.max.w - this.toRound(this.el.clientWidth)
// const h = this.max.h - this.toRound(this.el.clientHeight)
// 边界控制:整个工具
const w = this.max.w - this.toRound(this.handle.clientWidth)
const h = this.max.h - this.toRound(this.handle.clientHeight)
x = x < 0 ? 0 : x > w ? w : x
y = y < 0 ? 0 : y > h ? h : y
return { x, y }
}
getCurPos(dom) {
const pos = this[dom||'handle']?.getBoundingClientRect()
this.data = {left:this.toRound(pos.left), top:this.toRound(pos.top)}
}
// 小数转整数
toRound = v => Math.round(v)
}

View File

@ -7,10 +7,10 @@
<side-vue v-ignore @ignore-mounted="sideMouse" @change="sideChange"></side-vue>
<!-- 点赞组件 -->
<upvote-vue ref="upvoteRef"></upvote-vue>
<upvote-vue ref="upvoteRef" type="2"></upvote-vue>
<!-- im-chat 聊天组件 -->
<!-- <im-chat ref="imChatRef" @change="chatChange" /> -->
<im-chat ref="imChatRef" @change="chatChange" />
<!-- 底部工具栏 -->
<div class="tool-bottom-all" @mouseenter="mouseChange(0)" @mouseleave="mouseChange(1)">
@ -20,7 +20,8 @@
<el-image :src="logo" draggable="false" />
</div>
</div>
<div class="tool-btns" v-show="!isFold">
<transition name="a-fade">
<div class="tool-btns" v-if="!isFold">
<el-segmented class="c-btns" v-model="tabActive" :options="btnList" size="large" block
@change="tabChange">
<template #default="{item}">
@ -31,6 +32,7 @@
</template>
</el-segmented>
</div>
</transition>
</div>
</div>
</template>
@ -41,7 +43,7 @@ import { onMounted, ref, reactive, watchEffect } from 'vue'
import { useRoute } from 'vue-router';
import { ElMessageBox, ElMessage, ElLoading } from 'element-plus'
import * as classManageApi from '@/api/classManage'
import logo from '@root/resources/icon.png' // logo
import logo from '@root/resources/logo.png' // logo
import boardVue from './components/board.vue' // -
import sideVue from './components/side.vue' // -
import upvoteVue from './components/upvote.vue' // -
@ -49,8 +51,9 @@ import imChat from './components/imChat.vue' // im-chat-子组件
import vDrag from './directive/drag' // -
import vIgnore from './directive/ignore' // -穿
import { useToolState } from '@/store/modules/tool' // -
import { ipcMsgSend, ipcHandle, ipcMain, ipcMsgInvoke } from '@/utils/tool' //
import { ipcMsgSend, ipcMain, sessionStore } from '@/utils/tool' //
import MsgEnum from '@/plugins/imChat/msgEnum' // -(nuem)
const route = useRoute();
const tabActive = ref('select') //
const isFold = ref(false) //
@ -66,6 +69,8 @@ const classObj = reactive({ // 课程相关
id: route.query.reservId, // id
data: {} //
})
const msgIds = [] // id
const electron = window.electron // electron
const btnList = [ //
{ label: '选择', value: 'select', icon: 'icon-mouse' },
{ label: '画笔', value: 'brush', icon: 'icon-huabi' },
@ -77,11 +82,12 @@ const btnList = [ // 工具栏按钮列表
]
// === ===
onMounted(async() => {
setTimeout(() => {
classManageApi.startClass(classObj.id) // -
// getClassInfo() // ex3
if (!electron) return //
// console.log(sessionStore)
// window.test = sessionStore
// window.test1 = toolStore
getClassInfo() // ex3
resetStatus() // -
}, 200);
})
// ==== ===
@ -89,28 +95,40 @@ onMounted(async() => {
const getClassInfo = async () => {
const { data } = await classManageApi.getClassInfo(classObj.id)
classObj.data = data
// console.log('classObj:', classObj)
if(!data.ex3 || data.ex3 == 'undefined') { //
await imChatRef.value.imChatObj.imChat.createGroup(data.className)
const timGroupId = imChatRef.value.imChatObj.imChat.timGroupId
// id
let timGroupId = data?.ex3 || ''
console.log('获取群ID:', timGroupId)
const chat = await imChatRef.value?.initImChat(timGroupId) // im-chat
if (!timGroupId) timGroupId = chat?.timGroupId
classManageApi.startClass(classObj.id, timGroupId) //
} else { //
console.log('已创建群: ', data.ex3)
imChatRef.value.imChatObj.imChat.timGroupId = data.ex3
// imChatRef.value.imChatObj.imChat.setGroupMsgReceive(data.ex3)
}
}
// tab-change
const tabChange = (val) => {
const bool = !toolStore.isPdfWin && !toolStore.showBoardAll
if(bool) toolStore.showBoardAll = true
// ipcMsgSend('tool-sphere:close')
toolStore.model = val // tab
}
// logo - |
const logoHandle = (e,t) => {
if (Date.now() - dragtime.value < 200) {
isFold.value = !isFold.value
setTimeout(() => {
// :
const dom = document.querySelector('.tool-bottom-all')
const { x } = dom.getBoundingClientRect()
const w = window.innerWidth - (470 || 80)
// if (x > w) dom.style.left = `${w}px`
if (x > w) { //
let left = x
const animatFn = () => {
left-=30
if (left < w) left == w
dom.style.left = `${left}px`
if (left > w) requestAnimationFrame(animatFn)
}
requestAnimationFrame(animatFn)
}
}, 20);
}
}
// -穿
@ -121,17 +139,22 @@ const mouseChange = (bool) => {
setIgnore(resBool)
}
// im-chat: {type, data}
const chatChange = (type, data) => {
const chatChange = (type, data, ...args) => {
if (type == 'createGroup') { // -
console.log('创建群:', data)
!!data && classManageApi.startClass(classObj.id, data)
} else if (type == 'msg') { // im-chat
if (!data) return // msg
if (!data) return // msg message_msg_id
const msgId = (args||[])[0].message_msg_id
const { msgKey:head, msgcontent:msg, senduserid:sendId, msgType } = data
switch(head) {
case MsgEnum.HEADS.MSG_0001:
case MsgEnum.HEADS.MSG_0001: //
case MsgEnum.HEADS.MSG_0002: //
// console.log(':', data)
upvoteRef.value.trigger()
if(msgIds.includes(msgId)) return // -
upvoteRef.value.trigger(head, data.name) // |
if (msgIds.length >= 100) msgIds.shift() //
msgIds.push(msgId) //
break
default:
console.log('未知消息:', data)
@ -146,6 +169,7 @@ const setIgnore = (bool) => {ipcMsgSend('tool-sphere:set:ignore', bool)}
// : |
const resetStatus = () => {
if (toolStore.isToolWin) return // -
ipcMain?.removeHandler('tool-sphere:reset') //
ipcMain?.handle?.('tool-sphere:reset', () => {
setTimeout(() => {
boardVueRef.value.handleMode(tabActive.value)
@ -188,11 +212,11 @@ const sideChange = async o => {
setTimeout(async() => {
// elMsg.close()
toolStore.isToolWin = false
await classManageApi.endClass(route.query.reservId)
await imChatRef.value?.deleteGroup() //
await imChatRef.value?.logout() // 退im
await classManageApi.endClass(route.query.reservId)
ipcMsgSend('tool-sphere:close') //
}, 200);
}, 500);
// isOver.value = false
// setIgnore(true) // -穿
@ -258,4 +282,15 @@ watchEffect(() => {
}
}
}
.a-fade-leave-active,.a-fade-enter-active{
transition: all .3s;
}
.a-fade-enter-from,.a-fade-leave-to{
width: 0;
opacity: 0;
}
.a-fade-enter-to,.a-fade-leave-from{
width: 350px;
opacity: 1;
}
</style>