Compare commits
117 Commits
Author | SHA1 | Date |
---|---|---|
yangws | 8d85ad6ab6 | |
小杨 | 3c0e7777f8 | |
zhengdegang | a73a409776 | |
zdg | b6d1e03201 | |
zdg | 8d8b8d223c | |
zhengdegang | f47f305dc9 | |
zdg | 95fcd2445e | |
zdg | 4af2b5fc3a | |
朱浩 | 91e9468f41 | |
朱浩 | 16100d1ffa | |
yangws | a368925887 | |
小杨 | 9d29238017 | |
朱浩 | 2c90e96c5f | |
朱浩 | 90aafaba10 | |
朱浩 | 1d68bc6534 | |
朱浩 | 088eac287b | |
朱浩 | 934f561dee | |
朱浩 | 1326c5dd02 | |
baigl | ef7fbcfdbe | |
白了个白 | 4af7220d1d | |
白了个白 | db712d9e1f | |
zhangxuelin | a793e67a60 | |
zhangxuelin | 95a80c2b99 | |
白了个白 | 97405bb73b | |
朱浩 | 9c2c31e4b7 | |
朱浩 | 121cff7c2b | |
朱浩 | 2ad1ae4946 | |
朱浩 | f8f0646bde | |
朱浩 | ca6efb4d66 | |
lyc | d1454a288f | |
lyc | 5ff9a5387a | |
yangws | eaca1fe133 | |
小杨 | 8df53373ce | |
lyc | 5ea98048c3 | |
lyc | d1bb8d2b63 | |
lyc | 4ab07d247f | |
yangws | e521b4dac7 | |
小杨 | 04000e7279 | |
zouyf | e1c717eec4 | |
“zouyf” | 8185cc458d | |
lyc | e6c2e264d2 | |
lyc | 5708850be9 | |
朱浩 | afa1fd2f8d | |
lyc | 5d7533e2ab | |
lyc | 250f73cce6 | |
zhangxuelin | 125d360c52 | |
zhangxuelin | dcf6d5b45d | |
zhangxuelin | 07ab1b6a84 | |
lyc | 4e85477a5a | |
lyc | d7c57896da | |
朱浩 | e40acda6ad | |
zhangxuelin | b9f0d76ee4 | |
zhangxuelin | a5be937eb3 | |
朱浩 | 5b05b6a94b | |
zhangxuelin | de0a167cf5 | |
zhangxuelin | 616fb36c55 | |
朱浩 | 336fbb0680 | |
zhangxuelin | 4650c47f70 | |
zhangxuelin | f8f98b400c | |
zhangxuelin | 4c62c109a8 | |
zhangxuelin | a4b1a5bb30 | |
zhangxuelin | cde8f13f8e | |
lyc | 33f4ae42db | |
lyc | 96e71ff45e | |
朱浩 | 38e17585f2 | |
朱浩 | b85b95e817 | |
zhangxuelin | 6575f2e479 | |
zhangxuelin | aee58d2443 | |
zhangxuelin | f9ab056a07 | |
zhangxuelin | f344163e6d | |
zhangxuelin | f47cd1213b | |
lyc | 33d7c8c96c | |
lyc | 3e8f8529fa | |
lyc | 6d1cc7e21b | |
lyc | 5179e6407d | |
朱浩 | 0c3b017a28 | |
白了个白 | 15cbd9c4be | |
zhengdegang | 525d98dc41 | |
zdg | b286dbcce2 | |
zdg | dbaf861bef | |
“zouyf” | cdf8fd2733 | |
“zouyf” | 6629496569 | |
yangws | f4d62410fb | |
小杨 | 01e7dfbc2b | |
朱浩 | 946eb0d072 | |
朱浩 | 510f02a530 | |
yangws | c2a3ffb0a0 | |
小杨 | 8106fb0c41 | |
lyc | 284ae40519 | |
lyc | dc2831c101 | |
lyc | 49facdffa9 | |
baigl | a9f9bb49d5 | |
白了个白 | 9be6648a75 | |
白了个白 | 7c1d669a56 | |
朱浩 | 1132dc2c0d | |
“zouyf” | 66853327cd | |
朱浩 | 2b17cc103d | |
朱浩 | 57caed47dd | |
lyc | b8750bdadd | |
lyc | 586ce134f8 | |
baigl | 518308c277 | |
白了个白 | 912d32bc9c | |
白了个白 | fb428ba5ca | |
lyc | 7be60a3d72 | |
zouyf | ea75329ebd | |
“zouyf” | 7bcf4b718b | |
“zouyf” | 7d1848277e | |
朱浩 | 1814f811d4 | |
朱浩 | b13eb11633 | |
lyc | cd748afb51 | |
lyc | 8119c6c835 | |
baigl | ac03a6ec08 | |
lyc | 367ef474ff | |
lyc | 6579ee1c2d | |
白了个白 | 86ae0fa0cd | |
白了个白 | 9f42f93cb9 | |
lyc | e9bc48963b |
|
@ -1,6 +1,8 @@
|
|||
# 页面标题
|
||||
VITE_APP_TITLE = 文枢课堂
|
||||
|
||||
VITE_APP_ID = 'aix-win-ws'
|
||||
|
||||
# 生产环境配置
|
||||
VITE_APP_ENV = 'production'
|
||||
|
||||
|
|
4
.env.yc
4
.env.yc
|
@ -1,5 +1,7 @@
|
|||
# 页面标题
|
||||
VITE_APP_TITLE = 文枢课堂
|
||||
VITE_APP_TITLE = 永川中小学AI教学系统
|
||||
|
||||
VITE_APP_ID = 'aix-win-ws-yc'
|
||||
|
||||
# 生产环境配置
|
||||
VITE_APP_ENV = 'production'
|
||||
|
|
2
.env.yc2
2
.env.yc2
|
@ -1,6 +1,8 @@
|
|||
# 页面标题
|
||||
VITE_APP_TITLE = 实训教学
|
||||
|
||||
VITE_APP_ID = 'aix-win-ws-yc2'
|
||||
|
||||
# 生产环境配置
|
||||
VITE_APP_ENV = 'production'
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
# 页面标题
|
||||
VITE_APP_TITLE = 育人酉数平台
|
||||
|
||||
VITE_APP_ID = 'aix-win-ws-yy'
|
||||
|
||||
# 生产环境配置
|
||||
VITE_APP_ENV = 'production'
|
||||
|
||||
# AIx融合数字管理系统/生产环境
|
||||
VITE_APP_BASE_API = 'https://prev.ysaix.com:7868/prod-api'
|
||||
|
||||
VITE_APP_DOMAIN = 'prev.ysaix.com'
|
||||
|
||||
VITE_APP_UPLOAD_API = 'https://prev.ysaix.com:7868/prod-api'
|
||||
|
||||
# 是否在打包时开启压缩,支持 gzip 和 brotli
|
||||
VITE_BUILD_COMPRESS = gzip
|
||||
|
||||
VITE_APP_RES_FILE_PATH = 'https://prev.ysaix.com:7868/src/assets/textbook/booktxt/'
|
||||
|
||||
VITE_APP_BUILD_BASE_PATH = 'https://prev.ysaix.com:7868/'
|
||||
|
||||
# websocket 地址
|
||||
VITE_APP_WS_URL = 'wss://prev.ysaix.com:7868'
|
||||
|
||||
# 是否显示开发工具
|
||||
VITE_SHOW_DEV_TOOLS = 'false'
|
|
@ -6,6 +6,11 @@ directories:
|
|||
win:
|
||||
executableName: 文枢课堂
|
||||
icon: resources/logo2.ico
|
||||
target:
|
||||
- target: nsis
|
||||
arch:
|
||||
- x64
|
||||
- ia32
|
||||
files:
|
||||
- '!**/.vscode/*'
|
||||
- '!src/*'
|
||||
|
@ -47,8 +52,8 @@ publish:
|
|||
electronDownload:
|
||||
mirror: https://npmmirror.com/mirrors/electron/
|
||||
# 额外依赖打包到输出目录
|
||||
extraFiles:
|
||||
- from: ./node_modules/im_electron_sdk/lib/
|
||||
to: ./resources
|
||||
filter:
|
||||
- '**/*'
|
||||
#extraFiles:
|
||||
# - from: ./node_modules/im_electron_sdk/lib/
|
||||
# to: ./resources
|
||||
# filter:
|
||||
# - '**/*'
|
||||
|
|
|
@ -13,6 +13,11 @@ asarUnpack:
|
|||
win:
|
||||
executableName: AIx
|
||||
icon: resources/logo2.ico
|
||||
target:
|
||||
- target: nsis
|
||||
arch:
|
||||
- x64
|
||||
- ia32
|
||||
nsis:
|
||||
oneClick: false
|
||||
allowToChangeInstallationDirectory: true
|
||||
|
@ -46,8 +51,8 @@ publish:
|
|||
electronDownload:
|
||||
mirror: https://npmmirror.com/mirrors/electron/
|
||||
# 额外依赖打包到输出目录
|
||||
extraFiles:
|
||||
- from: ./node_modules/im_electron_sdk/lib/
|
||||
to: ./resources
|
||||
filter:
|
||||
- '**/*'
|
||||
#extraFiles:
|
||||
# - from: ./node_modules/im_electron_sdk/lib/
|
||||
# to: ./resources
|
||||
# filter:
|
||||
# - '**/*'
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
appId: com.electron.app.yc
|
||||
productName: 文枢课堂
|
||||
productName: 永川中小学AI教学系统
|
||||
directories:
|
||||
output: dist
|
||||
buildResources: build
|
||||
win:
|
||||
executableName: 文枢课堂
|
||||
executableName: 永川中小学AI教学系统
|
||||
icon: resources/yc-logo.png
|
||||
target:
|
||||
- target: nsis
|
||||
arch:
|
||||
- x64
|
||||
- ia32
|
||||
files:
|
||||
- '!**/.vscode/*'
|
||||
- '!src/*'
|
||||
|
@ -17,7 +22,7 @@ asarUnpack:
|
|||
nsis:
|
||||
oneClick: false
|
||||
allowToChangeInstallationDirectory: true
|
||||
artifactName: ${name}-yc-${version}-setup.${ext}
|
||||
artifactName: ${name}-${version}-setup.${ext}
|
||||
shortcutName: ${productName}
|
||||
uninstallDisplayName: ${productName}
|
||||
createDesktopShortcut: always
|
||||
|
@ -47,8 +52,8 @@ publish:
|
|||
electronDownload:
|
||||
mirror: https://npmmirror.com/mirrors/electron/
|
||||
# 额外依赖打包到输出目录
|
||||
extraFiles:
|
||||
- from: ./node_modules/im_electron_sdk/lib/
|
||||
to: ./resources
|
||||
filter:
|
||||
- '**/*'
|
||||
#extraFiles:
|
||||
# - from: ./node_modules/im_electron_sdk/lib/
|
||||
# to: ./resources
|
||||
# filter:
|
||||
# - '**/*'
|
||||
|
|
|
@ -6,6 +6,11 @@ directories:
|
|||
win:
|
||||
executableName: 实训教学
|
||||
icon: resources/yc-logo.png
|
||||
target:
|
||||
- target: nsis
|
||||
arch:
|
||||
- x64
|
||||
- ia32
|
||||
files:
|
||||
- '!**/.vscode/*'
|
||||
- '!src/*'
|
||||
|
@ -17,7 +22,7 @@ asarUnpack:
|
|||
nsis:
|
||||
oneClick: false
|
||||
allowToChangeInstallationDirectory: true
|
||||
artifactName: ${name}-ycsx-${version}-setup.${ext}
|
||||
artifactName: ${name}-${version}-setup.${ext}
|
||||
shortcutName: ${productName}
|
||||
uninstallDisplayName: ${productName}
|
||||
createDesktopShortcut: always
|
||||
|
@ -47,8 +52,8 @@ publish:
|
|||
electronDownload:
|
||||
mirror: https://npmmirror.com/mirrors/electron/
|
||||
# 额外依赖打包到输出目录
|
||||
extraFiles:
|
||||
- from: ./node_modules/im_electron_sdk/lib/
|
||||
to: ./resources
|
||||
filter:
|
||||
- '**/*'
|
||||
#extraFiles:
|
||||
# - from: ./node_modules/im_electron_sdk/lib/
|
||||
# to: ./resources
|
||||
# filter:
|
||||
# - '**/*'
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
appId: com.electron.app.yy
|
||||
productName: 育人酉数平台
|
||||
directories:
|
||||
output: dist
|
||||
buildResources: build
|
||||
win:
|
||||
executableName: 育人酉数平台
|
||||
icon: resources/yy-logo.png
|
||||
target:
|
||||
- target: nsis
|
||||
arch:
|
||||
- x64
|
||||
- ia32
|
||||
files:
|
||||
- '!**/.vscode/*'
|
||||
- '!src/*'
|
||||
- '!electron.vite.config.{js,ts,mjs,cjs}'
|
||||
- '!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}'
|
||||
- '!{.env,.env.*,.npmrc,pnpm-lock.yaml}'
|
||||
asarUnpack:
|
||||
- resources/**
|
||||
nsis:
|
||||
oneClick: false
|
||||
allowToChangeInstallationDirectory: true
|
||||
artifactName: ${name}-${version}-setup.${ext}
|
||||
shortcutName: ${productName}
|
||||
uninstallDisplayName: ${productName}
|
||||
createDesktopShortcut: always
|
||||
mac:
|
||||
entitlementsInherit: build/entitlements.mac.plist
|
||||
extendInfo:
|
||||
- NSCameraUsageDescription: Application requests access to the device's camera.
|
||||
- NSMicrophoneUsageDescription: Application requests access to the device's microphone.
|
||||
- NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
|
||||
- NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
|
||||
notarize: false
|
||||
dmg:
|
||||
artifactName: ${name}-${version}.${ext}
|
||||
linux:
|
||||
target:
|
||||
- AppImage
|
||||
- snap
|
||||
- deb
|
||||
maintainer: electronjs.org
|
||||
category: Utility
|
||||
appImage:
|
||||
artifactName: ${name}-${version}.${ext}
|
||||
npmRebuild: false
|
||||
publish:
|
||||
provider: generic
|
||||
url: https://prev.ysaix.com:7868/src/assets/smarttalkyy/
|
||||
electronDownload:
|
||||
mirror: https://npmmirror.com/mirrors/electron/
|
||||
# 额外依赖打包到输出目录
|
||||
#extraFiles:
|
||||
# - from: ./node_modules/im_electron_sdk/lib/
|
||||
# to: ./resources
|
||||
# filter:
|
||||
# - '**/*'
|
|
@ -13,6 +13,11 @@ asarUnpack:
|
|||
win:
|
||||
executableName: AIx
|
||||
icon: resources/logo2.ico
|
||||
target:
|
||||
- target: nsis
|
||||
arch:
|
||||
- x64
|
||||
- ia32
|
||||
nsis:
|
||||
oneClick: false
|
||||
allowToChangeInstallationDirectory: true
|
||||
|
@ -46,8 +51,8 @@ publish:
|
|||
electronDownload:
|
||||
mirror: https://npmmirror.com/mirrors/electron/
|
||||
# 额外依赖打包到输出目录
|
||||
extraFiles:
|
||||
- from: ./node_modules/im_electron_sdk/lib/
|
||||
to: ./resources
|
||||
filter:
|
||||
- '**/*'
|
||||
#extraFiles:
|
||||
# - from: ./node_modules/im_electron_sdk/lib/
|
||||
# to: ./resources
|
||||
# filter:
|
||||
# - '**/*'
|
||||
|
|
|
@ -35,7 +35,7 @@ export default defineConfig({
|
|||
target: 'http://27.128.240.72:7865',
|
||||
// target: 'https://prev.ysaix.com:7868/prod-api/',
|
||||
// target: 'http://36.134.181.164:7863',
|
||||
// target: 'http://192.168.0.102:7865',
|
||||
// target: 'http://192.168.2.237:7865',
|
||||
changeOrigin: true,
|
||||
rewrite: (p) => p.replace(/^\/dev-api/, '')
|
||||
},
|
||||
|
|
17
package.json
17
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "aix-win-ws",
|
||||
"version": "2.5.11",
|
||||
"version": "2.5.16",
|
||||
"description": "",
|
||||
"main": "./out/main/index.js",
|
||||
"author": "上海交大重庆人工智能研究院",
|
||||
|
@ -10,14 +10,15 @@
|
|||
"lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix",
|
||||
"start": "electron-vite preview",
|
||||
"dev": "electron-vite dev",
|
||||
"build": "electron-vite build",
|
||||
"postinstall": "electron-builder install-app-deps",
|
||||
"build:unpack": "npm run build && electron-builder --dir",
|
||||
"build:dev": "npm run build && electron-builder --win --config ./electron-builder-test.yml",
|
||||
"build:test": "electron-vite build --mode test && electron-builder --win --config ./electron-builder.yml",
|
||||
"build:prod": "electron-vite build --mode production && electron-builder --win --config ./electron-builder-prod.yml",
|
||||
"build:yc": "electron-vite build --mode yc && electron-builder --win --config ./electron-builder-yc.yml",
|
||||
"build:yc2": "electron-vite build --mode yc2 && electron-builder --win --config ./electron-builder-yc2.yml",
|
||||
"build:test": "node updatePackageJsonName.js && electron-vite build --mode test && electron-builder --win --config ./electron-builder.yml",
|
||||
"build:prod": "node updatePackageJsonName.js && electron-vite build --mode production && electron-builder --win --config ./electron-builder-prod.yml --win",
|
||||
"build:prod32": "node updatePackageJsonName.js && electron-vite build --mode production && electron-builder --win --config ./electron-builder-prod.yml --win --ia32",
|
||||
"build:yc": "node updatePackageJsonName.js && electron-vite build --mode yc && electron-builder --win --config ./electron-builder-yc.yml",
|
||||
"build:yc2": "node updatePackageJsonName.js && electron-vite build --mode yc2 && electron-builder --win --config ./electron-builder-yc2.yml",
|
||||
"build:yy": "node updatePackageJsonName.js && electron-vite build --mode yy && electron-builder --win --config ./electron-builder-yy.yml",
|
||||
"build:lt": "electron-vite build --mode lt && electron-builder --win --config ./electron-builder-lt.yml",
|
||||
"build:mac": "electron-vite build --mode production && electron-builder --mac --config ./electron-builder-prod.yml",
|
||||
"build:linux": "npm run build && electron-builder --linux"
|
||||
|
@ -36,12 +37,14 @@
|
|||
"@electron/remote": "^2.1.2",
|
||||
"@element-plus/icons-vue": "^2.3.1",
|
||||
"@icon-park/vue-next": "^1.4.2",
|
||||
"@kangc/v-md-editor": "^2.3.18",
|
||||
"@tinymce/tinymce-vue": "5.1.1",
|
||||
"@vitejs/plugin-vue-jsx": "^4.0.0",
|
||||
"@vue-office/docx": "^1.6.2",
|
||||
"@vue-office/excel": "^1.7.11",
|
||||
"@vue-office/pdf": "^2.0.2",
|
||||
"@vueuse/core": "^10.11.0",
|
||||
"aix-plugins-aitools": "^1.1.5",
|
||||
"animate.css": "^4.1.1",
|
||||
"circular-json": "^0.5.9",
|
||||
"clipboard": "^2.0.11",
|
||||
|
@ -53,14 +56,12 @@
|
|||
"electron-log": "^5.1.7",
|
||||
"electron-store": "8.0.0",
|
||||
"electron-updater": "^6.1.7",
|
||||
"element-china-area-data": "^6.1.0",
|
||||
"element-plus": "^2.8.0",
|
||||
"fabric": "^5.3.0",
|
||||
"file-saver": "^2.0.5",
|
||||
"hfmath": "^0.0.2",
|
||||
"html-to-image": "^1.11.11",
|
||||
"html2canvas": "^1.4.1",
|
||||
"im_electron_sdk": "^8.0.5904",
|
||||
"js-cookie": "^3.0.5",
|
||||
"jsencrypt": "^3.3.2",
|
||||
"jsondiffpatch": "0.6.0",
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 107 KiB |
|
@ -359,6 +359,11 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
|||
|
||||
//下载文件
|
||||
ipcMain.on('download-file-default', (e, { url, fileName }) => {
|
||||
console.log(url, fileName)
|
||||
if (!url) {
|
||||
e.reply('download-file-default' + fileName, false)
|
||||
return;
|
||||
}
|
||||
createFolder('selfFile')
|
||||
.then(async () => {
|
||||
const browserWindow = BrowserWindow.getFocusedWindow()
|
||||
|
|
|
@ -4,7 +4,7 @@ import { electronApp, optimizer, is } from '@electron-toolkit/utils'
|
|||
import icon from '../../resources/icon.png?asset'
|
||||
import File from './file'
|
||||
import Logger from './logger' // 日志封装
|
||||
import chat from './chat' // chat封装
|
||||
// import chat from './chat' // chat封装
|
||||
import Store from './store' // Store封装
|
||||
import updateInit from './update'
|
||||
|
||||
|
@ -42,12 +42,28 @@ if(!gotTheLock){
|
|||
}
|
||||
})
|
||||
}
|
||||
let logoIco = import.meta.env.MODE==='yc'||import.meta.env.MODE==='yc2'?'../../resources/yc-logo.png':'../../resources/logo2.ico'
|
||||
let logoIco = ""
|
||||
|
||||
switch (import.meta.env.MODE) {
|
||||
case 'yc':
|
||||
logoIco = '../../resources/yc-logo.png'
|
||||
break
|
||||
case 'yc2':
|
||||
logoIco = '../../resources/yc-logo.png'
|
||||
break
|
||||
case 'yy':
|
||||
logoIco = '../../resources/yy-logo.png'
|
||||
break
|
||||
default:
|
||||
logoIco = '../../resources/logo2.ico'
|
||||
break
|
||||
}
|
||||
//登录窗口
|
||||
function createLoginWindow() {
|
||||
if (loginWindow) return
|
||||
loginWindow = new BrowserWindow({
|
||||
width: import.meta.env.MODE==='yc'||import.meta.env.MODE==='yc2'?1060:888,
|
||||
// width: import.meta.env.MODE==='yc'||import.meta.env.MODE==='yc2'?1060:888,
|
||||
width: 1060,
|
||||
height: 520,
|
||||
show: false,
|
||||
frame: false,
|
||||
|
@ -244,6 +260,13 @@ app.on('ready', () => {
|
|||
loginWindow.show()
|
||||
loginWindow.focus()
|
||||
})
|
||||
// 打印窗口
|
||||
ipcMain.on('printPage', (event, printOptions) => {
|
||||
//console.log("ipcMain-print-page")
|
||||
mainWindow.webContents.print(printOptions, (success, failureReason) => {
|
||||
if (!success) console.error(failureReason);
|
||||
});
|
||||
});
|
||||
|
||||
//打开作业窗口
|
||||
ipcMain.on('openWindow', (e, data) => {
|
||||
|
@ -270,14 +293,14 @@ app.on('window-all-closed', () => {
|
|||
|
||||
// 监听全局事件
|
||||
function handleAll() {
|
||||
const chatInstance = chat.initialize() // im-chat 实例
|
||||
// const chatInstance = chat.initialize() // im-chat 实例
|
||||
// 新窗口创建-监听
|
||||
ipcMain.handle('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
|
||||
console.log(`主进程 [${type}]: 窗口注册-远程代理-完毕(${Date.now()})`)
|
||||
})
|
||||
// 用于监听-状态管理变化-同步所有窗口
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -8,12 +8,13 @@
|
|||
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 * blob: data:; frame-src 'self' *; default-src 'self' https://wzyzoss.eos-chongqing-3.cmecloud.cn/; script-src 'self' 'unsafe-eval' http://www.wiris.net 'unsafe-inline'; style-src 'self' 'unsafe-inline' http://www.wiris.net; media-src * blob:;img-src * 'self' data: blob:;font-src 'self' http://www.wiris.net;" />
|
||||
<meta http-equiv="Content-Security-Policy" content="connect-src * blob: data:; frame-src 'self' *; default-src 'self' https://wzyzoss.eos-chongqing-3.cmecloud.cn/; script-src 'self' 'unsafe-eval' http://www.wiris.net 'unsafe-inline'; script-src-elem 'self' https://sdk.amazonaws.com; style-src 'self' 'unsafe-inline' http://www.wiris.net; media-src * blob:;img-src * 'self' data: blob:;font-src 'self' http://www.wiris.net data:;" />
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<!-- <script src="https://sdk.amazonaws.com/js/aws-sdk-2.100.0.min.js"></script>-->
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<svg style="width: 1em;height: 1em;vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6511">
|
||||
<path d="M512 34.133333c263.466667 0 477.866667 214.4 477.866667 477.866667S775.466667 989.866667 512 989.866667 34.133333 775.466667 34.133333 512 248.533333 34.133333 512 34.133333M512 0C229.333333 0 0 229.333333 0 512s229.333333 512 512 512 512-229.333333 512-512S794.666667 0 512 0z" fill="#87C1FF" p-id="6512"></path><path d="M505.173333 611.62666667c100.053333 0 181.333333-80.64 181.333334-180.053333 0-99.2-81.28-180.053333-181.333334-180.053334-100.053333 0-181.333333 80.64-181.333333 180.053334s81.28 180.053333 181.333333 180.053333zM579.84 661.54666667h-135.893333c-126.293333 0-229.12 102.4-229.12 228.053333v13.44c0 65.706667 101.12 65.706667 229.12 65.706667h135.893333c122.88 0 229.12 0 229.12-65.706667v-13.44c0-125.653333-102.826667-228.053333-229.12-228.053333z" fill="#87C1FF" p-id="6513"></path>
|
||||
</svg>
|
After Width: | Height: | Size: 1006 B |
File diff suppressed because one or more lines are too long
|
@ -38,12 +38,12 @@ export class Classcourse {
|
|||
if (isCourse) {
|
||||
// 连接socket
|
||||
ChatWs.id = classcourse.timgroupid // 群组id
|
||||
if (!ChatWs.ws) {
|
||||
ChatWs.init().then(_ => {
|
||||
isPublic && ChatWs.sendMsg('open', {id: classcourse.id})
|
||||
// isPublic && console.log('socket-开课消息-已发送')
|
||||
})
|
||||
}
|
||||
// if (!ChatWs.ws) {
|
||||
// ChatWs.init().then(_ => {
|
||||
// isPublic && ChatWs.sendMsg('open', {id: classcourse.id})
|
||||
// // isPublic && console.log('socket-开课消息-已发送')
|
||||
// })
|
||||
// }
|
||||
this.classcourse = classcourse // 课堂信息
|
||||
this.id = classcourse.id // 课堂id
|
||||
// 如果课堂信息有paging,则更新当前页码
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import { ref } from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { parse, type Shape, type Element, type ChartItem } from 'pptxtojson'
|
||||
// import { parse, type Shape, type Element, type ChartItem } from 'pptxtojson'
|
||||
// import { parse, utils, fill as fillUtil } from '@/plugins/pptTojson'
|
||||
import { parse, fill as fillUtil, type Shape, type Element, type ChartItem } from '@/plugins/pptTojson'
|
||||
import { nanoid } from 'nanoid'
|
||||
import { useSlidesStore } from '../store'
|
||||
import { decrypt } from '../utils/crypto'
|
||||
|
@ -9,6 +11,7 @@ import useAddSlidesOrElements from '../hooks/useAddSlidesOrElements'
|
|||
import useSlideHandler from '../hooks/useSlideHandler'
|
||||
import message from '../utils/message'
|
||||
import { getSvgPathRange } from '../utils/svgPathParser'
|
||||
import { calculatePathDimensions } from '@/utils/ppt/svgUtils'
|
||||
import type {
|
||||
Slide,
|
||||
TableCellStyle,
|
||||
|
@ -75,57 +78,18 @@ const parseLineElement = (el: Shape) => {
|
|||
|
||||
return data
|
||||
}
|
||||
export default () => {
|
||||
|
||||
const exporting = ref(false)
|
||||
|
||||
// 导入pptist文件
|
||||
const importSpecificFile = (files: FileList, cover = false) => {
|
||||
const file = files[0]
|
||||
|
||||
const reader = new FileReader()
|
||||
reader.addEventListener('load', () => {
|
||||
// PPT json二次加工处理
|
||||
const parsePptJsonSlides = (slides: Slide[]|any, zip) => {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
const slides = JSON.parse(decrypt(reader.result as string))
|
||||
if (cover) {
|
||||
slidesStore.updateSlideIndex(0)
|
||||
slidesStore.setSlides(slides)
|
||||
}
|
||||
else if (isEmptySlide.value) slidesStore.setSlides(slides)
|
||||
else addSlidesFromData(slides)
|
||||
}
|
||||
catch {
|
||||
message.error('无法正确读取 / 解析该文件')
|
||||
}
|
||||
})
|
||||
reader.readAsText(file)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 导入PPTX文件
|
||||
const importPPTXFile = (files: FileList) => {
|
||||
const file = files[0]
|
||||
if (!file) return
|
||||
|
||||
exporting.value = true
|
||||
|
||||
const shapeList: ShapePoolItem[] = []
|
||||
for (const item of SHAPE_LIST) {
|
||||
shapeList.push(...item.children)
|
||||
}
|
||||
|
||||
const reader = new FileReader()
|
||||
reader.onload = async e => {
|
||||
const json = await parse(e.target!.result as ArrayBuffer)
|
||||
|
||||
const ratio = 96 / 72
|
||||
const width = json.size.width
|
||||
|
||||
slidesStore.setViewportSize(width * ratio)
|
||||
|
||||
const slides: Slide[] = []
|
||||
for (const item of json.slides) {
|
||||
const newSlides: Slide[] = []
|
||||
for (const item of slides) {
|
||||
const { type, value } = item.fill
|
||||
let background: SlideBackground
|
||||
if (type === 'image') {
|
||||
|
@ -163,7 +127,7 @@ export default () => {
|
|||
background,
|
||||
}
|
||||
|
||||
const parseElements = (elements: Element[]) => {
|
||||
const parseElements = async (elements: Element[]) => {
|
||||
for (const el of elements) {
|
||||
const originWidth = el.width || 1
|
||||
const originHeight = el.height || 1
|
||||
|
@ -219,6 +183,7 @@ export default () => {
|
|||
rotate: el.rotate,
|
||||
flipH: el.isFlipH,
|
||||
flipV: el.isFlipV,
|
||||
zipPath: el.zipPath,
|
||||
})
|
||||
}
|
||||
else if (el.type === 'audio') {
|
||||
|
@ -235,6 +200,7 @@ export default () => {
|
|||
color: theme.value.themeColor,
|
||||
loop: false,
|
||||
autoplay: false,
|
||||
zipPath: el.zipPath,
|
||||
})
|
||||
}
|
||||
else if (el.type === 'video') {
|
||||
|
@ -248,6 +214,7 @@ export default () => {
|
|||
top: el.top,
|
||||
rotate: 0,
|
||||
autoplay: false,
|
||||
zipPath: el.zipPath,
|
||||
})
|
||||
}
|
||||
else if (el.type === 'shape') {
|
||||
|
@ -325,6 +292,34 @@ export default () => {
|
|||
element.viewBox = [maxX || originWidth, maxY || originHeight]
|
||||
}
|
||||
}
|
||||
// auth: zdg
|
||||
if (el.fill) {
|
||||
const { type, ...opt } = el.fill
|
||||
if (type === 'gradient') { // 线性渐变色
|
||||
element.gradient = {
|
||||
type: 'linear',
|
||||
colors: opt.colors.map(item => ({
|
||||
...item,
|
||||
pos: parseInt(item.pos),
|
||||
})),
|
||||
rotate: opt.rot,
|
||||
}
|
||||
} else if (type == 'image') { // 背景图填充
|
||||
const pathPos = calculatePathDimensions(element.path)
|
||||
const url = opt.picBase64 || (!!zip ? await fillUtil.getPicFillBase64(opt.zipPath, zip) : '')
|
||||
element.gradient = {
|
||||
type: 'image',
|
||||
image: {
|
||||
src: url,
|
||||
width: opt.w||el.width,
|
||||
height: opt.h||el.height,
|
||||
path_W: Math.round(pathPos.width), // 获取path 的宽高
|
||||
path_h: Math.round(pathPos.height), // 获取path 的宽高
|
||||
...opt
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (element.path) slide.elements.push(element)
|
||||
}
|
||||
|
@ -468,18 +463,91 @@ export default () => {
|
|||
})
|
||||
}
|
||||
else if (el.type === 'group' || el.type === 'diagram') {
|
||||
const elements = el.elements.map(_el => ({
|
||||
const elements = el.elements.map(_el => {
|
||||
const isGroup = el.type === 'group' // 子级是否为分组
|
||||
const isFlipH = !!(_el.isFlipH ^ el.isFlipH) // 水平翻转(分组有值进行异或运算)
|
||||
const isFlipV = !!(_el.isFlipV ^ el.isFlipV) // 垂直翻转(分组有值进行异或运算)
|
||||
const isPleft = el.isFlipH_def // 是否父级翻转-改变子元素坐标left
|
||||
const isPtop = el.isFlipV_def // 是否父级翻转-改变子元素坐标top
|
||||
const left = originLeft + (isPleft ? originWidth - _el.left - _el.width : _el.left)
|
||||
const top = originTop + (isPtop ? originHeight - _el.top - _el.height : _el.top)
|
||||
return {
|
||||
..._el,
|
||||
left: _el.left + originLeft,
|
||||
top: _el.top + originTop,
|
||||
}))
|
||||
parseElements(elements)
|
||||
left,
|
||||
top,
|
||||
isFlipH,
|
||||
isFlipV,
|
||||
isFlipH_def: _el.isFlipH, // 保留默认
|
||||
isFlipV_def: _el.isFlipV, // 保留默认
|
||||
}
|
||||
})
|
||||
await parseElements(elements)
|
||||
}
|
||||
}
|
||||
}
|
||||
parseElements(item.elements)
|
||||
slides.push(slide)
|
||||
// 设置默认翻转默认属性
|
||||
item.elements.forEach(o => { o.isFlipH_def = o.isFlipH; o.isFlipV_def = o.isFlipV })
|
||||
item.bgElements.forEach(o => { o.isFlipH_def = o.isFlipH; o.isFlipV_def = o.isFlipV })
|
||||
item.bgElements.length && await parseElements(item.bgElements) // 加载当前幻灯片对应的母版
|
||||
item.elements.length && await parseElements(item.elements) // 加载当前幻灯片
|
||||
newSlides.push(slide)
|
||||
}
|
||||
resolve(newSlides)
|
||||
} catch (error) {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export default () => {
|
||||
|
||||
const exporting = ref(false)
|
||||
|
||||
// 导入pptist文件
|
||||
const importSpecificFile = (files: FileList, cover = false) => {
|
||||
const file = files[0]
|
||||
|
||||
const reader = new FileReader()
|
||||
reader.addEventListener('load', () => {
|
||||
try {
|
||||
const slides = JSON.parse(decrypt(reader.result as string))
|
||||
if (cover) {
|
||||
slidesStore.updateSlideIndex(0)
|
||||
slidesStore.setSlides(slides)
|
||||
}
|
||||
else if (isEmptySlide.value) slidesStore.setSlides(slides)
|
||||
else addSlidesFromData(slides)
|
||||
}
|
||||
catch {
|
||||
message.error('无法正确读取 / 解析该文件')
|
||||
}
|
||||
})
|
||||
reader.readAsText(file)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 导入PPTX文件
|
||||
const importPPTXFile = (files: FileList) => {
|
||||
const file = files[0]
|
||||
if (!file) return
|
||||
|
||||
exporting.value = true
|
||||
|
||||
const shapeList: ShapePoolItem[] = []
|
||||
for (const item of SHAPE_LIST) {
|
||||
shapeList.push(...item.children)
|
||||
}
|
||||
|
||||
const reader = new FileReader()
|
||||
reader.onload = async e => {
|
||||
const json = await parse(e.target!.result as ArrayBuffer)
|
||||
|
||||
const ratio = 96 / 72
|
||||
const width = json.size.width
|
||||
slidesStore.setViewportSize(width * ratio)
|
||||
// json数据二次加工
|
||||
const slides = await parsePptJsonSlides(json.slides, json.zip)
|
||||
slidesStore.updateSlideIndex(0)
|
||||
slidesStore.setSlides(slides)
|
||||
exporting.value = false
|
||||
|
@ -529,7 +597,9 @@ export const PPTXFileToJson = (data: File|ArrayBuffer) => {
|
|||
}
|
||||
|
||||
// 开始解析
|
||||
const json = await parse(fileArrayBuffer)
|
||||
const json = await parse(fileArrayBuffer).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
|
||||
const ratio = 96 / 72
|
||||
const width = json.size.width
|
||||
|
@ -537,365 +607,7 @@ export const PPTXFileToJson = (data: File|ArrayBuffer) => {
|
|||
resData.def = json // 保留原始数据
|
||||
resData.width = width * ratio
|
||||
resData.ratio = slidesStore.viewportRatio
|
||||
|
||||
const slides: Slide[] = []
|
||||
for (const item of json.slides) {
|
||||
const { type, value } = item.fill
|
||||
let background: SlideBackground
|
||||
if (type === 'image') {
|
||||
background = {
|
||||
type: 'image',
|
||||
image: {
|
||||
src: value.picBase64,
|
||||
size: 'cover',
|
||||
},
|
||||
}
|
||||
}
|
||||
else if (type === 'gradient') {
|
||||
background = {
|
||||
type: 'gradient',
|
||||
gradient: {
|
||||
type: 'linear',
|
||||
colors: value.colors.map(item => ({
|
||||
...item,
|
||||
pos: parseInt(item.pos),
|
||||
})),
|
||||
rotate: value.rot,
|
||||
},
|
||||
}
|
||||
}
|
||||
else {
|
||||
background = {
|
||||
type: 'solid',
|
||||
color: value,
|
||||
}
|
||||
}
|
||||
|
||||
const slide: Slide = {
|
||||
id: nanoid(10),
|
||||
elements: [],
|
||||
background,
|
||||
}
|
||||
|
||||
const parseElements = (elements: Element[]) => {
|
||||
for (const el of elements) {
|
||||
const originWidth = el.width || 1
|
||||
const originHeight = el.height || 1
|
||||
const originLeft = el.left
|
||||
const originTop = el.top
|
||||
|
||||
el.width = el.width * ratio
|
||||
el.height = el.height * ratio
|
||||
el.left = el.left * ratio
|
||||
el.top = el.top * ratio
|
||||
|
||||
if (el.type === 'text') {
|
||||
const textEl: PPTTextElement = {
|
||||
type: 'text',
|
||||
id: nanoid(10),
|
||||
width: el.width,
|
||||
height: el.height,
|
||||
left: el.left,
|
||||
top: el.top,
|
||||
rotate: el.rotate,
|
||||
defaultFontName: theme.value.fontName,
|
||||
defaultColor: theme.value.fontColor,
|
||||
content: convertFontSizePtToPx(el.content, ratio),
|
||||
lineHeight: 1,
|
||||
outline: {
|
||||
color: el.borderColor,
|
||||
width: el.borderWidth,
|
||||
style: el.borderType,
|
||||
},
|
||||
fill: el.fillColor,
|
||||
vertical: el.isVertical,
|
||||
}
|
||||
if (el.shadow) {
|
||||
textEl.shadow = {
|
||||
h: el.shadow.h * ratio,
|
||||
v: el.shadow.v * ratio,
|
||||
blur: el.shadow.blur * ratio,
|
||||
color: el.shadow.color,
|
||||
}
|
||||
}
|
||||
slide.elements.push(textEl)
|
||||
}
|
||||
else if (el.type === 'image') {
|
||||
slide.elements.push({
|
||||
type: 'image',
|
||||
id: nanoid(10),
|
||||
src: el.src,
|
||||
width: el.width,
|
||||
height: el.height,
|
||||
left: el.left,
|
||||
top: el.top,
|
||||
fixedRatio: true,
|
||||
rotate: el.rotate,
|
||||
flipH: el.isFlipH,
|
||||
flipV: el.isFlipV,
|
||||
})
|
||||
}
|
||||
else if (el.type === 'audio') {
|
||||
slide.elements.push({
|
||||
type: 'audio',
|
||||
id: nanoid(10),
|
||||
src: el.blob,
|
||||
width: el.width,
|
||||
height: el.height,
|
||||
left: el.left,
|
||||
top: el.top,
|
||||
rotate: 0,
|
||||
fixedRatio: false,
|
||||
color: theme.value.themeColor,
|
||||
loop: false,
|
||||
autoplay: false,
|
||||
})
|
||||
}
|
||||
else if (el.type === 'video') {
|
||||
slide.elements.push({
|
||||
type: 'video',
|
||||
id: nanoid(10),
|
||||
src: (el.blob || el.src)!,
|
||||
width: el.width,
|
||||
height: el.height,
|
||||
left: el.left,
|
||||
top: el.top,
|
||||
rotate: 0,
|
||||
autoplay: false,
|
||||
})
|
||||
}
|
||||
else if (el.type === 'shape') {
|
||||
if (el.shapType === 'line' || /Connector/.test(el.shapType)) {
|
||||
// 从返回对象中解构出 xx 函数并调用
|
||||
const lineElement = parseLineElement(el)
|
||||
slide.elements.push(lineElement)
|
||||
}
|
||||
else {
|
||||
const shape = shapeList.find(item => item.pptxShapeType === el.shapType)
|
||||
|
||||
const vAlignMap: { [key: string]: ShapeTextAlign } = {
|
||||
'mid': 'middle',
|
||||
'down': 'bottom',
|
||||
'up': 'top',
|
||||
}
|
||||
|
||||
const element: PPTShapeElement = {
|
||||
type: 'shape',
|
||||
id: nanoid(10),
|
||||
width: el.width,
|
||||
height: el.height,
|
||||
left: el.left,
|
||||
top: el.top,
|
||||
viewBox: [200, 200],
|
||||
path: 'M 0 0 L 200 0 L 200 200 L 0 200 Z',
|
||||
fill: el.fillColor || 'none',
|
||||
fixedRatio: false,
|
||||
rotate: el.rotate,
|
||||
outline: {
|
||||
color: el.borderColor,
|
||||
width: el.borderWidth,
|
||||
style: el.borderType,
|
||||
},
|
||||
text: {
|
||||
content: convertFontSizePtToPx(el.content, ratio),
|
||||
defaultFontName: theme.value.fontName,
|
||||
defaultColor: theme.value.fontColor,
|
||||
align: vAlignMap[el.vAlign] || 'middle',
|
||||
},
|
||||
flipH: el.isFlipH,
|
||||
flipV: el.isFlipV,
|
||||
}
|
||||
if (el.shadow) {
|
||||
element.shadow = {
|
||||
h: el.shadow.h * ratio,
|
||||
v: el.shadow.v * ratio,
|
||||
blur: el.shadow.blur * ratio,
|
||||
color: el.shadow.color,
|
||||
}
|
||||
}
|
||||
|
||||
if (shape) {
|
||||
element.path = shape.path
|
||||
element.viewBox = shape.viewBox
|
||||
|
||||
if (shape.pathFormula) {
|
||||
element.pathFormula = shape.pathFormula
|
||||
element.viewBox = [el.width, el.height]
|
||||
|
||||
const pathFormula = SHAPE_PATH_FORMULAS[shape.pathFormula]
|
||||
if ('editable' in pathFormula && pathFormula.editable) {
|
||||
element.path = pathFormula.formula(el.width, el.height, pathFormula.defaultValue)
|
||||
element.keypoints = pathFormula.defaultValue
|
||||
}
|
||||
else element.path = pathFormula.formula(el.width, el.height)
|
||||
}
|
||||
}
|
||||
if (el.shapType === 'custom') {
|
||||
if (el.path!.indexOf('NaN') !== -1) element.path = ''
|
||||
else {
|
||||
element.special = true
|
||||
element.path = el.path!
|
||||
|
||||
const { maxX, maxY } = getSvgPathRange(element.path)
|
||||
element.viewBox = [maxX || originWidth, maxY || originHeight]
|
||||
}
|
||||
}
|
||||
|
||||
if (element.path) slide.elements.push(element)
|
||||
}
|
||||
}
|
||||
else if (el.type === 'table') {
|
||||
const row = el.data.length
|
||||
const col = el.data[0].length
|
||||
|
||||
const style: TableCellStyle = {
|
||||
fontname: theme.value.fontName,
|
||||
color: theme.value.fontColor,
|
||||
}
|
||||
const data: TableCell[][] = []
|
||||
for (let i = 0; i < row; i++) {
|
||||
const rowCells: TableCell[] = []
|
||||
for (let j = 0; j < col; j++) {
|
||||
const cellData = el.data[i][j]
|
||||
|
||||
let textDiv: HTMLDivElement | null = document.createElement('div')
|
||||
textDiv.innerHTML = cellData.text
|
||||
const p = textDiv.querySelector('p')
|
||||
const align = p?.style.textAlign || 'left'
|
||||
|
||||
const span = textDiv.querySelector('span')
|
||||
const fontsize = span?.style.fontSize ? (parseInt(span?.style.fontSize) * ratio).toFixed(1) + 'px' : ''
|
||||
const fontname = span?.style.fontFamily || ''
|
||||
const color = span?.style.color || cellData.fontColor
|
||||
|
||||
rowCells.push({
|
||||
id: nanoid(10),
|
||||
colspan: cellData.colSpan || 1,
|
||||
rowspan: cellData.rowSpan || 1,
|
||||
text: textDiv.innerText,
|
||||
style: {
|
||||
...style,
|
||||
align: ['left', 'right', 'center'].includes(align) ? (align as 'left' | 'right' | 'center') : 'left',
|
||||
fontsize,
|
||||
fontname,
|
||||
color,
|
||||
bold: cellData.fontBold,
|
||||
backcolor: cellData.fillColor,
|
||||
},
|
||||
})
|
||||
textDiv = null
|
||||
}
|
||||
data.push(rowCells)
|
||||
}
|
||||
|
||||
const colWidths: number[] = new Array(col).fill(1 / col)
|
||||
|
||||
slide.elements.push({
|
||||
type: 'table',
|
||||
id: nanoid(10),
|
||||
width: el.width,
|
||||
height: el.height,
|
||||
left: el.left,
|
||||
top: el.top,
|
||||
colWidths,
|
||||
rotate: 0,
|
||||
data,
|
||||
outline: {
|
||||
width: el.borderWidth || 2,
|
||||
style: el.borderType,
|
||||
color: el.borderColor || '#eeece1',
|
||||
},
|
||||
cellMinHeight: 36,
|
||||
})
|
||||
}
|
||||
else if (el.type === 'chart') {
|
||||
let labels: string[]
|
||||
let legends: string[]
|
||||
let series: number[][]
|
||||
|
||||
if (el.chartType === 'scatterChart' || el.chartType === 'bubbleChart') {
|
||||
labels = el.data[0].map((item, index) => `坐标${index + 1}`)
|
||||
legends = ['X', 'Y']
|
||||
series = el.data
|
||||
}
|
||||
else {
|
||||
const data = el.data as ChartItem[]
|
||||
labels = Object.values(data[0].xlabels)
|
||||
legends = data.map(item => item.key)
|
||||
series = data.map(item => item.values.map(v => v.y))
|
||||
}
|
||||
|
||||
const options: ChartOptions = {}
|
||||
|
||||
let chartType: ChartType = 'bar'
|
||||
|
||||
switch (el.chartType) {
|
||||
case 'barChart':
|
||||
case 'bar3DChart':
|
||||
chartType = 'bar'
|
||||
if (el.barDir === 'bar') chartType = 'column'
|
||||
if (el.grouping === 'stacked' || el.grouping === 'percentStacked') options.stack = true
|
||||
break
|
||||
case 'lineChart':
|
||||
case 'line3DChart':
|
||||
if (el.grouping === 'stacked' || el.grouping === 'percentStacked') options.stack = true
|
||||
chartType = 'line'
|
||||
break
|
||||
case 'areaChart':
|
||||
case 'area3DChart':
|
||||
if (el.grouping === 'stacked' || el.grouping === 'percentStacked') options.stack = true
|
||||
chartType = 'area'
|
||||
break
|
||||
case 'scatterChart':
|
||||
case 'bubbleChart':
|
||||
chartType = 'scatter'
|
||||
break
|
||||
case 'pieChart':
|
||||
case 'pie3DChart':
|
||||
chartType = 'pie'
|
||||
break
|
||||
case 'radarChart':
|
||||
chartType = 'radar'
|
||||
break
|
||||
case 'doughnutChart':
|
||||
chartType = 'ring'
|
||||
break
|
||||
default:
|
||||
}
|
||||
|
||||
slide.elements.push({
|
||||
type: 'chart',
|
||||
id: nanoid(10),
|
||||
chartType: chartType,
|
||||
width: el.width,
|
||||
height: el.height,
|
||||
left: el.left,
|
||||
top: el.top,
|
||||
rotate: 0,
|
||||
themeColors: [theme.value.themeColor],
|
||||
textColor: theme.value.fontColor,
|
||||
data: {
|
||||
labels,
|
||||
legends,
|
||||
series,
|
||||
},
|
||||
options,
|
||||
})
|
||||
}
|
||||
else if (el.type === 'group' || el.type === 'diagram') {
|
||||
const elements = el.elements.map(_el => ({
|
||||
..._el,
|
||||
left: _el.left + originLeft,
|
||||
top: _el.top + originTop,
|
||||
}))
|
||||
parseElements(elements)
|
||||
}
|
||||
}
|
||||
}
|
||||
parseElements(item.elements)
|
||||
slides.push(slide)
|
||||
}
|
||||
resData.slides = slides
|
||||
resData.slides = await parsePptJsonSlides(json.slides, json.zip)
|
||||
resolve(resData)
|
||||
})
|
||||
}
|
|
@ -41,7 +41,7 @@ export const enum ElementTypes {
|
|||
*
|
||||
* rotate: 渐变角度(线性渐变)
|
||||
*/
|
||||
export type GradientType = 'linear' | 'radial'
|
||||
export type GradientType = 'linear' | 'radial' | 'image'
|
||||
export type GradientColor = {
|
||||
pos: number
|
||||
color: string
|
||||
|
|
|
@ -5,11 +5,18 @@
|
|||
</header>
|
||||
<div class="flex material-list" v-loading="loading">
|
||||
<div class="flex material-item" v-for="item in list" :key="item.id" >
|
||||
<div class="flex">
|
||||
<el-image :src="fileUrl(item)" class="img" />
|
||||
<el-text truncated>{{ item.fileShowName }}</el-text>
|
||||
<div class="flex material-item">
|
||||
<el-image v-if="item.fileType.indexOf('image')!=-1" :src="fileUrl(item)" class="img" />
|
||||
<svg v-if="item.fileType.indexOf('video')!=-1" class="icon file-icon" aria-hidden="true" :style="{ 'font-size': 100 + 'px' }">
|
||||
<use :xlink:href="'#icon-video'"></use>
|
||||
</svg>
|
||||
<svg class="icon file-icon" v-if="item.fileType.indexOf('audio')!=-1" aria-hidden="true" :style="{ 'font-size': 100 + 'px' }">
|
||||
<use :xlink:href="'#icon-mp'"></use>
|
||||
</svg>
|
||||
<div class="texts">{{ item.fileShowName }}</div>
|
||||
<!-- <el-text truncated>{{ item.fileShowName }}</el-text> -->
|
||||
</div>
|
||||
<el-button type="primary" @click="onInsert(item)">插入</el-button>
|
||||
<el-button style="margin-left: 10px;" type="primary" @click="onInsert(item)">插入</el-button>
|
||||
</div>
|
||||
<el-empty description="暂无素材" v-if="!list.length" />
|
||||
</div>
|
||||
|
@ -37,7 +44,7 @@ let params = {
|
|||
pageSize: 500
|
||||
}
|
||||
|
||||
const suffixAry = [ 'jpeg','jpg','png','gif','mp3','mp4','avi','mov']
|
||||
const suffixAry = [ 'jpeg','jpg','png','gif','mp3','mp4','avi','mov',"wav"]
|
||||
const videoSuffix = ['mp3','mp4','avi','mov']
|
||||
const list = ref([])
|
||||
const loading = ref(false)
|
||||
|
@ -48,6 +55,7 @@ const init = () => {
|
|||
if(res.rows && res.rows.length){
|
||||
// 过滤出图片和视频
|
||||
list.value = res.rows.filter( item => suffixAry.indexOf(getFileSuffix(item.fileShowName)) != -1)
|
||||
console.log(list.value)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -64,16 +72,19 @@ const fileUrl = computed(() => (item) =>{
|
|||
// 插入
|
||||
const onInsert = async (item) =>{
|
||||
loading.value = true
|
||||
const res = await fetch(item.fileFullPath)
|
||||
const bolb = await res.blob()
|
||||
const file = commUtils.blobToFile(bolb, item.fileShowName)
|
||||
|
||||
// const res = await fetch(item.fileFullPath)
|
||||
// const bolb = await res.blob()
|
||||
// const file = commUtils.blobToFile(bolb, item.fileShowName)
|
||||
const data=item.fileFullPath
|
||||
try {
|
||||
const data = await PPTApi.toRousrceUrl(file)
|
||||
console.log('item', item)
|
||||
// const data = await PPTApi.toRousrceUrl(file)
|
||||
if(videoSuffix.indexOf(getFileSuffix(item.fileShowName)) != -1){
|
||||
emit('insertMaterial',{ type: 'video', data })
|
||||
}
|
||||
else{
|
||||
}else if(item.fileType.indexOf('audio') != -1){
|
||||
emit('insertMaterial',{ type: 'audio', data })
|
||||
}else{
|
||||
emit('insertMaterial',{ type: 'img', data })
|
||||
}
|
||||
} finally {
|
||||
|
@ -125,11 +136,17 @@ onMounted(() => {
|
|||
align-items: center;
|
||||
margin-bottom: 10px;
|
||||
font-size: 14px;
|
||||
justify-content: space-between;
|
||||
|
||||
.img{
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
}
|
||||
.texts{
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 600px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -287,6 +287,8 @@ const insertMaterial = async (item: MaterialParams) =>{
|
|||
const { type, data } = item
|
||||
if(type == 'video'){
|
||||
createVideoElement(data)
|
||||
}else if(type == 'audio'){
|
||||
createAudioElement(data)
|
||||
}
|
||||
else{
|
||||
createImageElement(data)
|
||||
|
|
|
@ -46,11 +46,12 @@
|
|||
:options="[
|
||||
{ label: '线性渐变', value: 'linear' },
|
||||
{ label: '径向渐变', value: 'radial' },
|
||||
{ label: '背景图', value: 'image' },
|
||||
]"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<template v-if="fillType === 'gradient'">
|
||||
<template v-if="fillType === 'gradient' && gradient.type !== 'image'">
|
||||
<div class="row">
|
||||
<GradientBar
|
||||
:value="gradient.colors"
|
||||
|
@ -206,6 +207,13 @@ const updateFillType = (type: 'gradient' | 'fill') => {
|
|||
const updateGradient = (gradientProps: Partial<Gradient>) => {
|
||||
if (!gradient.value) return
|
||||
const _gradient = { ...gradient.value, ...gradientProps }
|
||||
if (!_gradient.colors) {
|
||||
_gradient.colors = [
|
||||
{ pos: 0, color: '#fff' },
|
||||
{ pos: 100, color: '#fff' },
|
||||
]
|
||||
_gradient.rotate = 0
|
||||
}
|
||||
updateElement({ gradient: _gradient })
|
||||
}
|
||||
const updateGradientColors = (color: string) => {
|
||||
|
|
|
@ -47,9 +47,10 @@
|
|||
<IconListView class="tool-btn" v-tooltip="'演讲者视图'" @click="changeViewMode('presenter')" />
|
||||
<IconOffScreenOne class="tool-btn" v-tooltip="'退出全屏'" v-if="fullscreenState" @click="manualExitFullscreen()" />
|
||||
<IconFullScreenOne class="tool-btn" v-tooltip="'进入全屏'" v-else @click="enterFullscreen()" />
|
||||
<Hands class="tool-btn" v-if="classcourse" v-tooltip="'课堂点名'" @click="ToolHandle('named')" />
|
||||
<Share class="tool-btn" v-if="classcourse" v-tooltip="'分享'" @click="ShareCode()" />
|
||||
<IconPower class="tool-btn" v-if="!classcourse" v-tooltip="'结束放映'" @click="exitScreening()" />
|
||||
<IconPower class="tool-btn" v-else v-tooltip="'结束课堂'" @click="exitCourse()" size="30" fill="#d0021b" strokeLinecap="butt" />
|
||||
<Share class="tool-btn" v-if="classcourse" v-tooltip="'分享'" @click="ShareCode()" />
|
||||
</div>
|
||||
<div :class="['tools-icon',{opacity:iconHide}]" @click.stop="toolTrigger('icon')">
|
||||
<circle-double-down v-if="rightToolsVisible" theme="outline" size="30" fill="#409EFF"/>
|
||||
|
@ -76,8 +77,8 @@ import WritingBoardTool from './WritingBoardTool.vue'
|
|||
import CountdownTimer from './CountdownTimer.vue'
|
||||
import emitter from '@/utils/mitt';
|
||||
import Chat from '../../api/chat' // 聊天
|
||||
import { CircleDoubleDown, CircleDoubleUp, Share } from '@icon-park/vue-next' // icon-park 图标库
|
||||
import { ShareCode } from '@/utils/ppt' // ppt相关
|
||||
import { CircleDoubleDown, CircleDoubleUp, Share, Hands } from '@icon-park/vue-next' // icon-park 图标库
|
||||
import { ShareCode, ToolHandle } from '@/utils/ppt' // ppt相关
|
||||
|
||||
const props = defineProps<{
|
||||
changeViewMode: (mode: 'base' | 'presenter') => void
|
||||
|
|
|
@ -10,7 +10,10 @@
|
|||
<IconOffScreenOne class="tool-icon" v-else />
|
||||
<span>{{ fullscreenState ? '退出全屏' : '全屏' }}</span>
|
||||
</div>
|
||||
<template v-if="classcourse">
|
||||
<div class="tool-btn" @click="ToolHandle('named')"><Hands class="tool-icon" /><span>课堂点名</span></div>
|
||||
<div class="tool-btn" @click="ShareCode()"><Share class="tool-icon" /><span>分享</span></div>
|
||||
</template>
|
||||
<Divider class="divider" />
|
||||
<div class="tool-btn" v-if="!classcourse" @click="exitScreening()"><IconPower class="tool-icon" /><span>结束放映</span></div>
|
||||
<div class="tool-btn" v-else @click="exitCourse()" size="30" fill="#d0021b" strokeLinecap="butt"><IconPower class="tool-icon" /><span>结束课堂</span></div>
|
||||
|
@ -79,7 +82,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { Share } from '@icon-park/vue-next' // icon-park 图标库
|
||||
import { Share, Hands } from '@icon-park/vue-next' // icon-park 图标库
|
||||
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useSlidesStore, useClasscourseStore } from '../../store'
|
||||
|
@ -99,7 +102,7 @@ import CountdownTimer from './CountdownTimer.vue'
|
|||
import Divider from '../../components/Divider.vue'
|
||||
import emitter from '@/utils/mitt';
|
||||
import Chat from '../../api/chat' // 聊天
|
||||
import { ShareCode } from '@/utils/ppt' // ppt相关
|
||||
import { ShareCode, ToolHandle } from '@/utils/ppt' // ppt相关
|
||||
|
||||
const props = defineProps<{
|
||||
changeViewMode: (mode: 'base' | 'presenter') => void
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
<PresenterView :changeViewMode="changeViewMode" v-else-if="viewMode === 'presenter'" />
|
||||
<!-- 点赞组件 -->
|
||||
<upvote-vue ref="upvoteRef" type="2"></upvote-vue>
|
||||
<!-- <div style="z-index: 999;position: absolute;top:10px">
|
||||
</div> -->
|
||||
|
||||
<!-- 推图上屏弹窗 -->
|
||||
<el-dialog
|
||||
v-model="dialogVisible"
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
:type="elementInfo.gradient.type"
|
||||
:colors="elementInfo.gradient.colors"
|
||||
:rotate="elementInfo.gradient.rotate"
|
||||
:image="elementInfo.gradient.image"
|
||||
:info="elementInfo"
|
||||
/>
|
||||
</defs>
|
||||
<g
|
||||
|
|
|
@ -1,6 +1,25 @@
|
|||
<template>
|
||||
<!-- auth:zdg 增加图片 -->
|
||||
<pattern
|
||||
v-if="type === 'image'"
|
||||
:id="id"
|
||||
:x="image?.stretch?.l || 0"
|
||||
:y="image?.stretch?.t || 0"
|
||||
:width="image?.path_W||'100%'"
|
||||
:height="image?.path_h||'100%'"
|
||||
:style="image.rotWithShape==0?'transform:rotate('+(-info.rotate)+'deg)' : ''"
|
||||
patternUnits="userSpaceOnUse">
|
||||
<image
|
||||
:width="image?.path_W||200"
|
||||
:height="image?.path_h||200"
|
||||
:href="image.src"
|
||||
:opacity="image.opacity"
|
||||
preserveAspectRatio="none"
|
||||
/>
|
||||
</pattern>
|
||||
<!-- auth:zdg 默认 线性渐变 -->
|
||||
<linearGradient
|
||||
v-if="type === 'linear'"
|
||||
v-else-if="type === 'linear'"
|
||||
:id="id"
|
||||
x1="0%"
|
||||
y1="0%"
|
||||
|
@ -10,20 +29,35 @@
|
|||
>
|
||||
<stop v-for="(item, index) in colors" :key="index" :offset="`${item.pos}%`" :stop-color="item.color" />
|
||||
</linearGradient>
|
||||
|
||||
<!-- auth:zdg 默认 径向渐变 -->
|
||||
<radialGradient :id="id" v-else>
|
||||
<stop v-for="(item, index) in colors" :key="index" :offset="`${item.pos}%`" :stop-color="item.color" />
|
||||
</radialGradient>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { GradientColor, GradientType } from '../../../../types/slides'
|
||||
|
||||
withDefaults(defineProps<{
|
||||
import type { GradientColor, GradientType, PPTShapeElement } from '../../../../types/slides'
|
||||
interface ImageSvg {
|
||||
src: string,
|
||||
width: number,
|
||||
height: number,
|
||||
zipPath: string,
|
||||
opacity: number,
|
||||
rotWithShape: string,
|
||||
stretch?: {
|
||||
l?: number,
|
||||
t?: number,
|
||||
r?: number,
|
||||
b?: number
|
||||
}
|
||||
}
|
||||
const data = withDefaults(defineProps<{
|
||||
id: string
|
||||
type: GradientType
|
||||
colors: GradientColor[]
|
||||
rotate?: number
|
||||
colors?: GradientColor[]
|
||||
rotate?: number,
|
||||
image?: ImageSvg,
|
||||
info?: PPTShapeElement
|
||||
}>(), {
|
||||
rotate: 0,
|
||||
})
|
||||
|
|
|
@ -42,6 +42,8 @@
|
|||
:type="elementInfo.gradient.type"
|
||||
:colors="elementInfo.gradient.colors"
|
||||
:rotate="elementInfo.gradient.rotate"
|
||||
:image="elementInfo.gradient.image"
|
||||
:info="elementInfo"
|
||||
/>
|
||||
</defs>
|
||||
<g
|
||||
|
|
|
@ -79,3 +79,34 @@ export const getModelInfo = (params) => {
|
|||
params
|
||||
})
|
||||
}
|
||||
// 上传tts语音
|
||||
export const aitts = (data) => {
|
||||
return request({
|
||||
url: '/aitts/createTts',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
// 语音关联课
|
||||
export const addFileToSC = (params) => {
|
||||
return request({
|
||||
url: '/smarttalk/file/addFileToSC',
|
||||
method: 'post',
|
||||
params
|
||||
})
|
||||
}
|
||||
//EOS生成表单上传的签名
|
||||
export const createSignature = (data) => {
|
||||
return request({
|
||||
url: '/eos/createSignature',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
//EOS生成本地上传的临时签名
|
||||
export const sessionToken = () => {
|
||||
return request({
|
||||
url: '/eos/sessionToken',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
|
|
@ -118,6 +118,13 @@ export function docList(params) {
|
|||
})
|
||||
}
|
||||
|
||||
// 删除 doc ai文档
|
||||
export function removeDoc(id) {
|
||||
return request({
|
||||
url: '/education/doc/' + id,
|
||||
method: 'delete',
|
||||
})
|
||||
}
|
||||
|
||||
// 保存教学大纲
|
||||
export function addSyllabus(data) {
|
||||
|
@ -128,3 +135,27 @@ export function addSyllabus(data) {
|
|||
})
|
||||
}
|
||||
|
||||
// 获取保存的大纲列表
|
||||
export function syllabusList(params) {
|
||||
return request({
|
||||
url: '/education/generate/list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 删除大纲
|
||||
export function removeSyllabus(id) {
|
||||
return request({
|
||||
url: '/education/generate/' + id,
|
||||
method: 'delete',
|
||||
})
|
||||
}
|
||||
|
||||
export function editSyllabus(data) {
|
||||
return request({
|
||||
url: '/education/generate',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
|
|
@ -114,4 +114,16 @@ export function getShareCode(id) {
|
|||
data: { id }
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 课堂点名
|
||||
* @param {*} timgroupid 群id
|
||||
* @returns
|
||||
*/
|
||||
export function rollCall(timgroupid) {
|
||||
return request({
|
||||
url: '/education/classcourse/roll/call',
|
||||
method: 'post',
|
||||
data: { timgroupid }
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 107 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.5 MiB |
|
@ -0,0 +1,135 @@
|
|||
<template>
|
||||
<!-- <form @submit.prevent="submitForm" enctype="multipart/form-data">-->
|
||||
<form action="https://wzyzoss.eos-chongqing-3.cmecloud.cn" method="post" enctype="multipart/form-data">
|
||||
<!-- action 是具体要上传的地址 -->
|
||||
<!--
|
||||
|
||||
上传后文件(Object)名:
|
||||
<input type="input" name="key" :value="uploadData.key" placeholder="文件名" style="width: 400px"/><br/><br/>
|
||||
|
||||
ACL:
|
||||
<input type="hidden" name="acl" :value="uploadData.acl" placeholder="文件 ACL" style="width: 400px"/><br/><br/>
|
||||
|
||||
Content-Type:
|
||||
<input type="input" name="Content-Type" :value="uploadData['Content-Type']" placeholder="文件类型" style="width: 400px"/><br/><br/>
|
||||
|
||||
X-Amz-Credential:
|
||||
<input type="text" name="X-Amz-Credential" :value="uploadData['x-amz-credential']" placeholder="X-Amz-Credential,从后端程序返回中获取" style="width: 400px"/><br/><br/>
|
||||
|
||||
X-Amz-Algorithm:
|
||||
<input type="text" name="X-Amz-Algorithm" :value="uploadData['x-amz-algorithm']" placeholder="X-Amz-Algorithm, 从后端程序返回中获取" style="width: 400px"/><br/><br/>
|
||||
|
||||
X-Amz-Date:
|
||||
<input type="text" name="X-Amz-Date" :value="uploadData['x-amz-date']" placeholder="X-Amz-Date 从后端程序返回中获取" style="width: 400px"><br/><br/>
|
||||
|
||||
Policy:
|
||||
<input type="text" name="Policy" :value="uploadData.policy" placeholder="Policy 从后端程序返回中获取" style="width: 400px"/><br/><br/>
|
||||
|
||||
X-Amz-Signature:
|
||||
<input type="text" name="X-Amz-Signature" :value="uploadData['x-amz-signature']" placeholder="X-Amz-Signature 从后端程序返回中获取" style="width: 400px"/><br/><br/>
|
||||
-->
|
||||
|
||||
选择文件(Object)
|
||||
<input type="file" name="file" @change="handleFileChange" style="width: 400px"/> <br/><br/>
|
||||
<input type="submit" name="submit" value="上传到 EOS" style="width: 400px"/><br/><br/>
|
||||
<el-button @click="uploadFile">上传</el-button>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {ref, onMounted} from "vue"
|
||||
import {createSignature, sessionToken} from "@/api/file";
|
||||
import axios from "axios"
|
||||
|
||||
const url = "https://wzyzoss.eos-chongqing-3.cmecloud.cn"
|
||||
const uploadData = ref({
|
||||
"bucket": "wzyzoss",
|
||||
"x-amz-date": "20250113T061000Z",
|
||||
"x-amz-signature": "2d6fba9f27544bfc7414d660e2e73aafdaf02fe3de45e68f59d580276239cd07",
|
||||
"acl": "private",
|
||||
"x-amz-algorithm": "AWS4-HMAC-SHA256",
|
||||
"key": "wzyzossa",
|
||||
"x-amz-credential": "07ICFAF4IWWZP6RH0WCG/20250113/us-east-1/s3/aws4_request",
|
||||
"Content-Type": null,
|
||||
"policy": "eyJleHBpcmF0aW9uIjoiMjAyNS0wMS0xM1QwNzoxMDowMC42NzVaIiwiY29uZGl0aW9ucyI6W3sieC1hbXotZGF0ZSI6IjIwMjUwMTEzVDA2MTAwMFoifSx7ImFjbCI6InByaXZhdGUifSx7ImJ1Y2tldCI6Ind6eXpvc3MifSxbInN0YXJ0cy13aXRoIiwiJGtleSIsInd6eXpvc3NhIl0sWyJzdGFydHMtd2l0aCIsIiRDb250ZW50LVR5cGUiLCJudWxsIl0seyJ4LWFtei1hbGdvcml0aG0iOiJBV1M0LUhNQUMtU0hBMjU2In0seyJ4LWFtei1jcmVkZW50aWFsIjoiMDdJQ0ZBRjRJV1daUDZSSDBXQ0cvMjAyNTAxMTMvdXMtZWFzdC0xL3MzL2F3czRfcmVxdWVzdCJ9LFsiY29udGVudC1sZW5ndGgtcmFuZ2UiLDEsMTAwMDAwXV19"
|
||||
})
|
||||
|
||||
|
||||
|
||||
const submitForm = ()=> {
|
||||
let formData = new FormData();
|
||||
for (const formDataKey in formData) {
|
||||
formData.append(formDataKey, formData[formDataKey]);
|
||||
}
|
||||
axios.post(url, formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
console.log('表单提交成功,服务器响应:', response.data);
|
||||
})
|
||||
.catch(error => {
|
||||
console.log('表单提交失败:', error);
|
||||
});
|
||||
}
|
||||
|
||||
const S3Data = {
|
||||
apiVersion: "2006-03-01",
|
||||
accessKeyId: "2UYNH48SKS4O3WB4W4OI", // 服务端获取到的 access key ID
|
||||
secretAccessKey: "spwk4vcPbQUa3n7H8AwOFWqhK712XUX23CrUlwC8", // 服务端获取到的 secret access key
|
||||
endpoint: "eos-chongqing-3.cmecloud.cn",
|
||||
signatureVersion: "v2",
|
||||
sslEnabled: true // 是否启用 HTTPS 连接
|
||||
}
|
||||
|
||||
let selectedFile = null
|
||||
|
||||
const handleFileChange = (event)=> {
|
||||
// 获取选中的文件
|
||||
selectedFile = event.target.files[0];
|
||||
}
|
||||
|
||||
const uploadMessage = ref(null)
|
||||
|
||||
const uploadFile = ()=>{
|
||||
if (selectedFile) {
|
||||
console.log(S3Data)
|
||||
// 创建一个 AWS.S3 实例
|
||||
const s3 = new AWS.S3(S3Data);
|
||||
let params = {
|
||||
Key: selectedFile.name,
|
||||
Bucket: "wzyzoss",
|
||||
ContentType: selectedFile.type,
|
||||
Body: selectedFile
|
||||
}
|
||||
console.log(params)
|
||||
s3.putObject(params, function (err, data) {
|
||||
console.log(err,data)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(()=>{
|
||||
console.log(AWS)
|
||||
/*createSignature({objectName:"123.jpg",contentType:"image/png"}).then(res=>{
|
||||
uploadData.value = res.body
|
||||
})*/
|
||||
sessionToken().then(res=>{
|
||||
uploadMessage.value = res.data
|
||||
console.log(res.data)
|
||||
S3Data.accessKeyId = res.data.accessKeyId
|
||||
// S3Data.accessKeyId = "kzOm2cc7nT12ao907Tc"
|
||||
S3Data.secretAccessKey = res.data.secretAccessKey
|
||||
// S3Data.secretAccessKey = "MYXV8Z3UKZVQETFNKQKLJQA67II6E3YEY8RODCV"
|
||||
S3Data.endpoint = res.data.endPoint
|
||||
S3Data.sessionToken = res.data.sessionToken
|
||||
// S3Data.sessionToken = "zPpRolsWE3n7fbmqdt/tzyoSeYULFedptLuKdnJBag5X9y73fitu93WPLMMqYQzYTR+mg86jxs3IQJjOpgFRShdiNB2/mWRvfyeEZ3xo6cRMYnFXSLASIxCyvAH48pH6Z1pI3NuqtaZzlx7zdeoHYCskOuzBXoLhxN1cCXTg3AEZqQ0K4v1RcPIi4cD/YE+XCa+V7DjYU2Bs9zxZ4I52wXOtdnTg9Gj+MwfT+CywOio="
|
||||
S3Data.apiVersion = "2006-03-01"
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
|
@ -0,0 +1,240 @@
|
|||
<template>
|
||||
<div>
|
||||
<div style="height: auto; display: flex">
|
||||
<div style="flex: 1">
|
||||
<div class="audio-container">
|
||||
<aiAudio
|
||||
@saveClick="saveClick"
|
||||
ref="audioRef"
|
||||
:audioSrc="audioSrc"
|
||||
@auditionClick="auditionClick"
|
||||
></aiAudio>
|
||||
</div>
|
||||
</div>
|
||||
<div style="background: #fff; height: 85vh; min-width: 364px; margin-left: 20px;overflow: hidden;">
|
||||
<div style="padding: 0 20px; height: 100%;">
|
||||
<el-tabs v-model="activeTab" class="prepare-tabs">
|
||||
<el-tab-pane label="素材" name="素材">
|
||||
<div class="prepare-body-header">
|
||||
<div>
|
||||
<label style="font-size: 15px"
|
||||
>共{{
|
||||
currentFileList.filter(
|
||||
(ite) => ite.fileFlag !== 'apt' && ite.fileFlag !== '课件'
|
||||
).length
|
||||
}}个文件</label
|
||||
>
|
||||
<!-- <el-popover placement="top-start" :width="250" trigger="hover">
|
||||
<template #default>
|
||||
<div>
|
||||
<el-button
|
||||
v-if="lastAsyncAllTime"
|
||||
type="success"
|
||||
size="small"
|
||||
:icon="Check"
|
||||
circle
|
||||
/>
|
||||
{{ lastAsyncAllTime ? toTimeText(lastAsyncAllTime) + '同步成功' : '' }}
|
||||
</div>
|
||||
</template>
|
||||
<template #reference>
|
||||
<el-button size="small" text @click="asyncAllFile">
|
||||
<el-icon v-loading="asyncAllFileVisiable">
|
||||
<Refresh />
|
||||
</el-icon>
|
||||
{{ asyncAllFileVisiable ? '同步中' : '云同步' }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-popover> -->
|
||||
<!-- <el-button size="small" @click="isDialogOpen = true">上传资料</el-button>
|
||||
<el-button size="small" @click="reloadFiles">资源重载</el-button> -->
|
||||
</div>
|
||||
</div>
|
||||
<el-checkbox-group
|
||||
v-model="checkFileList"
|
||||
class="prepare-body-main"
|
||||
:style="{ 'margin-bottom': checkFileList.length > 0 ? '40px' : '0' }"
|
||||
>
|
||||
<file-list-item
|
||||
v-for="(item, index) in currentSCFileList"
|
||||
:key="index"
|
||||
:item="item"
|
||||
:index="index"
|
||||
@on-delete="deleteSuccess"
|
||||
>
|
||||
</file-list-item>
|
||||
</el-checkbox-group>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { useRoute } from 'vue-router'
|
||||
import { getSmarttalkPage, moveSmarttalk, creatAPT } from '@/api/file'
|
||||
import FileListItem from '@/views/prepare/container/file-list-item.vue'
|
||||
import { parseCataByNode, creatPPT, asyncLocalFile, removeLocalFiles } from '@/utils/talkFile'
|
||||
import { uploadPicture } from '@/api/aiGeneratedImage/index.js'
|
||||
import { aitts, addFileToSC } from '@/api/file/index.js'
|
||||
export default {
|
||||
components: {
|
||||
FileListItem
|
||||
},
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
activeTab: '素材',
|
||||
currentFileList: [],
|
||||
uploadData: {},
|
||||
checkFileList: [],
|
||||
isLoading: false,
|
||||
lastAsyncAllTime: '',
|
||||
audioSrc: null,
|
||||
filedata: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
isCheckAll() {
|
||||
return (
|
||||
this.checkFileList.length > 0 && this.checkFileList.length === this.currentSCFileList.length
|
||||
)
|
||||
},
|
||||
currentSCFileList() {
|
||||
// return this.currentFileList.filter((item) => item.fileFlag !== 'apt' && item.fileFlag !== '课件')
|
||||
return this.currentFileList.filter((item) => !['apt', 'aippt'].includes(item.fileFlag))
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
deleteSuccess(item) {
|
||||
this.asyncAllFile() // 刷新资源列表
|
||||
},
|
||||
auditionClick(requestData) {
|
||||
this.$refs.audioRef.startLoading = true
|
||||
aitts(requestData)
|
||||
.then((res) => {
|
||||
console.log(res)
|
||||
if (res.code == 200) {
|
||||
this.audioSrc = res.data.fullUrl
|
||||
this.filedata = res.data
|
||||
this.$refs.audioRef.startLoading = false
|
||||
} else {
|
||||
this.$message.error(res.msg)
|
||||
this.$refs.audioRef.startLoading = false
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
this.$refs.audioRef.startLoading = false
|
||||
})
|
||||
},
|
||||
saveClick(requestData) {
|
||||
this.$refs.audioRef.saveLoading = true
|
||||
aitts(requestData)
|
||||
.then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.filedata = res.data
|
||||
const saveObj = {
|
||||
textbookId: this.uploadData.textbookId,
|
||||
levelFirstId: this.uploadData.levelFirstId,
|
||||
levelSecondId: this.uploadData.levelSecondId,
|
||||
fileSource: this.uploadData.fileSource,
|
||||
fileRoot: this.uploadData.fileRoot,
|
||||
fileShowName: this.filedata.uploadTime+'音频.' + this.filedata.fileSuffix,
|
||||
fileFlag: '素材',
|
||||
fileId: this.filedata.id
|
||||
}
|
||||
addFileToSC(saveObj)
|
||||
.then((resone) => {
|
||||
this.$message.success('上传成功')
|
||||
this.asyncAllFile()
|
||||
this.$refs.audioRef.saveLoading = false
|
||||
})
|
||||
.catch((err) => {
|
||||
this.$refs.audioRef.saveLoading = false
|
||||
})
|
||||
} else {
|
||||
this.$message.error(res.msg)
|
||||
this.$refs.audioRef.saveLoading = false
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
this.$refs.audioRef.saveLoading = false
|
||||
})
|
||||
|
||||
},
|
||||
asyncAllFile() {
|
||||
this.isLoading = true
|
||||
return getSmarttalkPage({
|
||||
...this.uploadData,
|
||||
orderByColumn: 'createTime',
|
||||
isAsc: 'desc',
|
||||
pageSize: 500
|
||||
})
|
||||
.then(async (res) => {
|
||||
this.currentFileList = [...res.rows].filter((item) => item.fileType === 'audio/wav')
|
||||
this.isLoading = false
|
||||
this.lastAsyncAllTime = new Date()
|
||||
localStorage.setItem('lastAsyncAllTime', this.lastAsyncAllTime)
|
||||
this.asyncAllFileVisiable = true
|
||||
for (let i = 0; i < this.currentFileList.length; i++) {
|
||||
let item = this.currentFileList[i]
|
||||
if (item.fileFlag === 'apt') continue
|
||||
if (item.fileFlag === 'aippt') continue
|
||||
await asyncLocalFile(item)
|
||||
}
|
||||
this.asyncAllFileVisiable = false
|
||||
return Promise.resolve()
|
||||
})
|
||||
.catch(() => {
|
||||
this.isLoading = false
|
||||
return Promise.resolve()
|
||||
})
|
||||
},
|
||||
onMoveSingleFile(item) {
|
||||
this.moveFile = [item]
|
||||
this.isMoveDialogOpen = true
|
||||
},
|
||||
deleteTalk(item) {
|
||||
let index = this.currentFileList.indexOf(item)
|
||||
this.currentFileList.splice(index, 1)
|
||||
},
|
||||
// 打开布置作业窗口
|
||||
openSet(row) {
|
||||
// 布置推送:row 这里是单个,转为list
|
||||
this.rows = [row]
|
||||
this.setDialog = true
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const route = useRoute()
|
||||
this.uploadData = route.query
|
||||
// this.dataset_id = route.query.datasetId;
|
||||
// this.courseName = route.query.coursetitle;
|
||||
// this.levelFirstId = route.query.levelFirstId;
|
||||
// this.levelSecondId = route.query.levelSecondId;
|
||||
// this.textbookId = route.query.textbookId;
|
||||
this.asyncAllFile() // 刷新资源列表
|
||||
},
|
||||
beforeDestroy() {}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped scss>
|
||||
:deep(.prepare-item-info-title) {
|
||||
line-height: 30px;
|
||||
}
|
||||
.prepare-body-main{
|
||||
overflow-y: auto;
|
||||
height: 74vh;
|
||||
}
|
||||
:deep(.audio-container .content-main){
|
||||
height: 85vh !important ;
|
||||
}
|
||||
:deep(.audio-container .content-main div:nth-of-type(1)){
|
||||
display: flex;
|
||||
flex: 1;
|
||||
}
|
||||
</style>
|
|
@ -11,15 +11,21 @@
|
|||
:default-expanded-keys="defaultExpandedKeys" :current-node-key="curNode.data.id" highlight-current
|
||||
@node-click="handleNodeClick">
|
||||
<template #default="{ node, data }">
|
||||
<div v-if="props.isClassTask && (data.bookId == '' || data.bookId == '0')">
|
||||
<el-tooltip effect="light" placement="right" content="该单元章节无自主试题">
|
||||
<span class="tree-label" style="color: #A5B3CA">
|
||||
<div v-if="props.isClassTask && (data.bookId == '' || data.bookId == '0')" class="tree-label-wrap">
|
||||
<el-tooltip effect="light" placement="right" >
|
||||
<template #content> {{ node.label }}<br /><span style="color: red;">-该单元章节无自主试题-</span> </template>
|
||||
<div class="tree-label" style="color: #A5B3CA" >
|
||||
{{ node.label }}
|
||||
</span>
|
||||
</div>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<div v-else>
|
||||
<span class="tree-label">{{ node.label }}</span>
|
||||
<div v-else class="tree-label-wrap">
|
||||
<el-tooltip effect="light" placement="right" >
|
||||
<template #content> {{ node.label }}</template>
|
||||
<div class="tree-label">
|
||||
{{ node.label }}
|
||||
</div>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</template>
|
||||
</el-tree>
|
||||
|
@ -38,8 +44,9 @@
|
|||
|
||||
<div class="textbook-container">
|
||||
<el-scrollbar height="450px">
|
||||
<div class="textbook-item flex" v-for="item in subjectList" :class="curBook.data.id == item.id ? 'active-item' : ''"
|
||||
:key="item.id" @click="changeBook(item)">
|
||||
<div
|
||||
v-for="item in subjectList" :key="item.id" class="textbook-item flex"
|
||||
:class="curBook.data.id == item.id ? 'active-item' : ''" @click="changeBook(item)">
|
||||
<img v-if="item.avartar" :src="item.avartar.indexOf('http') === 0 ? item.avartar : BaseUrl + item.avartar" class="textbook-img" alt="">
|
||||
<div v-else class="textbook-img">
|
||||
<i class="iconfont icon-jiaocaixuanze" style="font-size: 40px;"></i>
|
||||
|
@ -334,7 +341,8 @@ onMounted( async () => {
|
|||
}
|
||||
}
|
||||
|
||||
.tree-label {
|
||||
.tree-label-wrap, .tree-label {
|
||||
max-width: 100%;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
|
|
@ -26,6 +26,7 @@ const getFileTypeIcon = () => {
|
|||
doc: 'icon-word',
|
||||
docx: 'icon-word',
|
||||
mp4: 'icon-video',
|
||||
wav: 'icon-mp',
|
||||
mov: 'icon-mov',
|
||||
avi: 'icon-avi',
|
||||
jpeg: 'icon-jpeg',
|
||||
|
|
|
@ -2,34 +2,45 @@
|
|||
<el-dialog v-model="isDialog" :show-close="false" width="900" append-to-body destroy-on-close>
|
||||
<template #header>
|
||||
<div class="custom-header flex">
|
||||
<span>选择{{ title }}</span>
|
||||
<span>选择</span>
|
||||
<i class="iconfont icon-guanbi" @click="isDialog = false"></i>
|
||||
</div>
|
||||
</template>
|
||||
<div class="dialog-content">
|
||||
|
||||
<div class="dialog-content" v-loading="loading">
|
||||
<div class="content-list">
|
||||
<ul>
|
||||
<li v-for="(item, index) in fileList" :class="activeIndex == index ? 'li-active' : ''"
|
||||
@click="clickItem(index, item)">
|
||||
<el-image class="img" :src="url" />
|
||||
<el-button type="primary" class="prev-btn" @click.stop="onPrevItem(item)">预览</el-button>
|
||||
<el-text truncated>{{ item.fileName }}</el-text>
|
||||
</li>
|
||||
</ul>
|
||||
<el-empty description="暂无数据" v-if="!fileList.length" />
|
||||
<el-radio-group v-model="curFileId">
|
||||
<el-row>
|
||||
<el-col :span="12" v-for="item in fileList" :key="item.id">
|
||||
<el-radio :value="item.id">
|
||||
<el-text class="w-50" truncated>{{ item.fileName }}</el-text>
|
||||
<div class="flex items-center">
|
||||
<el-button type="primary" link v-if="isPrev(item).value" @click="onPrevItem(item)"
|
||||
>预览</el-button
|
||||
>
|
||||
<el-button type="danger" link @click="removeItem(item)">删除</el-button>
|
||||
</div>
|
||||
</el-radio>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-upload class="upload-demo" :action="uploadFileUrl" :limit="1" :show-file-list="false" :headers="headers"
|
||||
:on-success="onSuccess">
|
||||
<el-upload
|
||||
class="upload-demo"
|
||||
:action="uploadFileUrl"
|
||||
:limit="1"
|
||||
:show-file-list="false"
|
||||
:headers="headers"
|
||||
:on-success="onSuccess"
|
||||
>
|
||||
<el-button type="primary">上传</el-button>
|
||||
</el-upload>
|
||||
<div>
|
||||
<el-button @click="isDialog = false">取消</el-button>
|
||||
<el-button type="primary" @click="isDialog = false">
|
||||
确定
|
||||
</el-button>
|
||||
<el-button type="primary" @click="handleDialog"> 确定 </el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -41,10 +52,9 @@
|
|||
<i class="iconfont icon-guanbi" @click="prevVisible = false"></i>
|
||||
</div>
|
||||
</template>
|
||||
<div style="height: calc(100vh - 120px);">
|
||||
<div style="height: calc(100vh - 120px); text-align: center;">
|
||||
<template v-if="getFileSuffix(prevItem.fileUrl) == 'pdf'">
|
||||
<iframe :src="prevItem.fileUrl"
|
||||
frameborder="0" width="100%" height="100%"></iframe>
|
||||
<iframe :src="prevItem.fileUrl" frameborder="0" width="100%" height="100%"></iframe>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-image :src="prevItem.fileUrl" style="height: 100%" />
|
||||
|
@ -53,9 +63,7 @@
|
|||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<div></div>
|
||||
<el-button type="primary" @click="prevVisible = false">
|
||||
关闭
|
||||
</el-button>
|
||||
<el-button type="primary" @click="prevVisible = false"> 关闭 </el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
@ -63,20 +71,19 @@
|
|||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted, reactive } from 'vue'
|
||||
import { completion, addDoc, docList } from '@/api/mode/index.js'
|
||||
import { getToken } from "@/utils/auth";
|
||||
import { completion, addDoc, docList, removeDoc } from '@/api/mode/index.js'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import { dataSetJson } from '@/utils/comm.js'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { getFileSuffix } from '@/utils/ruoyi.js'
|
||||
import emitter from '@/utils/mitt';
|
||||
import emitter from '@/utils/mitt'
|
||||
import { cloneDeep } from 'lodash'
|
||||
|
||||
const userInfo = useUserStore().user
|
||||
const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload");
|
||||
const headers = ref({ Authorization: "Bearer " + getToken() });
|
||||
|
||||
const url = 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2F11044b08-04c1-41a0-a453-1fd20b58a614%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1732953359&t=7ab1d1b3a903db85b1149914407aea35'
|
||||
const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + '/common/upload')
|
||||
const headers = ref({ Authorization: 'Bearer ' + getToken() })
|
||||
|
||||
const isDialog = defineModel()
|
||||
const prevVisible = ref(false)
|
||||
|
@ -88,36 +95,14 @@ const props = defineProps({
|
|||
}
|
||||
})
|
||||
|
||||
const title = computed(() => {
|
||||
if (props.modeType == 1) return '课标';
|
||||
if (props.modeType == 2) return '教材';
|
||||
if (props.modeType == 3) return '考试';
|
||||
})
|
||||
|
||||
const radio = ref(1)
|
||||
const radioList = ref([
|
||||
{ label: '浏览研读', value: 1 },
|
||||
{ label: '跨学科研读', value: 2 },
|
||||
{ label: '跨学段研读', value: 3 },
|
||||
{ label: '课标修订研读', value: 4 },
|
||||
{ label: '自由研读', value: 5 },
|
||||
])
|
||||
const list = ref([
|
||||
{
|
||||
name: '高中语文课程标准',
|
||||
url
|
||||
}
|
||||
])
|
||||
const changeRadio = () => {
|
||||
list.value = []
|
||||
for (let i = 0; i < Math.floor(Math.random() * 5) + 1; i++) {
|
||||
list.value.push({
|
||||
name: '高中语文课程标准',
|
||||
url
|
||||
const isPrev = (item) => {
|
||||
return computed(() => {
|
||||
return ['pdf', 'png', 'jpg', 'jpeg', 'gif', 'webp'].includes(getFileSuffix(item.fileUrl))
|
||||
})
|
||||
}
|
||||
}
|
||||
const activeIndex = ref(0)
|
||||
|
||||
const curFileId = ref(0)
|
||||
|
||||
const dataset_id = ref('')
|
||||
|
||||
|
@ -143,43 +128,79 @@ const onSuccess = async (response) => {
|
|||
const { msg } = await addDoc(docData)
|
||||
ElMessage.success(msg)
|
||||
getList()
|
||||
|
||||
}
|
||||
const curNode = reactive({})
|
||||
|
||||
// 获取doc ai 文档列表
|
||||
const fileList = ref([])
|
||||
const curFile = reactive({})
|
||||
const getList = () => {
|
||||
docList({
|
||||
userId: userInfo.userId,
|
||||
dataset_id: dataset_id.value
|
||||
}).then(res => {
|
||||
createUser: userInfo.userId,
|
||||
datasetId: dataset_id.value
|
||||
}).then((res) => {
|
||||
fileList.value = [...res.rows]
|
||||
if(res.rows.length){
|
||||
Object.assign(curFile, fileList.value[0])
|
||||
curFileId.value = fileList.value[0].id
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const clickItem = (index, item) => {
|
||||
activeIndex.value = index
|
||||
Object.assign(curFile, item)
|
||||
emitter.emit('changeCurFile', item)
|
||||
|
||||
// 删除
|
||||
const loading = ref(false)
|
||||
const removeItem = (item) => {
|
||||
ElMessageBox.confirm('确定要删除?', '温馨提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
loading.value = true
|
||||
removeDoc(item.id)
|
||||
.then(() => {
|
||||
ElMessage.success('操作成功')
|
||||
getList()
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
|
||||
// 预览
|
||||
const prevItem = reactive({})
|
||||
const onPrevItem = (item) => {
|
||||
Object.assign(prevItem, item)
|
||||
prevVisible.value = true
|
||||
}
|
||||
|
||||
//确定选择
|
||||
const handleDialog = () => {
|
||||
isDialog.value = false
|
||||
|
||||
const item = fileList.value.find((item) => item.id == curFileId.value)
|
||||
|
||||
Object.assign(curFile, item)
|
||||
emitter.emit('changeCurFile', item)
|
||||
|
||||
// 改变左侧 pdf
|
||||
if (getFileSuffix(curFile.fileUrl) == 'pdf') {
|
||||
let data = cloneDeep(curFile)
|
||||
emitter.emit('changePdfUrl', data)
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
let data = sessionStore.get('subject.curNode')
|
||||
Object.assign(curNode, data);
|
||||
Object.assign(curNode, data)
|
||||
// 暂时写死"考试-" 目前只有考试分析才会弹出来
|
||||
let jsonKey = `考试-${curNode.edustage}-${curNode.edusubject}`
|
||||
dataset_id.value = dataSetJson[jsonKey]
|
||||
getList()
|
||||
})
|
||||
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.custom-header {
|
||||
|
@ -198,45 +219,6 @@ onMounted(() => {
|
|||
.content-list {
|
||||
padding-top: 10px;
|
||||
|
||||
ul {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
li {
|
||||
width: 130px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
font-size: 13px;
|
||||
padding: 10px;
|
||||
cursor: pointer;
|
||||
border-radius: 5px;
|
||||
overflow: hidden;
|
||||
margin-right: 20px;
|
||||
margin-bottom: 10px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
|
||||
.img {
|
||||
width: 100%;
|
||||
height: 130px;
|
||||
border: solid #ccc 1px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: #E0EAFF;
|
||||
}
|
||||
|
||||
&:hover .prev-btn {
|
||||
transform: translate(-50%, -40px)
|
||||
}
|
||||
}
|
||||
|
||||
.li-active {
|
||||
background: #E0EAFF;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -246,13 +228,7 @@ onMounted(() => {
|
|||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.prev-btn {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%) translateY(-110px);
|
||||
/* 按钮初始位置在容器外 */
|
||||
transition: transform 0.3s ease-in-out;
|
||||
/* 设置过渡效果 */
|
||||
:deep(.el-radio__label) {
|
||||
display: flex;
|
||||
}
|
||||
</style>
|
|
@ -2,8 +2,9 @@
|
|||
<div class="container-left-page flex">
|
||||
<div class="container-left-header flex">
|
||||
<el-button link @click="onClick">
|
||||
{{ curNode.edustage }}{{ curNode.edusubject }}{{ type == 1 ? '课标研读' : type == 2 ? '教材分析' : '考试分析' }}<i
|
||||
class="iconfont icon-xiangxia"></i>
|
||||
{{ curNode.edustage }}{{ curNode.edusubject
|
||||
}}{{ type == 1 ? '课标研读' : type == 2 ? '教材分析' : '考试分析'
|
||||
}}<i v-if="type == 3" class="iconfont icon-xiangxia"></i>
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="container-left-pdf">
|
||||
|
@ -20,6 +21,7 @@ import { ref, onMounted, nextTick, reactive } from 'vue'
|
|||
import { sessionStore } from '@/utils/store'
|
||||
import PDF from '@/components/PdfJs/index.vue'
|
||||
import LeftDialog from './left-dialog.vue'
|
||||
import emitter from '@/utils/mitt'
|
||||
|
||||
const props = defineProps(['type'])
|
||||
|
||||
|
@ -29,6 +31,12 @@ const onClick = () => {
|
|||
showDialog.value = true
|
||||
}
|
||||
|
||||
emitter.on('changePdfUrl', async (data) => {
|
||||
pdfUrl.value = ''
|
||||
await nextTick()
|
||||
pdfUrl.value = data.fileUrl
|
||||
})
|
||||
|
||||
// 加载PDF
|
||||
const pdfUrl = ref('')
|
||||
const curNode = reactive({})
|
||||
|
@ -36,7 +44,7 @@ onMounted(async () => {
|
|||
await nextTick()
|
||||
// 当前节点
|
||||
let nodeData = sessionStore.get('subject.curNode')
|
||||
Object.assign(curNode, nodeData);
|
||||
Object.assign(curNode, nodeData)
|
||||
|
||||
let data = sessionStore.get('subject.curBook')
|
||||
let fileurl = data.fileurl
|
||||
|
@ -45,7 +53,6 @@ onMounted(async () => {
|
|||
}
|
||||
if (fileurl == '') return
|
||||
pdfUrl.value = import.meta.env.VITE_APP_RES_FILE_PATH + fileurl.replace('.txt', '.pdf')
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
|
@ -53,6 +60,7 @@ onMounted(async () => {
|
|||
.container-left-page {
|
||||
height: 100%;
|
||||
flex-direction: column;
|
||||
|
||||
.container-left-header {
|
||||
height: 45px;
|
||||
background: #fff;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
</el-dropdown>
|
||||
<div class="flex">
|
||||
<el-select v-model="curMode" placeholder="Select" class="mr-4 w-30">
|
||||
<el-option v-for="item in modeOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
<el-option v-for="item in modeOptions" :key="item.value" :disabled="item.disabled" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
<el-button type="danger" link :disabled="!(templateList.length)" @click="removeItem(curTemplate, false)">
|
||||
删除
|
||||
|
@ -104,6 +104,12 @@ import { cloneDeep } from 'lodash'
|
|||
const props = defineProps(['type'])
|
||||
const { user } = useUserStore()
|
||||
|
||||
const params = reactive(
|
||||
{
|
||||
prompt: '',
|
||||
dataset_id: ''
|
||||
}
|
||||
)
|
||||
const curMode = ref(2)
|
||||
const modeOptions = ref([
|
||||
{
|
||||
|
@ -112,7 +118,8 @@ const modeOptions = ref([
|
|||
},
|
||||
{
|
||||
label: '知识库模型',
|
||||
value: 2
|
||||
value: 2,
|
||||
disabled: false
|
||||
}
|
||||
])
|
||||
|
||||
|
@ -288,12 +295,7 @@ const onEdit = (index, item) => {
|
|||
}
|
||||
|
||||
// 重新研读
|
||||
const params = reactive(
|
||||
{
|
||||
prompt: '',
|
||||
dataset_id: ''
|
||||
}
|
||||
)
|
||||
|
||||
const prompt = ref('')
|
||||
|
||||
// 重新研读
|
||||
|
@ -344,6 +346,8 @@ const againResult = async (index, item) => {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
||||
// 一键研读
|
||||
const getCompletion = async () => {
|
||||
isStarted.value = new Array(childTempList.length).fill(false)
|
||||
|
@ -372,6 +376,7 @@ const getCompletion = async () => {
|
|||
conversationId: conversation_id.value,
|
||||
stream: false
|
||||
})
|
||||
await delay(1000); // 每个请求之间延迟 1 秒
|
||||
data = res.data
|
||||
}
|
||||
// 知识库模型
|
||||
|
@ -480,7 +485,18 @@ onMounted(() => {
|
|||
|
||||
getTemplateList()
|
||||
let jsonKey = `${modeType.value}-${data.edustage}-${data.edusubject}`
|
||||
|
||||
|
||||
params.dataset_id = dataSetJson[jsonKey]
|
||||
if(!params.dataset_id){
|
||||
curMode.value = 1
|
||||
modeOptions.value.forEach(item => {
|
||||
if(item.value == 2){
|
||||
item.disabled = true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 获取百度千帆会话ID
|
||||
conversation_id.value = localStorage.getItem('conversation_id')
|
||||
if (!conversation_id.value) {
|
||||
|
|
|
@ -123,7 +123,7 @@
|
|||
<!-- 边框样式 -->
|
||||
<div class="blockBox">
|
||||
<el-dropdown @command="updateStyle('lineDash', $event)" placement="top">
|
||||
<el-button><el-image src="../../../src/assets/images/borderstyle.png"
|
||||
<el-button><el-image :src="borderStyleImg"
|
||||
style="width: 14px; height: 14px"></el-image></el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
|
@ -303,6 +303,7 @@ import {
|
|||
import Contextmenu from './components/Contextmenu.vue'
|
||||
import { fontFamilyList, fontSizeList } from './constants'
|
||||
|
||||
const borderStyleImg = new URL('../../../src/assets/images/borderstyle.png', import.meta.url).href
|
||||
const borderImg = new URL('../../../src/assets/images/borderwidth.png', import.meta.url).href
|
||||
const pointerImg = new URL('../../../src/assets/images/mouse-pointer.png', import.meta.url).href
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
|
|
@ -328,7 +328,7 @@ export const processList = (row, aloneOption=false) => {
|
|||
// 处理[答案显示] - 1-正常 0-错误
|
||||
const answer = workAnswerArr
|
||||
.map((item) => {
|
||||
return item === '1' ? '正确' : '错误'
|
||||
return DICT_TRUE_OR_FALSE.TRUE.includes(item) ? '正确' : DICT_TRUE_OR_FALSE.FALSE.includes(item)?'错误':item;
|
||||
})
|
||||
.join('、')
|
||||
row[i].workanswerFormat = answer
|
||||
|
@ -341,3 +341,8 @@ export const processList = (row, aloneOption=false) => {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
const DICT_TRUE_OR_FALSE = {
|
||||
TRUE: ['正确', '对', '√', '1'],
|
||||
FALSE: ['错误', '错', '×', '0'],
|
||||
};
|
|
@ -5,7 +5,11 @@
|
|||
<el-popover ref="popoverRef" placement="right" trigger="hover" popper-class="popoverStyle" :tabindex="999" >
|
||||
<template #reference>
|
||||
<div class="user-info">
|
||||
<el-image class="user-img" :src="userStore.user.avatar ==='/img/avatar-default.jpg' || userStore.user.avatar ==='/images/img-avatar.png' ? defaultUserImg : dev_api + userStore.user.avatar" />
|
||||
<el-image class="user-img" :src="img">
|
||||
<template #error>
|
||||
<img :src="route_path + userStore.user.avatar">
|
||||
</template>
|
||||
</el-image>
|
||||
<span>{{ userStore.user.nickName }}</span>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -65,6 +69,7 @@ import {toLinkLeftWeb} from "@/utils/tool"
|
|||
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
const dev_api = ref(import.meta.env.VITE_APP_BASE_API)
|
||||
const route_path = ref(import.meta.env.VITE_APP_BUILD_BASE_PATH)
|
||||
const userStore = useUserStore()
|
||||
const router = useRouter()
|
||||
const currentRoute = ref('')
|
||||
|
@ -75,6 +80,9 @@ const activeId = ref('/home')
|
|||
const version = ref(pkc.version)
|
||||
|
||||
const popoverRef = ref('')
|
||||
// 默认图片
|
||||
const img = ref('')
|
||||
const defaultImg = ['/img/avatar-default.jpg','/images/img-avatar.png','/src/assets/images/img-avatar.png']
|
||||
|
||||
//是否是基地人员
|
||||
const isStadium = () => {
|
||||
|
@ -224,6 +232,11 @@ const logout = () => {
|
|||
onMounted(() => {
|
||||
userStore.getDeptInfo()
|
||||
// getregisterinfo()
|
||||
if(defaultImg.includes(userStore.user.avatar)){
|
||||
img.value = defaultUserImg
|
||||
}else{
|
||||
img.value = dev_api.value + userStore.user.avatar
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
@ -345,6 +358,7 @@ onMounted(() => {
|
|||
color: #fff;
|
||||
font-size: 12px;
|
||||
margin-top: 5px;
|
||||
text-align: center;
|
||||
}
|
||||
.pointer-events{
|
||||
pointer-events: none;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<span class="ml-5">《{{ curNode.itemtitle }}》</span>
|
||||
</div>
|
||||
<div class="header-center" v-else>
|
||||
AI文枢{{ version }}
|
||||
{{APP_TITLE}}{{ version }}
|
||||
</div>
|
||||
<div class="header-right">
|
||||
<WindowTools />
|
||||
|
@ -29,6 +29,7 @@ import pkc from "../../../../../package.json"
|
|||
import { sessionStore } from '@/utils/store'
|
||||
|
||||
const version = ref(pkc.version)
|
||||
const APP_TITLE = import.meta.env.VITE_APP_TITLE
|
||||
|
||||
// 返回
|
||||
const router = useRouter()
|
||||
|
|
|
@ -10,6 +10,15 @@ import './assets/iconfont/iconfont'
|
|||
import 'virtual:windi.css'
|
||||
import request from "@/utils/request";
|
||||
|
||||
//v-md-editor
|
||||
import VMdPreview from '@kangc/v-md-editor/lib/preview';
|
||||
import '@kangc/v-md-editor/lib/style/preview.css';
|
||||
// 引入你所使用的主题 此处以 github 主题为例
|
||||
import githubTheme from '@kangc/v-md-editor/lib/theme/github';
|
||||
import '@kangc/v-md-editor/lib/theme/style/github.css';
|
||||
// highlightjs
|
||||
import hljs from 'highlight.js';
|
||||
|
||||
import { store } from '@/store'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
|
@ -17,6 +26,9 @@ import log from 'electron-log/renderer' // 渲染进程日志-文件记录
|
|||
import customComponent from '@/components/common' // 自定义组件
|
||||
import plugins from './plugins' // plugins插件
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import aiAudio from 'aix-plugins-aitools' // 文字转语音插件
|
||||
import '../../../node_modules/aix-plugins-aitools/aitools.css'
|
||||
|
||||
|
||||
if(process.env.NODE_ENV != 'development') { // 非开发环境,将日志打印到日志文件
|
||||
Object.assign(console, log.functions) // 渲染进程日志-控制台替换
|
||||
|
@ -39,6 +51,40 @@ app.config.globalProperties.$requestGetJYW = (url,config)=>{
|
|||
import Icon from '@/AixPPTist/src/plugins/icon'
|
||||
import Directive from '@/AixPPTist/src/plugins/directive'
|
||||
|
||||
VMdPreview.use(githubTheme, {
|
||||
Hljs: hljs,
|
||||
});
|
||||
|
||||
(function () {
|
||||
//!['development', 'mock'].includes(process.env.NODE_ENV)&&
|
||||
if (import.meta.env.VITE_SHOW_DEV_TOOLS==='false') {
|
||||
['log', 'warn', 'error', 'info'].forEach((item) => {
|
||||
console[item] = (function (func) {
|
||||
const res = localStorage.getItem('debug');
|
||||
if (res === 'GMV_desk') {
|
||||
return func;
|
||||
}
|
||||
return function () {};
|
||||
})(console[item]);
|
||||
});
|
||||
}
|
||||
})()
|
||||
|
||||
|
||||
let script = document.createElement('script');
|
||||
if (process.env.NODE_ENV !== 'development') {
|
||||
const isNode = typeof require !== 'undefined' // 是否支持node函数
|
||||
const path = isNode?require('path'):{}
|
||||
// 设置 src 属性
|
||||
script.src = path.join(__dirname, "/lib/build/aws-sdk-2.100.0.min.js");
|
||||
}else {
|
||||
script.src = "https://sdk.amazonaws.com/js/aws-sdk-2.100.0.min.js";
|
||||
}
|
||||
// 设置 async 属性,让脚本异步加载
|
||||
script.async = false;
|
||||
// 将 script 元素添加到文档的 head 元素中
|
||||
document.head.appendChild(script);
|
||||
|
||||
app.use(router)
|
||||
.use(store)
|
||||
.use(ElementPlus, { locale: zhLocale })
|
||||
|
@ -46,6 +92,8 @@ app.use(router)
|
|||
.use(plugins)
|
||||
.use(Icon)
|
||||
.use(Directive)
|
||||
.use(aiAudio)
|
||||
.use(VMdPreview)
|
||||
.mount('#app')
|
||||
|
||||
const isStadium = (user) => {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,358 @@
|
|||
// import type { number } from "echarts"
|
||||
|
||||
export interface Shadow {
|
||||
h: number
|
||||
v: number
|
||||
blur: number
|
||||
color: string
|
||||
}
|
||||
|
||||
export interface Shape {
|
||||
type: 'shape'
|
||||
left: number
|
||||
top: number
|
||||
width: number
|
||||
height: number
|
||||
borderColor: string
|
||||
borderWidth: number
|
||||
borderType: 'solid' | 'dashed' | 'dotted'
|
||||
borderStrokeDasharray: string
|
||||
shadow?: Shadow
|
||||
fillColor: string
|
||||
content: string
|
||||
isFlipV: boolean
|
||||
isFlipH: boolean
|
||||
rotate: number
|
||||
shapType: string
|
||||
vAlign: string
|
||||
path?: string
|
||||
name: string
|
||||
}
|
||||
|
||||
export interface Text {
|
||||
type: 'text'
|
||||
left: number
|
||||
top: number
|
||||
width: number
|
||||
height: number
|
||||
borderColor: string
|
||||
borderWidth: number
|
||||
borderType: 'solid' | 'dashed' | 'dotted'
|
||||
borderStrokeDasharray: string
|
||||
shadow?: Shadow
|
||||
fillColor: string
|
||||
isFlipV: boolean
|
||||
isFlipH: boolean
|
||||
isVertical: boolean
|
||||
rotate: number
|
||||
content: string
|
||||
vAlign: string
|
||||
name: string
|
||||
}
|
||||
|
||||
export interface Image {
|
||||
type: 'image'
|
||||
left: number
|
||||
top: number
|
||||
width: number
|
||||
height: number
|
||||
src: string
|
||||
rotate: number
|
||||
isFlipH: boolean
|
||||
isFlipV: boolean
|
||||
}
|
||||
|
||||
export interface TableCell {
|
||||
text: string
|
||||
rowSpan?: number
|
||||
colSpan?: number
|
||||
vMerge?: number
|
||||
hMerge?: number
|
||||
fillColor?: string
|
||||
fontColor?: string
|
||||
fontBold?: boolean
|
||||
}
|
||||
export interface Table {
|
||||
type: 'table'
|
||||
left: number
|
||||
top: number
|
||||
width: number
|
||||
height: number
|
||||
data: TableCell[][]
|
||||
borderColor: string
|
||||
borderWidth: number
|
||||
borderType: 'solid' | 'dashed' | 'dotted'
|
||||
}
|
||||
|
||||
export type ChartType = 'lineChart' |
|
||||
'line3DChart' |
|
||||
'barChart' |
|
||||
'bar3DChart' |
|
||||
'pieChart' |
|
||||
'pie3DChart' |
|
||||
'doughnutChart' |
|
||||
'areaChart' |
|
||||
'area3DChart' |
|
||||
'scatterChart' |
|
||||
'bubbleChart' |
|
||||
'radarChart' |
|
||||
'surfaceChart' |
|
||||
'surface3DChart' |
|
||||
'stockChart'
|
||||
|
||||
export interface ChartValue {
|
||||
x: string
|
||||
y: number
|
||||
}
|
||||
export interface ChartXLabel {
|
||||
[key: string]: string
|
||||
}
|
||||
export interface ChartItem {
|
||||
key: string
|
||||
values: ChartValue[]
|
||||
xlabels: ChartXLabel
|
||||
}
|
||||
export type ScatterChartData = [number[], number[]]
|
||||
export interface CommonChart {
|
||||
type: 'chart'
|
||||
left: number
|
||||
top: number
|
||||
width: number
|
||||
height: number
|
||||
data: ChartItem[]
|
||||
chartType: Exclude<ChartType, 'scatterChart' | 'bubbleChart'>
|
||||
barDir?: 'bar' | 'col'
|
||||
marker?: boolean
|
||||
holeSize?: string
|
||||
grouping?: string
|
||||
style?: string
|
||||
}
|
||||
export interface ScatterChart {
|
||||
type: 'chart'
|
||||
left: number
|
||||
top: number
|
||||
width: number
|
||||
height: number
|
||||
data: ScatterChartData,
|
||||
chartType: 'scatterChart' | 'bubbleChart'
|
||||
}
|
||||
export type Chart = CommonChart | ScatterChart
|
||||
|
||||
export interface Video {
|
||||
type: 'video'
|
||||
left: number
|
||||
top: number
|
||||
width: number
|
||||
height: number
|
||||
blob?: string
|
||||
src?: string
|
||||
}
|
||||
|
||||
export interface Audio {
|
||||
type: 'audio'
|
||||
left: number
|
||||
top: number
|
||||
width: number
|
||||
height: number
|
||||
blob: string
|
||||
}
|
||||
|
||||
export interface Diagram {
|
||||
type: 'diagram'
|
||||
left: number
|
||||
top: number
|
||||
width: number
|
||||
height: number
|
||||
elements: (Shape | Text)[]
|
||||
}
|
||||
|
||||
export interface Math {
|
||||
type: 'math'
|
||||
left: number
|
||||
top: number
|
||||
width: number
|
||||
height: number
|
||||
latex: string
|
||||
}
|
||||
|
||||
export type BaseElement = Shape | Text | Image | Table | Chart | Video | Audio | Diagram | Math
|
||||
|
||||
export interface Group {
|
||||
type: 'group'
|
||||
left: number
|
||||
top: number
|
||||
width: number
|
||||
height: number
|
||||
rotate: number
|
||||
elements: BaseElement[]
|
||||
}
|
||||
export type Element = BaseElement | Group
|
||||
|
||||
export interface SlideColorFill {
|
||||
type: 'color'
|
||||
value: string
|
||||
}
|
||||
|
||||
export interface SlideImageFill {
|
||||
type: 'image'
|
||||
value: {
|
||||
picBase64: string
|
||||
opacity: number
|
||||
}
|
||||
}
|
||||
|
||||
export interface SlideGradientFill {
|
||||
type: 'gradient'
|
||||
value: {
|
||||
rot: number
|
||||
colors: {
|
||||
pos: string
|
||||
color: string
|
||||
}[]
|
||||
}
|
||||
}
|
||||
|
||||
export type SlideFill = SlideColorFill | SlideImageFill | SlideGradientFill
|
||||
|
||||
export interface Slide {
|
||||
fill: SlideFill
|
||||
elements: Element[]
|
||||
note: string
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
slideFactor?: number
|
||||
fontsizeFactor?: number
|
||||
}
|
||||
|
||||
export const parse: (file: ArrayBuffer, options?: Options) => Promise<{
|
||||
slides: Slide[]
|
||||
size: {
|
||||
width: number
|
||||
height: number
|
||||
}
|
||||
}>
|
||||
|
||||
/** zdg: 新内容 */
|
||||
export const align = {
|
||||
getHorizontalAlign?: (t,e,r,n) => string
|
||||
getVerticalAlign?: (t,e,r,n) => string
|
||||
}
|
||||
export const border = {
|
||||
getBorder?: (t,e,r) => string
|
||||
}
|
||||
export const chart = {
|
||||
getChartInfo?: (t) => string
|
||||
}
|
||||
export const color = {
|
||||
applyHueMod?: (t) => string
|
||||
applyLumMod?: (t) => string
|
||||
applyLumOff?: (t) => string
|
||||
applySatMod?: (t) => string
|
||||
applyShade?: (t) => string
|
||||
applyTint?: (t) => string
|
||||
getColorName2Hex?: (t) => string
|
||||
hslToRgb?: (t) => string
|
||||
hueToRgb?: (t) => string
|
||||
}
|
||||
export const fontStyle = {
|
||||
getFontBold?: (t) => string
|
||||
getFontColor?: (t) => string
|
||||
getFontDecoration?: (t) => string
|
||||
getFontDecorationLine?: (t) => string
|
||||
getFontItalic?: (t) => string
|
||||
getFontShadow?: (t) => string
|
||||
getFontSize?: (t) => string
|
||||
getFontSpace?: (t) => string
|
||||
getFontSubscript?: (t) => string
|
||||
getFontType?: (t) => string
|
||||
}
|
||||
export const fill = {
|
||||
getBgGradientFill?: (bgPr, phClr, slideMasterContent, warpObj) => string|object|null
|
||||
getBgPicFill?: (bgPr, sorce, warpObj) => object|null
|
||||
getFillType?: (node) => string
|
||||
getPicFill?: (type, node, warpObj) => string|null|undefined
|
||||
getPicFillBase64?: (zipPath, zipObj) => string|null|undefined
|
||||
getShapeFill?: (node, isSvgMode, warpObj) => object|null
|
||||
getShapeFillBg?: (node, source, warpObj) => object<{zipPath:string,opacity:number}>|null
|
||||
getSlideBackgroundFill?: (warpObj) => object<{type: string, value: string}>
|
||||
getSolidFill?: (solidFill, clrMap, phClr, warpObj) => string
|
||||
}
|
||||
export const math = {
|
||||
findOMath?: (t) => string
|
||||
latexFormart?: (t) => string
|
||||
parseAccent?: (t) => string
|
||||
parseBar?: (t) => string
|
||||
parseBox?: (t) => string
|
||||
parseDelimiter?: (t) => string
|
||||
parseEqArr?: (t) => string
|
||||
parseFraction?: (t) => string
|
||||
parseFunction?: (t) => string
|
||||
parseGroupChr?: (t) => string
|
||||
parseLimit?: (t) => string
|
||||
parseMatrix?: (t) => string
|
||||
parseNary?: (t) => string
|
||||
parseOMath?: (t) => string
|
||||
parseRadical?: (t) => string
|
||||
parseSubscript?: (t) => string
|
||||
parseSuperscript?: (t) => string
|
||||
}
|
||||
export const position = {
|
||||
getPosition?: (t) => string
|
||||
getPt?: (t) => string
|
||||
getSize?: (t) => string
|
||||
}
|
||||
export const readXmlFile = {
|
||||
readXmlFile?: (t) => string
|
||||
simplifyLostLess?: (t) => string
|
||||
}
|
||||
export const schemeColor = {
|
||||
getSchemeColorFromTheme?: (t) => string
|
||||
}
|
||||
export const shadow = {
|
||||
getShadow?: (t) => string
|
||||
}
|
||||
export const shape = {
|
||||
getCustomShapePath?: (t) => string
|
||||
shapeArc?: (t) => string
|
||||
}
|
||||
export const table = {
|
||||
getTableBorders?: (t) => string
|
||||
getTableCellParams?: (t) => string
|
||||
getTableRowParams?: (t) => string
|
||||
}
|
||||
export const text = {
|
||||
genSpanElement?: (t) => string
|
||||
genTextBody?: (t) => string
|
||||
getListType?: (t) => string
|
||||
}
|
||||
export const utils = {
|
||||
angleToDegrees?: (t) => string
|
||||
base64ArrayBuffer?: (t) => string
|
||||
eachElement?: (t) => string
|
||||
escapeHtml?: (t) => string
|
||||
extractFileExtension?: (t) => string
|
||||
getMimeType?: (t) => string
|
||||
getTextByPathList?: (t) => string
|
||||
isVideoLink?: (t) => string
|
||||
toHex?: (t) => string
|
||||
}
|
||||
|
||||
export const genChart: (node, warpObj) => object
|
||||
export const genDiagram: (node, warpObj) => object
|
||||
export const genShape: (node, slideLayoutSpNode, slideMasterSpNode, name, type, warpObj) => object
|
||||
export const genTable: (node, warpObj) => object
|
||||
export const getContentTypes: (zip) => object
|
||||
export const getNote: (noteContent) => string
|
||||
export const getSlideInfo: (zip) => object
|
||||
export const getSlideLayoutEl: (warpObj, isPh) => Array
|
||||
export const indexNodes: (content) => object
|
||||
export const loadTheme: (zip) => object|null
|
||||
export const processCxnSpNode: (node, warpObj) => object
|
||||
export const processGraphicFrameNode: (node, warpObj, source) => string
|
||||
export const processGroupSpNode: (node, warpObj, source) => object|null
|
||||
export const processMathNode: (t) => string
|
||||
export const processNodesInSlide: (t) => string
|
||||
export const processPicNode: (t) => string
|
||||
export const processSingleSlide: (t) => string
|
||||
export const processSpNode: (t) => string
|
File diff suppressed because it is too large
Load Diff
|
@ -90,12 +90,24 @@ export const constantRoutes = [
|
|||
name: 'questionUpload',
|
||||
meta: { title: '习题上传', showBread: true }
|
||||
},
|
||||
{
|
||||
path: 'groupTestPaper',
|
||||
component: () => import('@/views/classTask/groupTestPaper/index.vue'),
|
||||
name: 'groupTestPaper',
|
||||
meta: { title: '自动组卷', showBread: true }
|
||||
},
|
||||
{
|
||||
path: 'aiKolors',
|
||||
component: () => import('@/components/ai-kolors/index.vue'),
|
||||
name: 'aiKolors',
|
||||
meta: { title: '文生图片', showBread: true }
|
||||
},
|
||||
{
|
||||
path: 'aiVoice',
|
||||
component: () => import('@/components/ai-voice/index.vue'),
|
||||
name: 'aiVoice',
|
||||
meta: { title: '语音生成', showBread: true }
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
|
|
|
@ -407,11 +407,54 @@ export const dataSetJson = {
|
|||
"教材-高中-数学": "e03aa4fe9fd011ef91270242ac140006",
|
||||
"教材-高中-地理": "270516829fd111efb13c0242ac140006",
|
||||
"教材-高中-政治": "a2f0b247b85d11ef84290242ac140005",
|
||||
|
||||
"考试-小学-语文": "570f7ed2cc9d11ef9e070242ac140002",
|
||||
"考试-小学-数学": "983270b8cc9d11efbbd80242ac140002",
|
||||
"考试-小学-英语": "d5f80e4ccc9d11ef96fa0242ac140002",
|
||||
"课标-小学-信息科技": "2fe08c7ad18911efbeaa0242ac140002",
|
||||
"课标-小学-科学": "935cfec8bf6a11ef98950242ac140006",
|
||||
"课标-小学-数学": "3c4e298fbf7911ef8e8b0242ac140002",
|
||||
"课标-小学-语文": "f76f1aa5bf7111ef90c80242ac140002",
|
||||
"课标-小学-道德": "8da87869cbd711ef92280242ac140002",
|
||||
"课标-小学-英语": "dc963316cbd811ef8d820242ac140002",
|
||||
"课标-小学-劳动": "fc047d81cbdc11efa1740242ac140002",
|
||||
"教材-小学-信息科技": "2fe08c7ad18911efbeaa0242ac140002",
|
||||
"教材-小学-科学": "935cfec8bf6a11ef98950242ac140006",
|
||||
"教材-小学-数学": "3c4e298fbf7911ef8e8b0242ac140002",
|
||||
"教材-小学-语文": "f76f1aa5bf7111ef90c80242ac140002",
|
||||
"教材-小学-道德": "8da87869cbd711ef92280242ac140002",
|
||||
"教材-小学-英语": "dc963316cbd811ef8d820242ac140002",
|
||||
"教材-小学-劳动": "fc047d81cbdc11efa1740242ac140002",
|
||||
|
||||
"教材-初中-道德与法治": "df9f3ccccbdd11ef9e550242ac140002",
|
||||
"教材-初中-语文": "3770ad18cbde11efadaa0242ac140002",
|
||||
"教材-初中-数学": "8cc0a799cbde11ef8b440242ac140002",
|
||||
"教材-初中-英语": "07b58ca2cbdf11efaa180242ac140002",
|
||||
"教材-初中-物理": "86f2c018cbf211ef9d6a0242ac140002",
|
||||
"教材-初中-化学": "c7b34790cbf211ef92350242ac140002",
|
||||
"教材-初中-生物": "083ac3edcbf311efaad30242ac140002",
|
||||
"教材-初中-地理": "7ee584e1cbf311efbd270242ac140002",
|
||||
"教材-初中-历史": "8ae07971cbf411ef81e70242ac140002",
|
||||
"教材-初中-信息技术": "ca476233cbf411efa9860242ac140002",
|
||||
"课标-初中-道德与法治": "df9f3ccccbdd11ef9e550242ac140002",
|
||||
"课标-初中-语文": "3770ad18cbde11efadaa0242ac140002",
|
||||
"课标-初中-数学": "8cc0a799cbde11ef8b440242ac140002",
|
||||
"课标-初中-英语": "07b58ca2cbdf11efaa180242ac140002",
|
||||
"课标-初中-物理": "86f2c018cbf211ef9d6a0242ac140002",
|
||||
"课标-初中-化学": "c7b34790cbf211ef92350242ac140002",
|
||||
"课标-初中-生物": "083ac3edcbf311efaad30242ac140002",
|
||||
"课标-初中-地理": "7ee584e1cbf311efbd270242ac140002",
|
||||
"课标-初中-历史": "8ae07971cbf411ef81e70242ac140002",
|
||||
"课标-初中-信息技术": "ca476233cbf411efa9860242ac140002",
|
||||
|
||||
"考试-初中-语文": "6be6d201cc0111ef89100242ac140002",
|
||||
"考试-初中-数学": "d764b539cc0111ef8f1b0242ac140002",
|
||||
"考试-初中-英语": "3477cff7cc9911efbfa50242ac140002",
|
||||
"考试-初中-政治": "7ac981d8cc9a11efa5dc0242ac140002",
|
||||
"考试-初中-历史": "c058a33acc9a11efb7f00242ac140002",
|
||||
"考试-初中-地理": "5548224ecc9b11efa76d0242ac140002",
|
||||
"考试-初中-生物": "206c5fd3cc9c11ef990f0242ac140002",
|
||||
"考试-初中-物理": "93039442cc9c11ef89b10242ac140002",
|
||||
"考试-初中-化学": "f8d78002cc9c11efbbf60242ac140002",
|
||||
"鉴权": "ragflow-IwMDI1MGU2YTU3NjExZWZiNWEzMDI0Mm"
|
||||
}
|
||||
|
|
|
@ -106,6 +106,22 @@ const getBackGroundV2 = async () => {
|
|||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
const createOutlineV2 = async (data) => {
|
||||
try {
|
||||
const response = await request({
|
||||
url:"/api/aipptV2/createOutlineV2",
|
||||
method: "POST",
|
||||
data
|
||||
});
|
||||
console.log("createOutline response:", response);
|
||||
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error("请求失败:", error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
const createPPTV2 = async (data) => {
|
||||
try {
|
||||
const response = await req("/api/aipptV2/createV2", "POST", data);
|
||||
|
@ -117,6 +133,18 @@ const createPPTV2 = async (data) => {
|
|||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
const createPptByOutline = async (data) => {
|
||||
try {
|
||||
const response = await req("/api/aipptV2/createPptByOutline", "POST", data);
|
||||
console.log("createOutline response:", response);
|
||||
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error("请求失败:", error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
const getProgressV2 = async (id) => {
|
||||
try {
|
||||
const response = await req(`/api/aipptV2/progressV2?sid=${id}`, "GET");
|
||||
|
@ -127,4 +155,4 @@ const getProgressV2 = async (id) => {
|
|||
}
|
||||
};
|
||||
|
||||
export { createOutline, getBackGround, createPPT, getProgress, getBackGroundV2, createPPTV2, getProgressV2, createByOutline };
|
||||
export { createOutline, getBackGround, createPPT, getProgress, getBackGroundV2, createOutlineV2, createPPTV2, getProgressV2, createByOutline, createPptByOutline };
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* ppt 转换为图片
|
||||
* ppt 相关方法
|
||||
*/
|
||||
import { h, render, getCurrentInstance } from 'vue'
|
||||
import { toPng, toJpeg } from 'html-to-image' // 引入html-to-image库
|
||||
|
@ -8,6 +8,7 @@ import ThumbnailSlide from '@/AixPPTist/src/views/components/ThumbnailSlide/inde
|
|||
import { useSlidesStore } from '@/AixPPTist/src/store'
|
||||
import * as ElementPlus from 'element-plus'
|
||||
import { sessionStore } from '@/utils/store' // electron-store 状态管理
|
||||
import { getStaticUrl } from '@/utils/tool' // 工具类
|
||||
import * as Http_Classcourse from '@/api/teaching/classcourse' // api接口
|
||||
|
||||
// 延时
|
||||
|
@ -129,3 +130,81 @@ export const ShareCode = async(code, cb) => {
|
|||
}
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/**
|
||||
* 提示框
|
||||
* @param {*} msg 内容
|
||||
* @param {*} title 标题
|
||||
* @param {*} option 配置
|
||||
* @param {*} cb 关闭前回调 ({ h, instance, action, done }, done)
|
||||
* @returns
|
||||
*/
|
||||
export const Alert = async (msg, title, option, cb) => {
|
||||
try {
|
||||
if (typeof msg == 'function') msg = await msg(h)
|
||||
return await ElementPlus.ElMessageBox.alert(msg, title, {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '关闭',
|
||||
showCancelButton: true,
|
||||
beforeClose: (action, instance, done) => {
|
||||
if (action == 'confirm') { // 确认
|
||||
if (!!cb) { // 回调
|
||||
cb({ h, instance, action, done }, done) && done()
|
||||
} else { // 默认确认
|
||||
done()
|
||||
}
|
||||
} else done()
|
||||
},
|
||||
...option,
|
||||
})
|
||||
} catch { }
|
||||
}
|
||||
/**
|
||||
* 课堂工具栏-钩子
|
||||
*/
|
||||
export const ToolType = {
|
||||
/** 分享码 */
|
||||
SHARE_CODE: 'shareCode',
|
||||
/** 课堂点名 */
|
||||
NAMED: 'named',
|
||||
}
|
||||
export const ToolHandle = async(type, data, cb) => {
|
||||
const classcourse = sessionStore.get('curr.classcourse') // 课堂信息
|
||||
switch (type) {
|
||||
case ToolType.SHARE_CODE:
|
||||
return ShareCode(data, cb)
|
||||
case ToolType.NAMED: {
|
||||
if (!classcourse) return ElementPlus.ElMessage.warning('没有课堂信息!')
|
||||
const avatar = getStaticUrl('/icon/avatar.svg')
|
||||
const timgroupid = classcourse.timgroupid
|
||||
if (!timgroupid) return ElementPlus.ElMessage.warning('没有课堂群信息!')
|
||||
// 课堂点名
|
||||
const res = await Http_Classcourse.rollCall(timgroupid)
|
||||
if (!(res && res.code == 200 && res.data)) return ElementPlus.ElMessage.warning('点名失败!')
|
||||
const userList = res?.data || []
|
||||
const refresh = () => { ToolHandle(ToolType.NAMED); return true }
|
||||
Alert(h => {
|
||||
const attr_0 = {style:{display:'flex',gap:'10px', cursor:'pointer'}}
|
||||
const attr_1 = { style:{display:'inline-flex',alignItems:'center',gap:'10px',padding:'5px 10px'}}
|
||||
const attr_2 = { src: avatar, style: { width: '50px', height: '50px' }}
|
||||
const attr_3 = { style: { fontSize: '20px', fontWeight: 'bold', color: '#409EFF' }}
|
||||
const attr_4 = { style: { fontSize: '12px' }}
|
||||
const userList_H = userList.map(o => {
|
||||
attr_1.title = o.name
|
||||
attr_4.style.color = o.online ? '#67C23A' : '#F56C6C'
|
||||
return h('div', attr_1, [
|
||||
h('img', attr_2),
|
||||
h('div', [
|
||||
h('p', attr_3, o.name),
|
||||
h('span', attr_4, o.online?'在线':'离线')
|
||||
])
|
||||
])
|
||||
})
|
||||
return h('div', attr_0, userList_H)
|
||||
}, '课堂点名', { confirmButtonText: '刷新' }, refresh)
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
|
@ -0,0 +1,138 @@
|
|||
/**
|
||||
* svg 相关工具类
|
||||
* @module svgUtils
|
||||
* import { svgUtils } from '@/utils/svgUtils'
|
||||
* @author: zdg
|
||||
*/
|
||||
|
||||
// zdg: 计算路径的边界
|
||||
export const calculatePathDimensions = (d) => {
|
||||
let minX = Infinity;
|
||||
let maxX = -Infinity;
|
||||
let minY = Infinity;
|
||||
let maxY = -Infinity;
|
||||
let currentX = 0;
|
||||
let currentY = 0;
|
||||
const commandRegex = /([A-Za-z])([^A-Za-z]+)/g;
|
||||
let match;
|
||||
while ((match = commandRegex.exec(d))!== null) {
|
||||
const type = match[1];
|
||||
const params = match[2].trim().split(/\s+|,/).map(Number);
|
||||
switch (type) {
|
||||
case 'M': // 移动到
|
||||
currentX = params[0];
|
||||
currentY = params[1];
|
||||
break;
|
||||
case 'L': // 直线到
|
||||
currentX = params[0];
|
||||
currentY = params[1];
|
||||
break;
|
||||
case 'H': // 水平直线
|
||||
currentX = params[0];
|
||||
break;
|
||||
case 'V': // 垂直直线
|
||||
currentY = params[0];
|
||||
break;
|
||||
case 'C': // 三次贝塞尔曲线
|
||||
for (let i = 0; i < params.length; i += 6) {
|
||||
const control1X = params[i];
|
||||
const control1Y = params[i + 1];
|
||||
const control2X = params[i + 2];
|
||||
const control2Y = params[i + 3];
|
||||
const endX = params[i + 4];
|
||||
const endY = params[i + 5];
|
||||
// 更新边界
|
||||
if (control1X < minX) minX = control1X;
|
||||
if (control1X > maxX) maxX = control1X;
|
||||
if (control1Y < minY) minY = control1Y;
|
||||
if (control1Y > maxY) maxY = control1Y;
|
||||
if (control2X < minX) minX = control2X;
|
||||
if (control2X > maxX) maxX = control2X;
|
||||
if (control2Y < minY) minY = control2Y;
|
||||
if (control2Y > maxY) maxY = control2Y;
|
||||
if (endX < minX) minX = endX;
|
||||
if (endX > maxX) maxX = endX;
|
||||
if (endY < minY) minY = endY;
|
||||
if (endY > maxY) maxY = endY;
|
||||
currentX = endX;
|
||||
currentY = endY;
|
||||
}
|
||||
break;
|
||||
case 'S': // 光滑三次贝塞尔曲线
|
||||
for (let i = 0; i < params.length; i += 4) {
|
||||
const controlX = params[i];
|
||||
const controlY = params[i + 1];
|
||||
const endX = params[i + 2];
|
||||
const endY = params[i + 3];
|
||||
// 更新边界
|
||||
if (controlX < minX) minX = controlX;
|
||||
if (controlX > maxX) maxX = controlX;
|
||||
if (controlY < minY) minY = controlY;
|
||||
if (controlY > maxY) maxY = controlY;
|
||||
if (endX < minX) minX = endX;
|
||||
if (endX > maxX) maxX = endX;
|
||||
if (endY < minY) minY = endY;
|
||||
if (endY > maxY) maxY = endY;
|
||||
currentX = endX;
|
||||
currentY = endY;
|
||||
}
|
||||
break;
|
||||
case 'Q': // 二次贝塞尔曲线
|
||||
for (let i = 0; i < params.length; i += 4) {
|
||||
const controlX = params[i];
|
||||
const controlY = params[i + 1];
|
||||
const endX = params[i + 2];
|
||||
const endY = params[i + 3];
|
||||
// 更新边界
|
||||
if (controlX < minX) minX = controlX;
|
||||
if (controlX > maxX) maxX = controlX;
|
||||
if (controlY < minY) minY = controlY;
|
||||
if (controlY > maxY) maxY = controlY;
|
||||
if (endX < minX) minX = endX;
|
||||
if (endX > maxX) maxX = endX;
|
||||
if (endY < minY) minY = endY;
|
||||
if (endY > maxY) maxY = endY;
|
||||
currentX = endX;
|
||||
currentY = endY;
|
||||
}
|
||||
break;
|
||||
case 'T': // 光滑二次贝塞尔曲线
|
||||
for (let i = 0; i < params.length; i += 2) {
|
||||
const endX = params[i];
|
||||
const endY = params[i + 1];
|
||||
// 更新边界
|
||||
if (endX < minX) minX = endX;
|
||||
if (endX > maxX) maxX = endX;
|
||||
if (endY < minY) minY = endY;
|
||||
if (endY > maxY) maxY = endY;
|
||||
currentX = endX;
|
||||
currentY = endY;
|
||||
}
|
||||
break;
|
||||
case 'A': // 椭圆弧
|
||||
const endX = params[5];
|
||||
const endY = params[6];
|
||||
// 更新边界
|
||||
if (endX < minX) minX = endX;
|
||||
if (endX > maxX) maxX = endX;
|
||||
if (endY < minY) minY = endY;
|
||||
if (endY > maxY) maxY = endY;
|
||||
currentX = endX;
|
||||
currentY = endY;
|
||||
break;
|
||||
case 'Z': // 闭合路径
|
||||
// 闭合路径不影响边界,这里不需要额外操作
|
||||
break;
|
||||
default:
|
||||
console.error(`Unknown command: ${type}`);
|
||||
break;
|
||||
}
|
||||
if (currentX < minX) minX = currentX;
|
||||
if (currentX > maxX) maxX = currentX;
|
||||
if (currentY < minY) minY = currentY;
|
||||
if (currentY > maxY) maxY = currentY;
|
||||
}
|
||||
const width = maxX - minX;
|
||||
const height = maxY - minY;
|
||||
return { width, height };
|
||||
}
|
|
@ -9,11 +9,8 @@
|
|||
<div style="font-size: 16px;font-weight: bold;color: #000;text-align: left;margin-bottom: 5px">可用分组</div>
|
||||
<div class="groupList">
|
||||
<template v-for="(item,index) in groupList" :key="index">
|
||||
<el-card style="width: 20%;
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;
|
||||
cursor: pointer;
|
||||
position: relative;"
|
||||
<el-card
|
||||
class="card_div"
|
||||
v-if="item.parentid === 0"
|
||||
@mouseenter="cardEnter(item,index)"
|
||||
@mouseleave="cardLeave(item,index)"
|
||||
|
@ -391,6 +388,7 @@ watch(()=> props.classId,()=> {
|
|||
.groupList{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap:10px;
|
||||
}
|
||||
.card-row {
|
||||
font-size: 12px;
|
||||
|
@ -415,4 +413,10 @@ watch(()=> props.classId,()=> {
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.card_div{
|
||||
width: calc(20% - 10px);
|
||||
margin-bottom: 10px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,14 +1,69 @@
|
|||
<template>
|
||||
<el-card style="width: 100%;height: 100%">
|
||||
<el-descriptions :column="1">
|
||||
<el-descriptions-item label="班级名称">{{ classInfo.caption }}</el-descriptions-item>
|
||||
<el-descriptions-item label="教师">
|
||||
<el-descriptions
|
||||
class="margin-top"
|
||||
:column="6"
|
||||
:size="size"
|
||||
border
|
||||
>
|
||||
<el-descriptions-item :span="2" :width="120">
|
||||
<template #label>
|
||||
<div class="cell-item">
|
||||
<el-icon :style="iconStyle">
|
||||
<user />
|
||||
</el-icon>
|
||||
班级名称
|
||||
</div>
|
||||
</template>
|
||||
{{ classInfo.caption }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :span="2" :width="120">
|
||||
<template #label>
|
||||
<div class="cell-item">
|
||||
<el-icon :style="iconStyle">
|
||||
<tickets />
|
||||
</el-icon>
|
||||
学段
|
||||
</div>
|
||||
</template>
|
||||
{{ currentGrade }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :span="2" :width="120">
|
||||
<template #label>
|
||||
<div class="cell-item">
|
||||
<el-icon :style="iconStyle">
|
||||
<location />
|
||||
</el-icon>
|
||||
年级
|
||||
</div>
|
||||
</template>
|
||||
{{ currentGradeName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :span="2" :width="120">
|
||||
<template #label>
|
||||
<div class="cell-item">
|
||||
<el-icon :style="iconStyle">
|
||||
<iphone />
|
||||
</el-icon>
|
||||
学生人数
|
||||
</div>
|
||||
</template>
|
||||
{{ classInfo.classstudentcount || 0 }}人
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :span="4" :width="120">
|
||||
<template #label>
|
||||
<div class="cell-item">
|
||||
<el-icon :style="iconStyle">
|
||||
<office-building />
|
||||
</el-icon>
|
||||
教师
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="classInfo.teacher.length > 0">
|
||||
<el-tag style="margin-right: 5px;margin-bottom: 5px;" type="primary" v-for="(item, index) in classInfo.teacher" :key="index">{{item.name}}</el-tag>
|
||||
</template>
|
||||
<template v-else>{{ classInfo.teachername }}</template>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="学生人数">{{ classInfo.classstudentcount || 0 }}人</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-card>
|
||||
</template>
|
||||
|
@ -17,7 +72,7 @@
|
|||
import {ElMessage, ElMessageBox} from "element-plus";
|
||||
import { getClassmain,listClassuser,leaveClass} from '@/api/classManage/index'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import {reactive,onMounted,nextTick,watch} from 'vue'
|
||||
import {reactive,onMounted,nextTick,watch,ref} from 'vue'
|
||||
import delClassDemo from '@/store/modules/delClass'
|
||||
const props = defineProps({
|
||||
classId: {
|
||||
|
@ -31,6 +86,36 @@
|
|||
})
|
||||
const isDelClass = delClassDemo()
|
||||
const userStore = useUserStore().user
|
||||
// 当前年级
|
||||
const currentGradeName = ref('')
|
||||
// 当前学段
|
||||
const currentGrade = ref('')
|
||||
// 获取年级
|
||||
const gradeDataList = reactive([
|
||||
[
|
||||
{ label: '一年级', agekey: 1, checked: false, current: 1 },
|
||||
{ label: '二年级', agekey: 2, checked: false, current: 1 },
|
||||
{ label: '三年级', agekey: 3, checked: false, current: 1 },
|
||||
{ label: '四年级', agekey: 4, checked: false, current: 1 },
|
||||
{ label: '五年级', agekey: 5, checked: false, current: 1 },
|
||||
{ label: '六年级', agekey: 6, checked: false, current: 1 },
|
||||
],
|
||||
[
|
||||
{ label: '初一', agekey: 7, checked: false, current: 2 },
|
||||
{ label: '初二', agekey: 8, checked: false, current: 2 },
|
||||
{ label: '初三', agekey: 9, checked: false, current: 2 },
|
||||
],
|
||||
[
|
||||
{ label: '高一', agekey: 10, checked: false, current: 3 },
|
||||
{ label: '高二', agekey: 11, checked: false, current: 3 },
|
||||
{ label: '高三', agekey: 12, checked: false, current: 3 },
|
||||
],
|
||||
])
|
||||
const gradeData = reactive([
|
||||
{current:1, label:'小学',},
|
||||
{current:2, label:'初中',},
|
||||
{current:3, label:'高中',},
|
||||
])
|
||||
//删除教室
|
||||
const deleteClassRoom = () => {
|
||||
ElMessageBox.alert('确认删除该班级?', {
|
||||
|
@ -53,6 +138,14 @@
|
|||
if(props.classId){
|
||||
getClassmain(props.classId).then(response => {
|
||||
Object.assign(classInfo,response.data)
|
||||
//先把二级数组转化为一级数组,用于筛选
|
||||
const flatGradeDataList = gradeDataList.flat();
|
||||
//学段和年级的回显处理
|
||||
const currentIndex = flatGradeDataList.findIndex(item => item.agekey === Number(response.data.agekey));
|
||||
currentGradeName.value = flatGradeDataList[currentIndex].label
|
||||
const current = flatGradeDataList[currentIndex].current
|
||||
currentGrade.value = gradeData.find(item => item.current === current).label
|
||||
console.log(classInfo,'classInfo');
|
||||
listClassuser({classid:props.classId,pageSize:100}).then(res => {
|
||||
classInfo.teacher = res.rows.filter(item => item.inrole === 'teacher')
|
||||
classInfo.student = res.rows.filter(item => item.inrole === 'student')
|
||||
|
@ -71,5 +164,14 @@
|
|||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.el-descriptions {
|
||||
margin-top: 20px;
|
||||
}
|
||||
.cell-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.margin-top {
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -0,0 +1,195 @@
|
|||
<template>
|
||||
<div class="page-testpaper">
|
||||
<div class="page-center">
|
||||
<el-tabs v-model="activeAptTab" style="height: 100%;">
|
||||
<el-tab-pane label="自主搜题" name="自主搜题" class="prepare-center-zzst">
|
||||
<SearchQuestion :bookobj="courseObj" @addQuizItem="handleClassWorkQuizItemAdd" />
|
||||
</el-tab-pane>
|
||||
<!-- <el-tab-pane label="校本题库" name="校本题库" class="prepare-center-xbtk">
|
||||
<SchoolQuestion />
|
||||
</el-tab-pane> -->
|
||||
<el-tab-pane label="个人题库" name="个人题库" class="prepare-center-grst">
|
||||
<MyQuestion :bookobj="courseObj" @addQuizItem="handleClassWorkQuizItemAdd"/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
<div class="page-right">
|
||||
<p>总{{ classWorkForm.quizlist.length }}题 <span>进入组卷中心</span></p>
|
||||
<div v-for="(item, index) in classWorkForm.worktypeList" :key="index" class="page-right-item">
|
||||
<span>{{ item.key }}: {{ item.value }}题</span> <span @click="handleDeleteQuizItem(item)">删除</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { onMounted, ref, watch, reactive, getCurrentInstance, nextTick, defineEmits } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import { processList } from '@/hooks/useProcessList'
|
||||
|
||||
import MyQuestion from '@/views/classTask/newClassTaskAssign/myQuestion/index.vue'
|
||||
import SearchQuestion from '@/views/classTask/newClassTaskAssign/searchQuestion/index.vue'
|
||||
|
||||
import { useGetHomework } from '@/hooks/useGetHomework'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import useClassTaskStore from '@/store/modules/classTask'
|
||||
|
||||
const userStore = useUserStore().user
|
||||
const route = useRoute();
|
||||
const router = useRouter()
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const emits = defineEmits(['getData'])
|
||||
const props = defineProps({
|
||||
currentCourse: Object,
|
||||
})
|
||||
|
||||
const propsQueryCourseObj = route.query.courseObj;//作业布置的内容对象
|
||||
const courseObj = reactive({
|
||||
// 课程相关参数: 教材id,单元id,章节id,课程名称
|
||||
textbookId: '',
|
||||
levelFirstId: '',
|
||||
levelSecondId: '',
|
||||
coursetitle:'',
|
||||
node: null, // 选择的课程节点
|
||||
//
|
||||
})
|
||||
const activeAptTab = ref("自主搜题");
|
||||
let classWorkForm = reactive({
|
||||
id: '',// ,
|
||||
uniquekey: '',// , // 作业唯一标识 作业名称
|
||||
worktype: '',// '习题训练', //作业类型
|
||||
worktypeList: [],// '习题训练', //作业类型
|
||||
title: '',// // 作业说明
|
||||
quizlist: [],// // 作业习题列表内容
|
||||
}); // 需要提交 提交的作业内容
|
||||
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
if(propsQueryCourseObj){
|
||||
if(JSON.parse(propsQueryCourseObj)){
|
||||
courseObj.textbookId = JSON.parse(propsQueryCourseObj).bookObj // 版本
|
||||
courseObj.levelFirstId = JSON.parse(propsQueryCourseObj).levelFirstId // 单元
|
||||
courseObj.levelSecondId = JSON.parse(propsQueryCourseObj).levelSecondId // 章节
|
||||
courseObj.coursetitle = JSON.parse(propsQueryCourseObj).coursetitle // (单元/章节) 名称
|
||||
courseObj.node = JSON.parse(propsQueryCourseObj).node; // 保存当前节点
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* 添加作业
|
||||
* @param entpcourseworkid
|
||||
*/
|
||||
const handleClassWorkQuizItemAdd = (row) => {
|
||||
var exist = false;
|
||||
for (var i=0; i< classWorkForm.quizlist.length; i++) {
|
||||
if (classWorkForm.quizlist[i].id == row.id) {
|
||||
exist = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (exist == false) {
|
||||
// getEntpcoursework(entpcourseworkid).then(res => {
|
||||
// //res.data.titletext = res.data.title.replace(/<[^>]+>/g, '');
|
||||
// // 暂时手动新增试题的分数
|
||||
// if(res.data.score == null){
|
||||
// res.data.score = 4;
|
||||
// }
|
||||
// classWorkForm.quizlist.push(res.data);
|
||||
// // 格式化试题
|
||||
// processList(classWorkForm.quizlist);
|
||||
// })
|
||||
|
||||
// TODO 先写死
|
||||
classWorkForm.quizlist.push(row);
|
||||
// 格式化试题
|
||||
processList(classWorkForm.quizlist);
|
||||
|
||||
console.log(classWorkForm.quizlist)
|
||||
// 作业类型分类
|
||||
classWorkForm.quizlist && classWorkForm.quizlist.forEach(item => {
|
||||
if(!classWorkForm.worktypeList.some(i => i.key.includes(item.worktype))){
|
||||
const num = classWorkForm.quizlist.filter(_item => _item.key == item.worktype).length
|
||||
const obj = {
|
||||
key: item.worktype,
|
||||
value: num
|
||||
}
|
||||
classWorkForm.worktypeList.push(obj)
|
||||
}
|
||||
})
|
||||
console.log(classWorkForm.worktypeList)
|
||||
|
||||
} else {
|
||||
ElMessage('试题已经存在')
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 删除作业类型试题
|
||||
* @param row
|
||||
*/
|
||||
const handleDeleteQuizItem = (row) => {
|
||||
for (var i=0; i< classWorkForm.worktypeList.length; i++) {
|
||||
if (classWorkForm.worktypeList[i].key == row.key) {
|
||||
classWorkForm.worktypeList.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (var j=0; j< classWorkForm.quizlist.length; j++) {
|
||||
if (classWorkForm.quizlist[j].worktype == row.key) {
|
||||
classWorkForm.quizlist.splice(j, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
watch(() => props.currentCourse, (newVal, oldVal) => {
|
||||
|
||||
},{deep:true})
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.page-testpaper {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
.page-center{
|
||||
flex: 1;
|
||||
//min-width: calc(100% - 675px);
|
||||
height: 100%;
|
||||
padding: 0 5px;
|
||||
margin: 0 5px;
|
||||
overflow: hidden;
|
||||
border-radius: 10px;
|
||||
background-color: white;
|
||||
|
||||
.prepare-center-zzst{
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
|
||||
}
|
||||
.prepare-center-xbtk{
|
||||
height: 100%;
|
||||
}
|
||||
.prepare-center-grst{
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.page-right{
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
|
@ -38,6 +38,7 @@ const items = shallowRef([
|
|||
// { title: 'AI设计作业', description: '通过AI助手,根据课标、教材、考试等分析结果,智能创建作业。', icon: '#icon-jiqiren_o',type:'danger' },
|
||||
{ title: '习题上传', description: '自己上传个人题库。', icon: '#icon-shangchuan',type:'danger' },
|
||||
{ title: '科学实验', description: '学生完成虚拟仿真实验,并提交实验结果。', icon: '#icon-shangchuan',type:'primary' },
|
||||
// { title: '自主组卷', description: '老师自主选择试题组卷。', icon: '#icon-shangchuan',type:'primary' },
|
||||
]);
|
||||
|
||||
const handleClick = (item) => {
|
||||
|
|
|
@ -1,26 +1,24 @@
|
|||
<template>
|
||||
<div class="page">
|
||||
<div class="page-top" v-if="!isShow">
|
||||
<div class="page-top-left">
|
||||
<div>
|
||||
<el-button type="danger" :icon="Delete" @click="handleDelete">删除</el-button>
|
||||
<el-button type="success" @click="handleTaskAssignToAllClass()">批量推送</el-button>
|
||||
</div>
|
||||
<div v-if="currentRow.id > 0" class="page-top-right">
|
||||
<el-button type="primary" @click="handleNewAllClass" :icon="Plus">设计新作业</el-button>
|
||||
<div style="margin-left: 20px;">
|
||||
<div v-if="currentRow.id > 0">
|
||||
<el-button type="primary" @click="handleNewAllClass"><i class="iconfont icon-fanhui"></i>返回 设计作业</el-button>
|
||||
</div>
|
||||
<div v-else>
|
||||
<span style="font-size: 14px; color: red">温馨提示:选择下列作业类型可进行作业设计</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="page-resource">
|
||||
<div class="page-left" v-if="!isShow">
|
||||
<el-table
|
||||
ref="taskTable"
|
||||
v-loading="tasklist_loading"
|
||||
:data="taskList"
|
||||
:tree-props="{checkStrictly: true}"
|
||||
row-key="id"
|
||||
style="width: 100%;height: 100%; border: 1px solid #dcdfe6;border-radius: 3px;flex:1"
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentChange"
|
||||
>
|
||||
<el-table ref="taskTable" v-loading="tasklist_loading" :data="taskList" :tree-props="{ checkStrictly: true }"
|
||||
row-key="id" style="width: 100%;height: 100%; border: 1px solid #dcdfe6;border-radius: 3px;flex:1"
|
||||
highlight-current-row @current-change="handleCurrentChange">
|
||||
<el-table-column type="selection" min-width="2%" align="center" :selectable="selectable" />
|
||||
<el-table-column label="作业布置" min-width="15%" align="center">
|
||||
<template #default="scope">
|
||||
|
@ -31,11 +29,13 @@
|
|||
<span>{{ scope.row.uniquekey }}</span>
|
||||
</div>
|
||||
<div class="pageleft-table-top" style="display: flex;justify-content: space-between">
|
||||
<el-tag style="padding:0 2px" :type="scope.row.workclass" size="default">{{ scope.row.worktype }}</el-tag>
|
||||
<el-tag style="padding:0 2px" :type="scope.row.workclass" size="default">{{ scope.row.worktype
|
||||
}}</el-tag>
|
||||
<el-text size="small" style="color:#ccc;white-space:nowrap">{{ scope.row.timestamp }}</el-text>
|
||||
</div>
|
||||
<div class="pageleft-table-cont">
|
||||
<div :title="scope.row.worktag || scope.row.title" class="ellipsis "> {{ scope.row.worktype == "课堂展示" ? scope.row.worktag : scope.row.title }}</div>
|
||||
<div :title="scope.row.worktag || scope.row.title" class="ellipsis "> {{ scope.row.worktype ==
|
||||
"课堂展示" ? scope.row.worktag : scope.row.title }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<svg class="icon iconfont" aria-hidden="true">
|
||||
|
@ -53,7 +53,8 @@
|
|||
<Right @itemClick="handleItemClick" />
|
||||
</div>
|
||||
|
||||
<div v-if="(currentRow.worktype == '习题训练' || classWorkForm.worktype == '习题训练') && currentRow.id>0" class="page-center">
|
||||
<div v-if="(currentRow.worktype == '习题训练' || classWorkForm.worktype == '习题训练') && currentRow.id > 0"
|
||||
class="page-center">
|
||||
<el-tabs v-model="activeAptTab" style="height: 100%;">
|
||||
<el-tab-pane label="自主搜题" name="自主搜题" class="prepare-center-zzst">
|
||||
<SearchQuestion :bookobj="courseObj" @addQuiz="handleClassWorkQuizAdd" />
|
||||
|
@ -66,17 +67,22 @@
|
|||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
<div v-if="(currentRow.worktype == '课堂展示' || classWorkForm.worktype == '课堂展示') && currentRow.id>0" class="page-center">
|
||||
<div v-if="(currentRow.worktype == '课堂展示' || classWorkForm.worktype == '课堂展示') && currentRow.id > 0"
|
||||
class="page-center">
|
||||
<div v-loading="boardLoading" class="board-wrap" style="height: 100%; flex: 1; overflow: hidden;">
|
||||
<whiteboard ref="boardref" height="100%" width="100%" :isShowSave="false" :data="classWorkForm.whiteboardObj" />
|
||||
<whiteboard ref="boardref" height="100%" width="100%" :isShowSave="false"
|
||||
:data="classWorkForm.whiteboardObj" />
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="(currentRow.worktype == '常规作业' || classWorkForm.worktype == '常规作业')&& currentRow.id>0" class="page-center">
|
||||
<div v-if="(currentRow.worktype == '常规作业' || classWorkForm.worktype == '常规作业') && currentRow.id > 0"
|
||||
class="page-center">
|
||||
<div v-loading="fileLoading" class="upload-homework">
|
||||
<FileUpload v-model="classWorkForm.fileHomeworkList" :fileSize="800" :fileType="['mp3','mp4','doc','docx','xlsx','xls','pdf','ppt','pptx','jpg','jpeg','gif','png','txt']"/>
|
||||
<FileUpload v-model="classWorkForm.fileHomeworkList" :fileSize="800"
|
||||
:fileType="['mp3', 'mp4', 'doc', 'docx', 'xlsx', 'xls', 'pdf', 'ppt', 'pptx', 'jpg', 'jpeg', 'gif', 'png', 'txt']" />
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="(currentRow.worktype == '科学实验' || classWorkForm.worktype == '科学实验')&& currentRow.id>0" class="page-center">
|
||||
<div v-if="(currentRow.worktype == '科学实验' || classWorkForm.worktype == '科学实验') && currentRow.id > 0"
|
||||
class="page-center">
|
||||
<div class="experiment-homework">
|
||||
<ExperimentQuestion :expObj="classWorkForm.fileHomeworkList&&classWorkForm.fileHomeworkList[0]" @clickExpObj="getExpObj" />
|
||||
</div>
|
||||
|
@ -84,29 +90,29 @@
|
|||
|
||||
<div v-if="currentRow.id > 0" class="page-right">
|
||||
<div class="prepare-top">
|
||||
<span>作业详情说明</span>
|
||||
<el-button v-if="currentRow.id != 1" type="success" @click="openSet(currentRow, 'item')">推 送</el-button>
|
||||
<el-button type="primary" @click="handleClassWorkSave">保 存</el-button>
|
||||
</div>
|
||||
<div class="prepare-con">
|
||||
<el-form
|
||||
ref="classWorkFormRef"
|
||||
:model="classWorkForm"
|
||||
label-width="90"
|
||||
style=" height: 100%; overflow: hidden;display: flex;flex-direction: column;"
|
||||
>
|
||||
<el-form ref="classWorkFormRef" :model="classWorkForm" label-width="90"
|
||||
style=" height: 100%; overflow: hidden;display: flex;flex-direction: column;">
|
||||
<div>
|
||||
<el-form-item label="作业名称">
|
||||
<el-input v-model="classWorkForm.uniquekey" type="text" placeholder="请输入作业名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="作业说明" style="margin: 10px 0;">
|
||||
<el-input v-if="classWorkForm.worktype != '课堂展示'" v-model="classWorkForm.title" style="width: 400px" placeholder="请输入作业说明"/>
|
||||
<el-input v-if="classWorkForm.worktype != '课堂展示'" v-model="classWorkForm.title" style="width: 400px"
|
||||
placeholder="请输入作业说明" />
|
||||
<!-- 课堂展示 这里字段不一样 -->
|
||||
<el-input v-if="classWorkForm.worktype == '课堂展示'" v-model="classWorkForm.question" type="textarea" placeholder="请输入作业说明" />
|
||||
<el-input v-if="classWorkForm.worktype == '课堂展示'" v-model="classWorkForm.question" type="textarea"
|
||||
placeholder="请输入作业说明" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<div v-if="classWorkForm.worktype == '习题训练'" class="pageRight-list">
|
||||
<div :style="{height: '100%', 'overflow': 'auto', 'border':'1px dotted blue','border-radius':'5px', 'background-color': '#f7f7f7'}">
|
||||
<div
|
||||
:style="{ height: '100%', 'overflow': 'auto', 'border': '1px dotted blue', 'border-radius': '5px', 'background-color': '#f7f7f7' }">
|
||||
<template v-for="(item, index) in classWorkForm.quizlist" :key="item.id">
|
||||
<div style="margin: 5px; background-color: white; text-align: left;">
|
||||
<div v-html="item.titleFormat" style="padding: 15px 20px 5px 20px"></div>
|
||||
|
@ -114,7 +120,8 @@
|
|||
<el-form-item label="分值">
|
||||
<el-input-number v-model="item.score" :min="1" :max="100" size="small"></el-input-number>
|
||||
</el-form-item>
|
||||
<div style="margin-left: auto; padding: 0px 20px"><el-button size="small" type="danger" @click="handleClassWorkFormQuizRemove(index)">删除</el-button></div>
|
||||
<div style="margin-left: auto; padding: 0px 20px"><el-button size="small" type="danger"
|
||||
@click="handleClassWorkFormQuizRemove(index)">删除</el-button></div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -126,7 +133,8 @@
|
|||
</div>
|
||||
|
||||
<!-- 推送作业的配置对话框 -->
|
||||
<SetHomework v-model="setDialog" :entpcourseid="entpcourseid" :rows="rowsList" @on-close="closeHomework" @on-success="successHomework"/>
|
||||
<SetHomework v-model="setDialog" :entpcourseid="entpcourseid" :rows="rowsList" @on-close="closeHomework"
|
||||
@on-success="successHomework" />
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
|
@ -161,6 +169,7 @@ const route = useRoute();
|
|||
const router = useRouter()
|
||||
const { proxy } = getCurrentInstance()
|
||||
const useClassTaskStores = useClassTaskStore();
|
||||
const { ipcRenderer } = require('electron')
|
||||
|
||||
const props = defineProps({
|
||||
currentCourse: Object,
|
||||
|
@ -284,6 +293,10 @@ const handleItemClick = (itemName) => {
|
|||
router.push({ path: '/model/questionUpload', query: { courseObj: JSON.stringify(courseObj) } });
|
||||
return;
|
||||
}
|
||||
if (itemName == '自主组卷') {
|
||||
router.push({ path: '/model/groupTestPaper', query: { courseObj: JSON.stringify(courseObj) } });
|
||||
return;
|
||||
}
|
||||
|
||||
currentRow.value.id = 1; // 作业设计
|
||||
/**
|
||||
|
@ -456,9 +469,11 @@ let propsformobj = reactive({
|
|||
*/
|
||||
const handleCurrentChange = (val) => {
|
||||
|
||||
console.log(val,'???????????')
|
||||
console.log(val, '选中的布置作业')
|
||||
if (val && val.id > 0) {
|
||||
currentRow.value.id = 1;
|
||||
const typeName = val.worktype == "习题训练" ? "自主搜题" : "";
|
||||
activeAptTab.value = typeName;
|
||||
classWorkForm.worktype = val.worktype; //作业类型
|
||||
editListItem(val, courseObj).then((obj) => {
|
||||
if (obj) {
|
||||
|
@ -770,7 +785,8 @@ const editWork = async (cform) =>{
|
|||
'workid': classWorkForm.id,
|
||||
'entpcourseworkid': classWorkForm.quizlist[i].id,
|
||||
'workdataid': 0,
|
||||
'score': classWorkForm.quizlist[i].score}
|
||||
'score': classWorkForm.quizlist[i].score
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -841,6 +857,22 @@ const editWork = async (cform) =>{
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
// 测试, 未实装
|
||||
const handlePrint = () => {
|
||||
const printOptions = {
|
||||
silent: false, // 是否静默打印
|
||||
printBackground: true, // 是否打印背景颜色和图像
|
||||
color: false, // 是否打印为黑白
|
||||
marginsType: 0, // 边距类型,0: 默认边距,1: 无边距,2: 最小边距
|
||||
pageSize: 'A4', // 纸张大小
|
||||
// 其他选项可以根据需要配置
|
||||
};
|
||||
|
||||
console.log("print-page-click");
|
||||
ipcRenderer.send('printPage', printOptions);
|
||||
};
|
||||
|
||||
//----
|
||||
|
||||
|
||||
|
@ -848,29 +880,33 @@ const editWork = async (cform) =>{
|
|||
<style scoped lang="scss">
|
||||
.page {
|
||||
height: 100%;
|
||||
|
||||
.page-top {
|
||||
height: 50px;
|
||||
margin-bottom: 5px;
|
||||
padding: 0 10px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
flex-direction: row;
|
||||
background-color: white;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 0px 20px 0px rgba(99, 99, 99, 0.06);
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.page-resource {
|
||||
user-select: none;
|
||||
height: calc(100% - 55px);
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
|
||||
:deep(.el-tabs__nav) {
|
||||
.el-tabs__item {
|
||||
font-weight: bold;
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
.page-left {
|
||||
width: 240px;
|
||||
background-color: white;
|
||||
|
@ -883,6 +919,7 @@ const editWork = async (cform) =>{
|
|||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.pageleft-table-cont {
|
||||
height: 35px;
|
||||
// width: 100%;
|
||||
|
@ -891,20 +928,29 @@ const editWork = async (cform) =>{
|
|||
// overflow: hidden;
|
||||
// flex-direction: row;
|
||||
// text-overflow: ellipsis;
|
||||
width: 100%; /* 设置容器的宽度 */
|
||||
overflow: hidden; /* 隐藏超出容器的部分 */
|
||||
white-space: nowrap; /* 防止文本换行 */
|
||||
text-overflow: ellipsis; /* 超出部分显示省略号 */
|
||||
width: 100%;
|
||||
/* 设置容器的宽度 */
|
||||
overflow: hidden;
|
||||
/* 隐藏超出容器的部分 */
|
||||
white-space: nowrap;
|
||||
/* 防止文本换行 */
|
||||
text-overflow: ellipsis;
|
||||
|
||||
/* 超出部分显示省略号 */
|
||||
.ellipsis {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
overflow: hidden; /* 隐藏超出容器的部分 */
|
||||
white-space: nowrap; /* 防止文本换行 */
|
||||
text-overflow: ellipsis; /* 超出部分显示省略号 */
|
||||
overflow: hidden;
|
||||
/* 隐藏超出容器的部分 */
|
||||
white-space: nowrap;
|
||||
/* 防止文本换行 */
|
||||
text-overflow: ellipsis;
|
||||
/* 超出部分显示省略号 */
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.page-center {
|
||||
flex: 1;
|
||||
//min-width: calc(100% - 675px);
|
||||
|
@ -922,9 +968,11 @@ const editWork = async (cform) =>{
|
|||
|
||||
|
||||
}
|
||||
|
||||
.prepare-center-xbtk {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.prepare-center-grst {
|
||||
height: 100%;
|
||||
}
|
||||
|
@ -940,6 +988,7 @@ const editWork = async (cform) =>{
|
|||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.page-right {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
|
@ -951,14 +1000,16 @@ const editWork = async (cform) =>{
|
|||
box-shadow: 0px 0px 20px 0px rgba(99, 99, 99, 0.06);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.prepare-top {
|
||||
display: flex;
|
||||
height: 40px;
|
||||
margin: 0 10px;
|
||||
border-bottom: 2px solid #e5e7eb;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.prepare-con {
|
||||
height: 100%;
|
||||
padding: 5px 10px;
|
||||
|
@ -977,5 +1028,8 @@ const editWork = async (cform) =>{
|
|||
}
|
||||
}
|
||||
}
|
||||
::v-deep img {
|
||||
display: inline-block !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
<el-table-column align="left" width="100">
|
||||
<template #default="scope">
|
||||
<el-button v-if="props.isHtml2canvas" type="primary" @click="captureScreenshot(scope.row.id)">选取该题</el-button>
|
||||
<el-button v-else type="primary" @click="handleClassWorkQuizAdd('entpcourseworklist', scope.row.id)">添加</el-button>
|
||||
<el-button v-else type="primary" @click="handleClassWorkQuizAdd(scope.row, scope.row.id)">添加</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -126,7 +126,7 @@ import useUserStore from '@/store/modules/user'
|
|||
import useClassTaskStore from '@/store/modules/classTask'
|
||||
|
||||
// 定义要发送的emit事件
|
||||
let emit = defineEmits(['addQuiz', 'addQuizImgBs64'])
|
||||
let emit = defineEmits(['addQuiz', 'addQuizImgBs64', "addQuizItem"])
|
||||
const { proxy } = getCurrentInstance()
|
||||
const userStore = useUserStore().user
|
||||
const {
|
||||
|
@ -420,11 +420,13 @@ const getPaginationList = async ( page, limit ) => {
|
|||
|
||||
/**
|
||||
* 添加资源
|
||||
* @param fromsrc - 试题来源
|
||||
* @param rw - 试题itemINFO
|
||||
* @param entpcourseworkid
|
||||
*/
|
||||
const handleClassWorkQuizAdd = (fromsrc, entpcourseworkid) => {
|
||||
const handleClassWorkQuizAdd = (row, entpcourseworkid) => {
|
||||
emit('addQuiz', entpcourseworkid);
|
||||
emit('addQuizItem', row); // TODO 暂时使用,后面修改逻辑---添加到 自主组卷
|
||||
|
||||
// var exist = false;
|
||||
// for (var i=0; i< classWorkForm.quizlist.length; i++) {
|
||||
// if (classWorkForm.quizlist[i].id == entpcourseworkid) {
|
||||
|
|
|
@ -821,6 +821,7 @@ onUnmounted(() => {
|
|||
|
||||
<style scoped lang="scss">
|
||||
.teachClassTask{
|
||||
padding: 10px;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
|
||||
<script setup >
|
||||
import { ref, reactive, onMounted ,watch} from 'vue'
|
||||
import { regionData, codeToText } from 'element-china-area-data'
|
||||
import { regionData, codeToText } from '@/plugins/china-area-data-json'
|
||||
import { getUserProfile } from '@/api/system/user'
|
||||
import {getDept} from '@/api/login'
|
||||
import {school} from '@/api/apiService'
|
||||
|
|
|
@ -114,7 +114,7 @@ import { ref, defineExpose, reactive ,onMounted} from 'vue'
|
|||
import {captchaImg,sendCode,deptTree,getDept,listClassmain,listEvaluation,signIn, retrievePwd} from '@/api/login'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import {setToken, removeToken } from '@/utils/auth'
|
||||
import { regionData, codeToText } from 'element-china-area-data'
|
||||
import { regionData, codeToText } from '@/plugins/china-area-data-json'
|
||||
const ruleFormRef = ref(null)
|
||||
const activeIndex=ref(1)
|
||||
const ruleForm = reactive({
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="login-container">
|
||||
<div class="box-item desc">
|
||||
<div class="box-item desc" style="flex: 1">
|
||||
<div class="welcome">
|
||||
<p>欢迎登录 {{ homeTitle }}</p>
|
||||
</div>
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
<template>
|
||||
<ycLogin v-if="buildMode === 'yc'||buildMode === 'yc2'">
|
||||
</ycLogin>
|
||||
<yyLogin v-else-if="buildMode === 'yy'">
|
||||
</yyLogin>
|
||||
<defultLogin v-else>
|
||||
</defultLogin>
|
||||
</template>
|
||||
<script setup>
|
||||
import ycLogin from './yc-login.vue'
|
||||
import yyLogin from './yy-login.vue'
|
||||
import defultLogin from './defult-login.vue'
|
||||
const buildMode = import.meta.env.MODE
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,458 @@
|
|||
<template>
|
||||
<div class="login-container">
|
||||
<div class="login-yc">
|
||||
<img class="welcome-img" :src="leftBg1" />
|
||||
</div>
|
||||
<div class="box-item login" v-if="isRegister">
|
||||
<WindowTools :is-has-max="false" />
|
||||
<div style="display: flex;justify-content: center;"><img class="title-logo" :src="yylogo" /></div>
|
||||
<div class="login-title">育人酉数平台</div>
|
||||
<el-form ref="formRef" class="login-form" :model="loginForm" :rules="rules" size="large">
|
||||
<el-form-item prop="username">
|
||||
<el-input v-model.trim="loginForm.username" placeholder="请输入用户名" />
|
||||
</el-form-item>
|
||||
<el-form-item prop="password" style="margin-bottom: 15px">
|
||||
<el-input v-model="loginForm.password" autocomplete="on" type="password" placeholder="请输入密码" />
|
||||
</el-form-item>
|
||||
<div class="flex mb-5">
|
||||
<el-checkbox v-model="loginForm.rememberMe">记住密码</el-checkbox>
|
||||
<!-- <el-checkbox >阅读并同意《xxx》</el-checkbox> -->
|
||||
</div>
|
||||
|
||||
<el-form-item style="margin-bottom: 20px">
|
||||
<el-button :loading="btnLoading" class="btn" type="primary" @click="submitForm(formRef)">登录</el-button>
|
||||
</el-form-item>
|
||||
<div class="flex mb-4" style="display: flex;justify-content: center;color: #ccc;cursor: pointer;">
|
||||
<a class="hover:text-sky-500" style="margin-right: 10px;" @click="gotoreRegister">注册账号</a>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div class="box-item login" v-else>
|
||||
<WindowTools :is-has-max="false" />
|
||||
<div class="login-title">账号注册</div>
|
||||
<el-form ref="ruleFormRef" class="login-form" :model="ruleForm" label-width="auto" :rules="rules" size="large">
|
||||
<el-form-item label="手机号" prop="username">
|
||||
<el-input v-model="ruleForm.username" placeholder="请输入手机号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="验证码" prop="smsCode" style="display: flex">
|
||||
<el-input style="width:185px" v-model="ruleForm.smsCode" placeholder="请输入验证码" /><el-button style="margin-left:10px;width:100px" :disabled="codeName=='发送验证码'?false:true" type="primary" @click="sendyzm">{{ codeName }}</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="密码" prop="password" >
|
||||
<el-input autocomplete="on" type="password" v-model="ruleForm.password" placeholder="请输入密码" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button class="btn" type="primary" @click="RegisterForm(ruleFormRef)">立即注册</el-button>
|
||||
</el-form-item>
|
||||
<div class="flex mb-4" style="display: flex;justify-content: center;color: #ccc;cursor: pointer;">
|
||||
<a class="hover:text-sky-500" style="margin-right: 10px;" @click="gotoLogin"> 《 返回登录 </a>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog v-model="showDownLoading" width="500" :show-close="false" :close-on-click-modal="false"
|
||||
:close-on-press-escape="false" align-center>
|
||||
<el-progress :text-inside="true" :stroke-width="22" :percentage="downloadProp" :show-text="false"
|
||||
status="success" />
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
v-model="isImg"
|
||||
title="人机验证"
|
||||
width="500"
|
||||
style=" -webkit-app-region: no-drag;"
|
||||
>
|
||||
<span>根据图片回答相关问题1</span>
|
||||
<div style="display: flex;align-items: center;;margin-top:30px">
|
||||
<img :src="isPeopleImg" style="width:200px;height:60px;cursor: pointer;" alt="" srcset="" @click="refreshImg">
|
||||
<el-input v-model="ruleForm.imgCode" style="width: 250px;height:40px;margin-left:20px" placeholder="请根据图片填入答案" />
|
||||
</div>
|
||||
<div style="display: flex;justify-content: center;margin-top:30px">
|
||||
<el-button type="primary" @click="sbmitImg">确定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--选择学科-->
|
||||
<SelectSubject v-model="isSubject" :login-data="loginForm" />
|
||||
<!--注册弹框-->
|
||||
<Register ref="RegModel"></Register>
|
||||
|
||||
|
||||
</template>
|
||||
<script setup>
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import WindowTools from '@/components/window-tools/index.vue'
|
||||
import SelectSubject from '@/components/select-subject/index.vue'
|
||||
import Register from './components/Register.vue'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import {sendcode,instructorregister,getCodeImg} from '@/api/login'
|
||||
import yylogo from '@/assets/images/login/yy-logo.png'
|
||||
import leftBg1 from '@/assets/images/login/yy_bacg.jpg'
|
||||
const { session } = require('@electron/remote')
|
||||
const buildMode = import.meta.env.MODE
|
||||
const downloadProp = ref(0)
|
||||
const showDownLoading = ref(false)
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
const formRef = ref()
|
||||
const userStore = useUserStore()
|
||||
const btnLoading = ref(false)
|
||||
const isSubject = ref(false)
|
||||
const RegModel = ref(false)
|
||||
const isRegister = ref(true)
|
||||
const ruleFormRef = ref(null)
|
||||
const codeName=ref('发送验证码')
|
||||
const timer=ref(null)
|
||||
const isImg=ref(false)
|
||||
const isPeopleImg=ref(null)
|
||||
const type=ref(1) // 1注册 2找回密码
|
||||
const resImg = reactive({ imgData: {} });
|
||||
|
||||
//表单
|
||||
const loginForm = reactive({
|
||||
username: '',
|
||||
password: '',
|
||||
rememberMe: false
|
||||
})
|
||||
// 注册表单
|
||||
const ruleForm = reactive({
|
||||
|
||||
})
|
||||
//表单规则
|
||||
const rules = reactive({
|
||||
username: [{ required: true, trigger: 'blur', message: '请输入您的账号' }],
|
||||
password: [{ required: true, trigger: 'blur', message: '请输入您的密码' }],
|
||||
smsCode: [{ required: true, trigger: 'blur', message: '请输入您的验证码' }],
|
||||
})
|
||||
|
||||
let curWinUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH
|
||||
let homeTitle = ref(import.meta.env.VITE_APP_TITLE)
|
||||
ipcRenderer.on('update-app-progress', (e, prop) => {
|
||||
downloadProp.value = prop
|
||||
showDownLoading.value = prop !== 100
|
||||
})
|
||||
const gotoreRegister=()=>{
|
||||
codeName.value='发送验证码'
|
||||
if(timer.value){
|
||||
clearInterval(timer.value);
|
||||
}
|
||||
isRegister.value=false
|
||||
}
|
||||
// 刷新
|
||||
const refreshImg=()=>{
|
||||
getCodeImg().then(res=>{
|
||||
isPeopleImg.value='data:image/jpg;base64,'+res.img
|
||||
resImg.imgData=res
|
||||
})
|
||||
}
|
||||
// 提交人机验证
|
||||
const sbmitImg=()=>{
|
||||
if(ruleForm.imgCode){
|
||||
// {mobile:ruleForm.phoneNumber,code:ruleForm.imgCode,uuid:resImg.imgData.uuid}
|
||||
const { username:username,imgCode:code } = ruleForm
|
||||
const params = {
|
||||
username, code,
|
||||
uuid: resImg.imgData.uuid,
|
||||
source:4
|
||||
}
|
||||
sendcode(params).then(res=>{
|
||||
if(res.code==200){
|
||||
ElMessage.success('短信发送成功')
|
||||
ruleForm.Code=res.data
|
||||
isImg.value=false
|
||||
codeName.value=60
|
||||
timer.value=setInterval(()=>{
|
||||
codeName.value--
|
||||
if(codeName.value==0){
|
||||
codeName.value='发送验证码'
|
||||
clearInterval(timer.value);
|
||||
}
|
||||
},1000)
|
||||
}
|
||||
|
||||
})
|
||||
}else{
|
||||
ElMessage.error('请根据图片输入验证码')
|
||||
}
|
||||
//
|
||||
}
|
||||
// 发送验证码
|
||||
const sendyzm=()=>{
|
||||
if(ruleForm.username){
|
||||
const pattern = /^1[3-9]\d{9}$/;
|
||||
if( pattern.test(ruleForm.username) ){
|
||||
|
||||
getCodeImg().then(res=>{
|
||||
if(res.code==200){
|
||||
ruleForm.imgCode=null
|
||||
isPeopleImg.value='data:image/jpg;base64,'+res.img
|
||||
isImg.value=true
|
||||
resImg.imgData=res
|
||||
// codeName.value=60
|
||||
// timer.value=setInterval(()=>{
|
||||
// codeName.value--
|
||||
// if(codeName.value==0){
|
||||
// codeName.value='发送验证码'
|
||||
// clearInterval(timer.value);
|
||||
// }
|
||||
// },1000)
|
||||
}else{
|
||||
ElMessage.error(res.msg)
|
||||
}
|
||||
})
|
||||
}else{
|
||||
ElMessage.error('请输入正确的手机号码')
|
||||
}
|
||||
// captchaImg({mobile:ruleForm.phoneNumber}).then(res=>{
|
||||
// console.log('res->', res)
|
||||
// })
|
||||
}else{
|
||||
ElMessage.error('请输入手机号码')
|
||||
}
|
||||
}
|
||||
// 打开弹窗
|
||||
const RegisterModel = type => {
|
||||
RegModel.value.OpenModel(type)
|
||||
}
|
||||
//登录
|
||||
const submitForm = async (formEl) => {
|
||||
if (!formEl) return
|
||||
await formEl.validate(async (valid) => {
|
||||
if (valid) {
|
||||
btnLoading.value = true
|
||||
|
||||
// 勾选了需要记住密码设置在 cookie 中设置记住用户名和密码
|
||||
if (loginForm.rememberMe) {
|
||||
await setCookie('username', loginForm.username)
|
||||
await setCookie('password', encrypt(loginForm.password))
|
||||
await setCookie('rememberMe', loginForm.rememberMe.toString())
|
||||
} else {
|
||||
// 否则移除
|
||||
await session.defaultSession.clearStorageData({
|
||||
origin: curWinUrl,
|
||||
storages: ['cookies']
|
||||
})
|
||||
}
|
||||
|
||||
try {
|
||||
await userStore.login(loginForm)
|
||||
await userStore.getInfo()
|
||||
if (userStore.user.edustage || userStore.user.edusubject || isStadium(userStore.user)) {
|
||||
ElMessage.success('登录成功')
|
||||
ipcRenderer && ipcRenderer.send('openMainWindow')
|
||||
} else {
|
||||
isSubject.value = true
|
||||
}
|
||||
} finally {
|
||||
btnLoading.value = false
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const isStadium = (user) => {
|
||||
let roles = user.roles
|
||||
return roles.some(item => item.roleKey === 'stadium')
|
||||
}
|
||||
|
||||
const getCookie = async () => {
|
||||
const username = (await getCookieDetail('username'))[0]
|
||||
const password = (await getCookieDetail('password'))[0]
|
||||
const rememberMe = (await getCookieDetail('rememberMe'))[0]
|
||||
loginForm.username = username ? username.value : loginForm.username
|
||||
loginForm.password = password ? decrypt(password.value) : loginForm.password
|
||||
loginForm.rememberMe = rememberMe ? Boolean(rememberMe.value) : false
|
||||
}
|
||||
|
||||
// 获取cookie
|
||||
const getCookieDetail = (name) => {
|
||||
return session.defaultSession.cookies.get({ url: curWinUrl, name })
|
||||
}
|
||||
|
||||
// 设置cookie
|
||||
const setCookie = (name, value) => {
|
||||
// 30天过期
|
||||
let Days = 30
|
||||
let times = Math.round(Date.now() / 1000) + Days * 24 * 60 * 60
|
||||
const cookie = {
|
||||
url: curWinUrl,
|
||||
name,
|
||||
value,
|
||||
expirationDate: times
|
||||
}
|
||||
return session.defaultSession.cookies.set(cookie)
|
||||
}
|
||||
const gotoLogin = () => {
|
||||
codeName.value='发送验证码'
|
||||
if (timer.value){
|
||||
clearInterval(timer.value);
|
||||
}
|
||||
if (ruleFormRef.value) ruleFormRef.value.resetFields()
|
||||
isRegister.value = true
|
||||
}
|
||||
// 注册
|
||||
const RegisterForm = async (formEl) => {
|
||||
if (!formEl) return
|
||||
await formEl.validate((valid, fields) => {
|
||||
if (valid) {
|
||||
instructorregister(ruleForm).then(res=>{
|
||||
if(res.code==200){
|
||||
ElMessage.success('您已注册成功')
|
||||
if (ruleFormRef.value) ruleFormRef.value.resetFields()
|
||||
gotoLogin()
|
||||
}else{
|
||||
ElMessage.error(res.msg)
|
||||
}
|
||||
})
|
||||
console.log('submit!')
|
||||
} else {
|
||||
console.log('error submit!', fields)
|
||||
}
|
||||
})
|
||||
}
|
||||
onMounted(() => {
|
||||
localStorage.clear()
|
||||
sessionStore.set('subject', {
|
||||
bookList: null,
|
||||
curBook: null,
|
||||
curNode: null,
|
||||
defaultExpandedKeys: [],
|
||||
subjectTree: []
|
||||
})
|
||||
getCookie()
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.login-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
-webkit-app-region: drag;
|
||||
|
||||
.login-yc{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
img{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.box-item {
|
||||
width: 370px;
|
||||
height: 520px;
|
||||
|
||||
&.desc {
|
||||
background: #ffffff;
|
||||
border-radius: 12px 0px 0px 12px;
|
||||
box-shadow: 0px 16px 73px 8px rgba(203, 203, 203, 0.2);
|
||||
padding: 23px 25px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
background-color: #003b94;
|
||||
}
|
||||
|
||||
&.login {
|
||||
background: #ffffff;
|
||||
border-radius: 0px 12px 12px 0px;
|
||||
padding: 34px 42px;
|
||||
position: relative;
|
||||
.title-logo{
|
||||
width: 100px;
|
||||
}
|
||||
}
|
||||
|
||||
.welcome {
|
||||
padding-top: 35px;
|
||||
|
||||
p {
|
||||
color: #ffffff;
|
||||
line-height: 25px;
|
||||
letter-spacing: 0.26px;
|
||||
text-align: center;
|
||||
font-weight: 700;
|
||||
font-size: 26px;
|
||||
}
|
||||
}
|
||||
|
||||
.welcome-img {
|
||||
margin-top: 20px;
|
||||
width: 350px;
|
||||
height: 350px;
|
||||
}
|
||||
|
||||
.login-title {
|
||||
font-size: 20px;
|
||||
text-align: center;
|
||||
color: #1e1e1e;
|
||||
margin-bottom: 35px;
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.login-title {
|
||||
font-size: 20px;
|
||||
text-align: center;
|
||||
color: #1e1e1e;
|
||||
margin-bottom: 10px;
|
||||
margin-top: 5px;
|
||||
font-width: bold;
|
||||
}
|
||||
|
||||
.login-title2 {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.login-form {
|
||||
-webkit-app-region: no-drag;
|
||||
|
||||
.captcha-input {
|
||||
width: 60%;
|
||||
}
|
||||
|
||||
.captcha-img {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.title-bottom{
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
font-size: 14px;
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
}
|
||||
|
||||
.btn {
|
||||
width: 350px;
|
||||
height: 50px;
|
||||
border-radius: 4px;
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
text-align: center;
|
||||
color: #ffffff;
|
||||
line-height: 50px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.header-tool {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
-webkit-app-region: no-drag;
|
||||
|
||||
span {
|
||||
padding: 5px 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.el-form-item {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
</style>
|
|
@ -69,6 +69,7 @@
|
|||
<div class="content-body-right-item-text">{{item.name}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <Eos></Eos>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -94,7 +95,7 @@ import { sessionStore } from '@/utils/store'
|
|||
import {listEntpcourse} from "@/api/teaching/classwork";
|
||||
import {addEntpcoursefileReturnId, getEntpcoursefile} from "@/api/education/entpcoursefile";
|
||||
import {createWindow, toLinkLeftWeb, getStaticUrl} from "@/utils/tool";
|
||||
import {ElMessage} from "element-plus";
|
||||
import {ElMessage, ElMessageBox} from "element-plus";
|
||||
import {PPTXFileToJson} from "@/AixPPTist/src/hooks/useImport";
|
||||
import * as API_entpcoursefile from "@/api/education/entpcoursefile";
|
||||
import msgUtils from "@/plugins/modal";
|
||||
|
@ -102,6 +103,7 @@ import * as commUtils from "@/utils/comm";
|
|||
import * as Api_server from "@/api/apiService"; // 学科名字文生图
|
||||
import useClassTaskStore from '@/store/modules/classTask'
|
||||
import { slidesToImg } from '@/utils/ppt' // ppt相关工具
|
||||
import Eos from "@/components/FileUpload/Eos.vue"
|
||||
|
||||
const router = useRouter()
|
||||
const userStore = useUserStore().user // 用户信息
|
||||
|
@ -153,7 +155,7 @@ const tools = reactive([{
|
|||
img: 'airobot'
|
||||
},{
|
||||
name: '语音生成',
|
||||
path: '',
|
||||
path: '/model/aiVoice',
|
||||
img: 'aiyuyin'
|
||||
},{
|
||||
name: '文生图片',
|
||||
|
@ -211,6 +213,19 @@ const gotoRoute = (item) => {
|
|||
if (item.path) {
|
||||
if (item.path === '/model/aiKolors') {
|
||||
gotoAiKolors(item.path)
|
||||
}else if(item.path == '/model/aiVoice'){
|
||||
console.log('aiVoice',uploadData.value)
|
||||
const path = '/model/aiVoice'
|
||||
let subjectdata = sessionStore.get('subject.curNode')
|
||||
let datasubject = `课标-${subjectdata.edustage}-${subjectdata.edusubject}`
|
||||
router.push({
|
||||
path,
|
||||
query: {
|
||||
datasetId: dataSetJson[datasubject],
|
||||
coursetitle: currentNode.value.itemtitle,
|
||||
...uploadData.value
|
||||
}
|
||||
});
|
||||
}else {
|
||||
router.push(item.path)
|
||||
}
|
||||
|
@ -289,6 +304,8 @@ const pgDialog = ref({ // 弹窗-进度条
|
|||
|
||||
const fileInput = ref(null)
|
||||
|
||||
let pptMedia = {} // ppt媒体数据
|
||||
|
||||
const openFilePicker = () =>{
|
||||
fileInput.value.click();
|
||||
}
|
||||
|
@ -302,9 +319,13 @@ const handleFileChange = ()=> {
|
|||
}
|
||||
// ppt文件转PPT线上数据
|
||||
const createAIPPTByFile = async (file)=> {
|
||||
// pgDialog.value.visible = true
|
||||
// pgDialog.value.pg.percentage = 0
|
||||
const resPptJson = await PPTXFileToJson(file)
|
||||
pgDialog.value.visible = true
|
||||
pgDialog.value.pg.percentage = 0
|
||||
pptMedia = {} // 清空媒体数据
|
||||
const resPptJson = await PPTXFileToJson(file).catch(() => {
|
||||
ElMessageBox.alert('PPT文件转换失败!请点击素材右侧...下载文件后打开另存为PPTX文件格式再进行导入!')
|
||||
pgDialog.value.visible = false
|
||||
})
|
||||
const { def, slides, ...content } = resPptJson
|
||||
// 生成缩略图
|
||||
const thumbnails = await slidesToImg(slides, content.width)
|
||||
|
@ -376,42 +397,66 @@ const createAIPPTByFile = async (file)=> {
|
|||
})
|
||||
})
|
||||
}
|
||||
|
||||
const toRousrceUrl = async (o) => {
|
||||
if (!!o.src) { // 如果有src就转换
|
||||
const isBase64 = /^data:image\/(\w+);base64,/.test(o.src)
|
||||
const isBlobUrl = /^blob:/.test(o.src)
|
||||
// console.log('isBase64', o, isBase64)
|
||||
if (isBase64) {
|
||||
const bolb = commUtils.base64ToBlob(o.src)
|
||||
const fileName = Date.now() + '.png'
|
||||
const file = commUtils.blobToFile(bolb, fileName)
|
||||
// o.src = fileName
|
||||
// console.log('file', file)
|
||||
// 将图片|音频|视频 转换为线上地址
|
||||
const getOnlineFileUrl = (data, name) => {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let file
|
||||
if (data instanceof Blob) { // blob类型判断
|
||||
const fileName = Date.now() + `.${name||'png'}`
|
||||
file = commUtils.blobToFile(data, fileName)
|
||||
} else if (data instanceof File) { // file类型判断
|
||||
file = data
|
||||
} else { // 其他类型 base64
|
||||
const blob = commUtils.base64ToBlob(data)
|
||||
const fileName = Date.now() + `.${name||'png'}`
|
||||
file = commUtils.blobToFile(blob, fileName)
|
||||
}
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
const res = await Api_server.Other.uploadFile(formData)
|
||||
if (res && res.code == 200){
|
||||
const url = res?.url
|
||||
url &&(o.src = url)
|
||||
resolve(res?.url)
|
||||
} else { // 失败
|
||||
reject(res?.msg||'上传失败')
|
||||
}
|
||||
})
|
||||
}
|
||||
const toRousrceUrl = async (o) => {
|
||||
if (!!o.src) { // 如果有src就转换
|
||||
const isBase64 = /^data:image\/(\w+);base64,/.test(o.src)
|
||||
const isBlobUrl = /^blob:/.test(o.src)
|
||||
let onLineUrl = '' // 线上地址
|
||||
if (!!o.zipPath) onLineUrl = pptMedia[o.zipPath] || '' // 是否已上传过
|
||||
if (onLineUrl) o.src = onLineUrl // 已存在线上地址直接赋值
|
||||
else { // 不存在重新上传
|
||||
if (isBase64) { // 相同资源处理
|
||||
const url = await getOnlineFileUrl(o.src)
|
||||
url && o.zipPath && (pptMedia[o.zipPath] = url) // 缓存
|
||||
} else if (isBlobUrl) { // 视频和音频
|
||||
const res = await fetch(o.src)
|
||||
const blob = await res.blob()
|
||||
const fileName = o.type=='video'? Date.now() + '.mp4':Date.now() + '.mp3'
|
||||
const file = commUtils.blobToFile(blob, fileName)
|
||||
// o.src = fileName
|
||||
// console.log('file', file)
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
const ress = await Api_server.Other.uploadFile(formData)
|
||||
if (ress && ress.code == 200){
|
||||
const url = ress?.url
|
||||
const url = await getOnlineFileUrl(blob, o.type=='video'?'mp4':'mp3')
|
||||
URL.revokeObjectURL(o.src) // 释放内存
|
||||
url &&(o.src = url)
|
||||
url && o.zipPath && (pptMedia[o.zipPath] = url) // 缓存
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 处理元素为shape 可能存在背景图等
|
||||
const isBg = o?.gradient?.type == 'image' && !!o?.gradient?.image
|
||||
if (isBg) {
|
||||
const {src, zipPath} = o.gradient.image || {}
|
||||
let onLineUrl = '' // 线上地址
|
||||
if (!!zipPath) onLineUrl = pptMedia[zipPath] || '' // 是否已上传过
|
||||
if (onLineUrl) o.gradient.image.src = onLineUrl // 已存在线上地址直接赋值
|
||||
else { // 重新上传
|
||||
const url = await getOnlineFileUrl(src)
|
||||
o.gradient.image.src = url
|
||||
url && zipPath && (pptMedia[zipPath] = url) // 缓存
|
||||
}
|
||||
}
|
||||
|
||||
if (o?.background?.image) await toRousrceUrl(o.background.image)
|
||||
if(o?.elements){
|
||||
for (let element of o.elements) {
|
||||
|
@ -680,6 +725,7 @@ onMounted(async () => {
|
|||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 15px;
|
||||
padding: 10px;
|
||||
.content-body-right-item{
|
||||
&:hover{
|
||||
cursor: pointer;
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
{{ item.fileShowName.substring(0, item.fileShowName.lastIndexOf('.')) }}
|
||||
<el-tag type="danger" effect="dark">{{item.fileShowName.substring(item.fileShowName.lastIndexOf('.')+1)}}</el-tag>
|
||||
<template v-if="item.fileTag">
|
||||
<el-tag v-for="(item1, index1) in item.fileTag.split(',')" :key="index1" type="success" effect="dark" style="margin-left: 5px">{{item1}}</el-tag>
|
||||
<el-tag v-for="(item1, index1) in item.fileTag.split(',')"
|
||||
@close="deleteTag(item, item1, index1)" closable :key="index1"
|
||||
@click.stop="editTag(item, item1, index1)" type="success" effect="dark" style="margin-left: 5px">{{item1}}</el-tag>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -282,6 +284,71 @@ export default {
|
|||
})
|
||||
// this.$emit('on-start-class', item)
|
||||
},
|
||||
editTagMsg(type, item, value, index) {
|
||||
let fileTagList = []
|
||||
if (!item.fileTag) {
|
||||
item.fileTag="";
|
||||
fileTagList = [];
|
||||
}else {
|
||||
fileTagList = item.fileTag.split(',');
|
||||
}
|
||||
let message = '';
|
||||
switch (type) {
|
||||
case 'add':
|
||||
fileTagList.push(value);
|
||||
message = '添加成功!';
|
||||
break;
|
||||
case 'delete':
|
||||
fileTagList.splice(index, 1);
|
||||
message = '删除成功!';
|
||||
break;
|
||||
case 'edit':
|
||||
fileTagList[index] = value;
|
||||
message = '修改成功!';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
item.fileTagList = fileTagList;
|
||||
item.fileTag = fileTagList.join(",")
|
||||
updateSmarttalk({ id: item.id, fileTag: item.fileTag, fileShowName: item.fileShowName }).then((res) => {
|
||||
if (res.data === true) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: message
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
deleteTag(item, item1, index) {
|
||||
ElMessageBox.confirm(
|
||||
'是否确认删除这个标签?',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
this.editTagMsg('delete', item, "", index)
|
||||
})
|
||||
.catch(() => {
|
||||
})
|
||||
},
|
||||
editTag(item, item1, index) {
|
||||
console.log(item, item1, index)
|
||||
ElMessageBox.prompt('请输入新的标签', '修改标签', {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
inputValue: item1,
|
||||
inputPattern: /^[a-zA-Z0-9\u4e00-\u9fa5]{1,5}$/,
|
||||
inputErrorMessage: '请输入最多五个字的标签,不能携带标点符号'
|
||||
})
|
||||
.then(({ value }) => {
|
||||
this.editTagMsg('edit', item, value, index)
|
||||
}).catch(() => {})
|
||||
},
|
||||
editTalk(item) {
|
||||
ElMessageBox.prompt('请输入新的标签', '添加标签', {
|
||||
confirmButtonText: '确认',
|
||||
|
@ -291,24 +358,7 @@ export default {
|
|||
inputErrorMessage: '请输入最多五个字的标签,不能携带标点符号'
|
||||
})
|
||||
.then(({ value }) => {
|
||||
let fileTagList = []
|
||||
if (!item.fileTag) {
|
||||
item.fileTag="";
|
||||
fileTagList = [];
|
||||
}else {
|
||||
fileTagList = item.fileTag.split(',');
|
||||
}
|
||||
fileTagList.push(value);
|
||||
item.fileTagList = fileTagList;
|
||||
item.fileTag = fileTagList.join(",")
|
||||
updateSmarttalk({ id: item.id, fileTag: item.fileTag, fileShowName: item.fileShowName }).then((res) => {
|
||||
if (res.data === true) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: `添加成功!`
|
||||
})
|
||||
}
|
||||
})
|
||||
this.editTagMsg('add', item, value, 0)
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
|
|
|
@ -1,30 +1,124 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-dialog class="ppt-dialog" v-model="model" :show-close="false" width="800" destroy-on-close :top="'3vh'">
|
||||
<template #header="{ close, titleId, titleClass }">
|
||||
<div class="dialog-header">
|
||||
<h4 :id="titleId" :class="titleClass">生成PPT(试验版)</h4>
|
||||
<i class="iconfont icon-guanbi" @click="close"></i>
|
||||
<el-dialog class="ppt-dialog" v-model="model" title="生成PPT(试验版)"
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="false"
|
||||
:show-close="false" width="1000" destroy-on-close >
|
||||
<!-- <AiPptist @add-success="addAiPPT" :dataList="dataList"/>-->
|
||||
<div class="ppt-dialog-content">
|
||||
<div v-if="activeStep === 1" class="ppt-dialog-cover-wrap">
|
||||
<div v-for="(item,index) in backGroundList"
|
||||
:key="item.templateIndexId"
|
||||
@click="outlineData.templateId = item.templateIndexId"
|
||||
:class="outlineData.templateId === item.templateIndexId?'active-mode':''"
|
||||
class="ppt-dialog-cover-item">
|
||||
<div class="icon-select">
|
||||
<Select />
|
||||
</div>
|
||||
<img :src="getBackGroundImg(item.detailImage)">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ppt-dialog-prog-wrap" v-if="activeStep === 2">
|
||||
<el-progress :percentage="percentage" type="circle"></el-progress>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ppt-dialog-footer" v-if="activeStep === 1">
|
||||
<el-button @click="closeDialog">关闭</el-button>
|
||||
<el-button type="primary" :loading="createPPTLoading" @click="createPPT">生成课件</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<AiPptist @add-success="addAiPPT" :dataList="dataList"/>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import AiPptist from './ai-pptistV2.vue';
|
||||
import {Select} from "@element-plus/icons-vue";
|
||||
import {ref, defineEmits, onMounted} from "vue";
|
||||
import {createPPTV2, getBackGroundV2, getProgressV2, createPptByOutline} from "@/utils/ppt-request";
|
||||
import {ElMessage} from "element-plus";
|
||||
import useUserStore from '@/store/modules/user'
|
||||
const userStore = useUserStore()
|
||||
const model = defineModel()
|
||||
const emit = defineEmits(['addSuccess'])
|
||||
const emit = defineEmits(['addSuccess', 'close-dialogs'])
|
||||
const backGroundList = ref([]);
|
||||
const activeStep = ref(1);
|
||||
const props = defineProps({
|
||||
dataList: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
})
|
||||
const closeDialog = () => {
|
||||
emit('close-dialogs')
|
||||
}
|
||||
const addAiPPT = (data) => {
|
||||
emit('addSuccess', data)
|
||||
}
|
||||
const getBackGroundImg = (imgUrlStr) => {
|
||||
return JSON.parse(imgUrlStr).titleCoverImage
|
||||
};
|
||||
|
||||
const createPPTLoading = ref(false);
|
||||
const outlineData = ref({
|
||||
query: '', // 用户要求(最多8000字)
|
||||
templateId: '', // ppt生成主题
|
||||
author: userStore.user.nickName,
|
||||
isFigure: false, // 是否自动配图
|
||||
search: true,
|
||||
language: "cn"
|
||||
})
|
||||
const percentage = ref(0);
|
||||
const outlineCreatePPT = () => {
|
||||
const newOutlineData = { ...outlineData.value, };
|
||||
let outline = JSON.parse(props.dataList.outline).json
|
||||
newOutlineData.outline = JSON.stringify(outline);
|
||||
newOutlineData.query = "通过传入大纲帮我生成相应的PPT课件"
|
||||
createPPTLoading.value = true;
|
||||
createPptByOutline(newOutlineData).then((res) => {
|
||||
console.log(res, "正在生成中");
|
||||
createPPTLoading.value = false;
|
||||
activeStep.value = 2
|
||||
|
||||
const checkProgress = () => {
|
||||
getProgressV2(res.sid).then(response => {
|
||||
percentage.value = Math.round(response?.donePages*100/response?.totalPages);
|
||||
if (response.pptStatus === "done") {
|
||||
emit('addSuccess',{...res,url:response.pptUrl})
|
||||
ElMessage.success("生成成功");
|
||||
} else {
|
||||
const sleepTime = 2000;
|
||||
let remainingTime = sleepTime;
|
||||
const intervalId = setInterval(() => {
|
||||
remainingTime -= 100;
|
||||
if (remainingTime <= 0) {
|
||||
clearInterval(intervalId);
|
||||
checkProgress();
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
checkProgress();
|
||||
}).finally(()=>{
|
||||
createPPTLoading.value = false
|
||||
})
|
||||
};
|
||||
|
||||
const createPPT = () => {
|
||||
if (outlineData.value.templateId) {
|
||||
outlineCreatePPT()
|
||||
}else {
|
||||
ElMessage.warning("请选择模板");
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// emit('addSuccess',{url:'https://bjcdn.openstorage.cn/xinghuo-privatedata/%2Ftmp/apiTempFileba724e0344f74e1480535eedf3ebec661601807661085006275/%E9%87%91%E9%A9%AC%E5%A5%96%E5%B0%B4%E5%B0%AC%E4%BA%8B%E4%BB%B6%E5%88%86%E6%9E%90%E4%B8%8E%E5%BA%94%E5%AF%B9%E7%AD%96%E7%95%A5.pptx'})
|
||||
getBackGroundV2().then((res) => {
|
||||
backGroundList.value = res.records;
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
@ -40,4 +134,50 @@
|
|||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
.ppt-dialog-footer{
|
||||
padding-top: 20px;
|
||||
text-align: right;
|
||||
}
|
||||
.ppt-dialog-content{
|
||||
height: 500px;
|
||||
overflow: auto;
|
||||
.ppt-dialog-prog-wrap{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
}
|
||||
.ppt-dialog-cover-wrap{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-around;
|
||||
.ppt-dialog-cover-item{
|
||||
margin-bottom: 10px;
|
||||
border: 10px solid #ccc;
|
||||
border-radius: 10px;
|
||||
cursor: pointer;
|
||||
img{
|
||||
width: 200px;
|
||||
}
|
||||
.icon-select{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
.active-mode{
|
||||
border: 10px solid #5e24d0;
|
||||
position: relative;
|
||||
.icon-select{
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
right: 10px;
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
color: #fff;
|
||||
background: #5e24d0;
|
||||
border-radius: 5px;
|
||||
display: block!important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -289,7 +289,8 @@ export default {
|
|||
{ color: '#5cb87a', percentage: 100 }, // 绿色
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
pptMedia: {} // ppt媒体数据
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -561,6 +562,7 @@ export default {
|
|||
},
|
||||
importPPT(item) {
|
||||
let _this = this;
|
||||
// item.fileFullPath = "https://wzyzoss.eos-chongqing-3.cmecloud.cn/2025/1/14/c4d8ae796fc74417aefe017a49388962.ppt"
|
||||
fetch(item.fileFullPath)
|
||||
.then(res => res.arrayBuffer())
|
||||
.then(buffer => {
|
||||
|
@ -590,43 +592,66 @@ export default {
|
|||
this.createAIPPTByFile(file, this.currentNode.itemtitle + '.aippt')
|
||||
}
|
||||
},
|
||||
async toRousrceUrl(o) {
|
||||
if (!!o.src) { // 如果有src就转换
|
||||
const isBase64 = /^data:image\/(\w+);base64,/.test(o.src)
|
||||
const isBlobUrl = /^blob:/.test(o.src)
|
||||
// console.log('isBase64', o, isBase64)
|
||||
if (isBase64) {
|
||||
const bolb = commUtils.base64ToBlob(o.src)
|
||||
const fileName = Date.now() + '.png'
|
||||
const file = commUtils.blobToFile(bolb, fileName)
|
||||
// o.src = fileName
|
||||
// console.log('file', file)
|
||||
// 将图片|音频|视频 转换为线上地址
|
||||
getOnlineFileUrl(data, name){
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let file
|
||||
if (data instanceof Blob) { // blob类型判断
|
||||
const fileName = Date.now() + `.${name||'png'}`
|
||||
file = commUtils.blobToFile(data, fileName)
|
||||
} else if (data instanceof File) { // file类型判断
|
||||
file = data
|
||||
} else { // 其他类型 base64
|
||||
const blob = commUtils.base64ToBlob(data)
|
||||
const fileName = Date.now() + `.${name||'png'}`
|
||||
file = commUtils.blobToFile(blob, fileName)
|
||||
}
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
const res = await Api_server.Other.uploadFile(formData)
|
||||
if (res && res.code == 200){
|
||||
const url = res?.url
|
||||
url &&(o.src = url)
|
||||
resolve(res?.url)
|
||||
} else { // 失败
|
||||
reject(res?.msg||'上传失败')
|
||||
}
|
||||
})
|
||||
},
|
||||
async toRousrceUrl(o) {
|
||||
if (!!o.src) { // 如果有src就转换
|
||||
const isBase64 = /^data:image\/(\w+);base64,/.test(o.src)
|
||||
const isBlobUrl = /^blob:/.test(o.src)
|
||||
let onLineUrl = '' // 线上地址
|
||||
if (!!o.zipPath) onLineUrl = this.pptMedia[o.zipPath] || '' // 是否已上传过
|
||||
if (onLineUrl) o.src = onLineUrl // 已存在线上地址直接赋值
|
||||
else { // 不存在重新上传
|
||||
if (isBase64) { // 相同资源处理
|
||||
const url = await this.getOnlineFileUrl(o.src)
|
||||
url && o.zipPath && (this.pptMedia[o.zipPath] = url) // 缓存
|
||||
} else if (isBlobUrl) { // 视频和音频
|
||||
const res = await fetch(o.src)
|
||||
const blob = await res.blob()
|
||||
const fileName = o.type=='video'? Date.now() + '.mp4':Date.now() + '.mp3'
|
||||
const file = commUtils.blobToFile(blob, fileName)
|
||||
// o.src = fileName
|
||||
// console.log('file', file)
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
const ress = await Api_server.Other.uploadFile(formData)
|
||||
if (ress && ress.code == 200){
|
||||
const url = ress?.url
|
||||
const url = await this.getOnlineFileUrl(blob, o.type=='video'?'mp4':'mp3')
|
||||
URL.revokeObjectURL(o.src) // 释放内存
|
||||
url &&(o.src = url)
|
||||
url && o.zipPath && (this.pptMedia[o.zipPath] = url) // 缓存
|
||||
}
|
||||
}
|
||||
}
|
||||
// 处理元素为shape 可能存在背景图等
|
||||
const isBg = o?.gradient?.type == 'image' && !!o?.gradient?.image
|
||||
if (isBg) {
|
||||
const {src, zipPath} = o.gradient.image || {}
|
||||
let onLineUrl = '' // 线上地址
|
||||
if (!!zipPath) onLineUrl = this.pptMedia[zipPath] || '' // 是否已上传过
|
||||
if (onLineUrl) o.gradient.image.src = onLineUrl // 已存在线上地址直接赋值
|
||||
else { // 重新上传
|
||||
const url = await this.getOnlineFileUrl(src)
|
||||
o.gradient.image.src = url
|
||||
url && zipPath && (this.pptMedia[zipPath] = url) // 缓存
|
||||
}
|
||||
}
|
||||
|
||||
if (o?.background?.image) await this.toRousrceUrl(o.background.image)
|
||||
// if (o?.elements) o.elements.forEach(async o => {await this.toRousrceUrl(o)})
|
||||
if(o?.elements){
|
||||
for (let element of o.elements) {
|
||||
await this.toRousrceUrl(element);
|
||||
|
@ -636,7 +661,12 @@ export default {
|
|||
async createAIPPTByFile(file,fileShowName) {
|
||||
this.pgDialog.visible = true
|
||||
this.pgDialog.pg.percentage = 0
|
||||
const resPptJson = await PPTXFileToJson(file)
|
||||
this.pptMedia = {} // 清空媒体数据
|
||||
const resPptJson = await PPTXFileToJson(file).catch(() => {
|
||||
ElMessageBox.alert('PPT文件转换失败!请点击素材右侧...下载文件后打开另存为PPTX文件格式再进行导入!')
|
||||
this.pgDialog.visible = false
|
||||
})
|
||||
if (!resPptJson) return
|
||||
const { def, slides, ...content } = resPptJson
|
||||
// 生成缩略图
|
||||
const thumbnails = await slidesToImg(slides, content.width)
|
||||
|
|
|
@ -1,90 +1,155 @@
|
|||
<template>
|
||||
<div style="display: flex;">
|
||||
<div>
|
||||
<div style="display: flex; align-items: center;">
|
||||
<div style="margin-left: 15px">
|
||||
<el-dropdown @command="handleUserEduStage">
|
||||
<span class="el-dropdown-link">
|
||||
<el-button class="custom-button" type="default" round >{{ userStore.edustage }}
|
||||
<el-icon><ArrowDown /></el-icon>
|
||||
</el-button>
|
||||
<el-button class="custom-button" type="default" round>{{ eduStage || userStore.edustage }}</el-button>
|
||||
</span>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="幼儿园">幼儿园</el-dropdown-item>
|
||||
<el-dropdown-item command="小学">小学</el-dropdown-item>
|
||||
<el-dropdown-item command="初中">初中</el-dropdown-item>
|
||||
<el-dropdown-item command="高中">高中</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
<div style="margin-left: 15px">
|
||||
<el-dropdown @command="handleUserEduSubject">
|
||||
<span class="el-dropdown-link">
|
||||
<el-button class="custom-button" type="default" round>{{ userStore.edusubject }}
|
||||
<el-icon><ArrowDown /></el-icon>
|
||||
</el-button>
|
||||
<el-button class="custom-button" type="default" round>{{ eduSubject || userStore.edusubject }}</el-button>
|
||||
</span>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<template v-for="(item, index) in subjectList">
|
||||
<el-dropdown-item v-if="item.edustage == userStore.edustage" :command="item.itemtitle">{{
|
||||
item.itemtitle }}</el-dropdown-item>
|
||||
</template>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
<el-text
|
||||
type="primary"
|
||||
style="margin-left: 10px; cursor: pointer;"
|
||||
@click="handleUserEduSubject"
|
||||
v-popover="popoverRef"
|
||||
ref="buttonRef"
|
||||
>修改</el-text>
|
||||
</div>
|
||||
<!-- 级联选择框 -->
|
||||
<el-popover
|
||||
ref="popoverRef"
|
||||
:virtual-ref="buttonRef"
|
||||
trigger="click"
|
||||
title="修改学科学段"
|
||||
virtual-triggering
|
||||
placement="right"
|
||||
width="300px"
|
||||
>
|
||||
<div class="sidebar">
|
||||
<div class="nav-level-one">
|
||||
<template v-for="(item,index) in options" :key="index">
|
||||
<div :class="[currentIndex===index?'active':'','nav-item']" @click="handleUserEduStage(item.label,index)">
|
||||
<span class="nav-text">{{ item.label }}</span>
|
||||
<el-icon class="icon"><ArrowRight /></el-icon>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class="nav-level-two">
|
||||
<el-scrollbar height="180">
|
||||
<template v-for="(item,index) in cascadeOptions" :key="index">
|
||||
<div class="nav-item" @click="handleChange(item)">
|
||||
<span class="nav-text">{{ item.label }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
</div>
|
||||
</el-popover>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import {ArrowDown} from '@element-plus/icons-vue'
|
||||
import { onMounted,ref } from 'vue';
|
||||
import { onMounted, ref, unref } from 'vue';
|
||||
import { listEvaluation } from '@/api/subject/index'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import { ArrowRight } from '@element-plus/icons-vue'
|
||||
|
||||
const userStore = useUserStore().user
|
||||
const subjectList = ref([])
|
||||
const buttonRef = ref()
|
||||
const popoverRef = ref()
|
||||
// 获取当前选择的学段
|
||||
const currentIndex = ref(0)
|
||||
// 当前的学科和学段
|
||||
const eduStage = ref('')
|
||||
const eduSubject = ref('')
|
||||
|
||||
// 学段固定
|
||||
const options = ref([
|
||||
{
|
||||
value: '幼儿园',
|
||||
label: '幼儿园',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
value: '小学',
|
||||
label: '小学',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
value: '初中',
|
||||
label: '初中',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
value: '高中',
|
||||
label: '高中',
|
||||
children: [],
|
||||
},
|
||||
])
|
||||
// 选择学段时后筛选学科
|
||||
const cascadeOptions = ref([]);
|
||||
// 获取基础的学科
|
||||
const getSubject = () => {
|
||||
//没有学科则不进行下面的步骤
|
||||
if(!userStore.subject) return
|
||||
if (!userStore.subject) return;
|
||||
listEvaluation({ itemkey: 'subject', pageSize: 500 }).then((res) => {
|
||||
const arr = userStore.subject.split(',')
|
||||
subjectList.value = res.rows.filter(item => arr.includes(String(item.id))).map(items => items)
|
||||
console.log(subjectList,'subjectList');
|
||||
const arr = userStore.subject.split(',');
|
||||
subjectList.value = res.rows.filter(item => arr.includes(String(item.id)));
|
||||
if (subjectList.value.length === 0) return;
|
||||
options.value.forEach(option => {
|
||||
option.children = subjectList.value
|
||||
.filter(items => items.edustage === option.label)
|
||||
.map(item => ({ value: item.id, label: item.edusubject }));
|
||||
});
|
||||
// 首次获取学段和学科列表
|
||||
const cIndex = options.value.findIndex(item => item.label === userStore.edustage);
|
||||
cascadeOptions.value = [...options.value[cIndex].children]
|
||||
currentIndex.value = cIndex
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
// 选择学段
|
||||
const handleUserEduStage = (item) => {
|
||||
userStore.edustage = item
|
||||
sessionStore.set('edustageSelf',item)
|
||||
if(item === '幼儿园'){
|
||||
// 默认语文
|
||||
userStore.edusubject = '语文'
|
||||
sessionStore.set('edusubjectSelf','语文')
|
||||
}
|
||||
else if(item === '高中' && userStore.edusubject === "道德与法治"){
|
||||
// 默认语文
|
||||
userStore.edusubject = '政治'
|
||||
sessionStore.set('edusubjectSelf','政治')
|
||||
}
|
||||
else if(item != '高中' && userStore.edusubject === "政治"){
|
||||
// 默认语文
|
||||
userStore.edusubject = '道德与法治'
|
||||
sessionStore.set('edusubjectSelf','道德与法治')
|
||||
}
|
||||
const handleUserEduStage = (stage,index) => {
|
||||
const currentData = options.value.find(item => item.label === stage);
|
||||
cascadeOptions.value = [...currentData.children]
|
||||
currentIndex.value = index
|
||||
}
|
||||
|
||||
// 选择学科
|
||||
const handleUserEduSubject = (item) => {
|
||||
userStore.edusubject = item;
|
||||
sessionStore.set('edusubjectSelf',item)
|
||||
const handleUserEduSubject = () => {
|
||||
unref(popoverRef).popperRef?.delayHide?.();
|
||||
}
|
||||
|
||||
const handleChange = (item) => {
|
||||
const id = item.value
|
||||
const current = subjectList.value.find(item => item.id === id);
|
||||
if (current) {
|
||||
eduSubject.value = item.label;
|
||||
eduStage.value = current.edustage;
|
||||
sessionStore.set('edustageSelf', eduStage.value);
|
||||
|
||||
if (eduStage.value === '高中' && eduSubject.value === "道德与法治") {
|
||||
eduSubject.value = '政治';
|
||||
sessionStore.set('edusubjectSelf', '政治');
|
||||
} else if (eduStage.value !== '高中' && eduSubject.value === "政治") {
|
||||
eduSubject.value = '道德与法治';
|
||||
sessionStore.set('edusubjectSelf', '道德与法治');
|
||||
} else {
|
||||
sessionStore.set('edusubjectSelf', eduSubject.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getSubject()
|
||||
getSubject();
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.custom-button {
|
||||
width: auto;
|
||||
|
@ -93,10 +158,58 @@ onMounted(() => {
|
|||
outline-offset: none;
|
||||
padding: 0 24px;
|
||||
}
|
||||
|
||||
.custom-button i {
|
||||
margin-left: 8px; /* 调整图标与文字之间的间距 */
|
||||
}
|
||||
.sidebar {
|
||||
width: 100%;
|
||||
padding: 5px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.nav-level-one,.nav-level-two {
|
||||
margin-bottom: 20px;
|
||||
width: 120px;
|
||||
}
|
||||
.nav-level-two .nav-item{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.nav-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 10px;
|
||||
padding: 8px 10px;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
.nav-item:hover {
|
||||
background-color: rgb(245, 247, 250);
|
||||
}
|
||||
|
||||
.nav-text {
|
||||
flex: 1;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.nav-arrow {
|
||||
font-size: 12px;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.nav-level-one.nav-item:first-child.nav-text {
|
||||
color: blue;
|
||||
}
|
||||
.active .nav-text{
|
||||
font-weight: bold;
|
||||
color:rgb(64, 158, 255)
|
||||
}
|
||||
.active .icon{
|
||||
font-weight: bold;
|
||||
color:rgb(64, 158, 255)
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
@ -22,13 +22,11 @@
|
|||
|
||||
<!-- 裁剪按钮-->
|
||||
<div class="btn">
|
||||
<el-button style="margin-right: 20px">选择</el-button>
|
||||
<input
|
||||
class="upload"
|
||||
type="file"
|
||||
accept=".png, .jpg, .jpeg"
|
||||
@change="uploadImg"
|
||||
/>
|
||||
<label for="submit">
|
||||
<div class="lBut"><span>选择</span></div>
|
||||
</label>
|
||||
<input class="upload" id="submit" accept=".png, .jpg, .jpeg" type="file" style="display: none;" @change="uploadImg" />
|
||||
<!-- <el-button style="margin-right: 20px;cursor:pointer">选择</el-button> -->
|
||||
|
||||
<el-button @click="cancle">取消</el-button>
|
||||
<el-button @click="sureSava">提交</el-button>
|
||||
|
@ -216,6 +214,7 @@ export default {
|
|||
position: relative;
|
||||
display: flex;
|
||||
margin-top: 30px;
|
||||
cursor: pointer;
|
||||
> .upload {
|
||||
display: block;
|
||||
width: 60px;
|
||||
|
@ -224,6 +223,7 @@ export default {
|
|||
top: 0;
|
||||
left: 0;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -265,4 +265,22 @@ export default {
|
|||
background-color: rgba(43, 43, 43, 0.7215686275);
|
||||
}
|
||||
}
|
||||
.lBut{
|
||||
width: 87px;
|
||||
height: 32px;
|
||||
font-size: 14px;
|
||||
line-height: 1.15;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 4px;
|
||||
padding: 8px 10px;
|
||||
margin-right: 10px;
|
||||
transition: all 0.5s;
|
||||
white-space: nowrap;
|
||||
background-color: #409eff;
|
||||
color: white;
|
||||
border: 1px solid #409eff;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<div class="info">
|
||||
<div class="info-name">{{ state.user.nickName }}</div>
|
||||
<div class="infomation" v-if="isStadium() !== true" >
|
||||
<selectClass v-if="!isSubject"/>
|
||||
<SelectClass v-if="!isSubject"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -34,7 +34,7 @@ import resetPwd from './resetPwd.vue'
|
|||
import { getUserProfile } from '@/api/system/user'
|
||||
import pkc from "../../../../../package.json"
|
||||
//选择学校和班级
|
||||
import selectClass from './components/selectClass.vue'
|
||||
import SelectClass from './components/selectClass.vue'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
||||
const version = ref(pkc.version)
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
<template>
|
||||
<div class="user-info-head" @click="editCropper()">
|
||||
<img :src="options.img" title="点击上传头像" class="img-circle img-lg" />
|
||||
<!-- <img :src="options.img" title="点击上传头像" class="img-circle img-lg" /> -->
|
||||
<el-image class="user-img" :src="options.img" style="width: 120px;">
|
||||
<template #error>
|
||||
<img :src="route_path + userStore.user.avatar">
|
||||
</template>
|
||||
</el-image>
|
||||
<el-dialog
|
||||
v-model="open"
|
||||
append-to-body
|
||||
|
@ -19,7 +24,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import {ref, reactive} from 'vue'
|
||||
import {ref, reactive, onMounted} from 'vue'
|
||||
import { uploadAvatar } from '@/api/system/user'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
@ -31,10 +36,12 @@ const userStore = useUserStore()
|
|||
const open = ref(false)
|
||||
const visible = ref(false)
|
||||
const dev_api = ref(import.meta.env.VITE_APP_BASE_API)
|
||||
const route_path = ref(import.meta.env.VITE_APP_BUILD_BASE_PATH)
|
||||
const defaultImg = ['/img/avatar-default.jpg','/images/img-avatar.png','/src/assets/images/img-avatar.png']
|
||||
|
||||
//图片裁剪数据
|
||||
const options = reactive({
|
||||
img: userStore.user.avatar ==='/img/avatar-default.jpg' || userStore.user.avatar ==='/images/img-avatar.png' ? defaultUserImg : dev_api.value + userStore.user.avatar, // 裁剪图片的地址
|
||||
img: '', // 裁剪图片的地址
|
||||
autoCrop: true, // 是否默认生成截图框
|
||||
autoCropWidth: 400, // 默认生成截图框宽度
|
||||
autoCropHeight: 400, // 默认生成截图框高度
|
||||
|
@ -70,12 +77,19 @@ function uploadImg(data) {
|
|||
|
||||
/** 关闭窗口 */
|
||||
function closeDialog() {
|
||||
options.img = userStore.user.avatar ==='/img/avatar-default.jpg' || userStore.user.avatar ==='/images/img-avatar.png' ? defaultUserImg : dev_api.value + userStore.user.avatar
|
||||
// options.img = userStore.user.avatar ==='/img/avatar-default.jpg' || userStore.user.avatar ==='/images/img-avatar.png' ? defaultUserImg : dev_api.value + userStore.user.avatar
|
||||
options.visible = false
|
||||
}
|
||||
const cancle = () => {
|
||||
open.value = false
|
||||
}
|
||||
onMounted(() => {
|
||||
if(defaultImg.includes(userStore.user.avatar)){
|
||||
options.img = defaultUserImg
|
||||
}else{
|
||||
options.img = dev_api.value + userStore.user.avatar
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
|
||||
<script setup >
|
||||
import { ref, reactive, onMounted,watch } from 'vue'
|
||||
import { regionData, codeToText } from 'element-china-area-data'
|
||||
import { regionData, codeToText } from '@/plugins/china-area-data-json'
|
||||
import { getUserProfile } from '@/api/system/user'
|
||||
import {getDept} from '@/api/login'
|
||||
import {school} from '@/api/apiService'
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
<script setup>
|
||||
import { school } from '@/api/apiService';
|
||||
import { ref, reactive, onMounted ,computed} from 'vue'
|
||||
import { regionData, codeToText } from 'element-china-area-data'
|
||||
import { regionData, codeToText } from '@/plugins/china-area-data-json'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
const userStore = useUserStore()
|
||||
|
|
|
@ -1,282 +0,0 @@
|
|||
<template>
|
||||
<el-dialog v-model="isDialog" :show-close="false" width="800" destroy-on-close>
|
||||
<template #header>
|
||||
<div class="custom-header flex">
|
||||
<span>{{ item.name }}</span>
|
||||
<i class="iconfont icon-guanbi" @click="isDialog = false"></i>
|
||||
</div>
|
||||
</template>
|
||||
<div class="dialog-content">
|
||||
<el-scrollbar height="400px">
|
||||
<div class="chart-con flex">
|
||||
<template v-for="item in msgList">
|
||||
<div class="flex-end flex" v-if="item.type == 'user'">
|
||||
<div class="chart-item user">{{ item.msg }}</div>
|
||||
</div>
|
||||
<div class="flex-start flex" v-else>
|
||||
<div class="flex" v-loading="!item.msg">
|
||||
<div class="chart-item robot">{{ item.msg }}</div>
|
||||
</div>
|
||||
<div class="flex flex-end replace-item">
|
||||
<span @click="saveAdjust(item)"><i class="iconfont icon-tihuan"></i>替换分析结果</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="loaded" class="chart-loading">
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
<div class="input-box flex">
|
||||
<el-input v-model="textarea" @keyup.enter="send" :disabled="loaded" />
|
||||
<div class="ipt-icon" @click="send">
|
||||
<i class="iconfont icon-fasong"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { completion } from '@/api/mode/index'
|
||||
import { dataSetJson } from '@/utils/comm.js'
|
||||
import emitter from '@/utils/mitt';
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import { sendChart } from '@/api/ai/index'
|
||||
|
||||
const textarea = ref('')
|
||||
|
||||
const isDialog = defineModel()
|
||||
|
||||
const props = defineProps({
|
||||
item: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return { name: '11' }
|
||||
}
|
||||
},
|
||||
curMode:{
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
conversation_id: {
|
||||
type: [Number, String],
|
||||
default: ''
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['saveEdit'])
|
||||
|
||||
const loaded = ref(false)
|
||||
|
||||
const msgList = ref([])
|
||||
|
||||
const send = () => {
|
||||
if (loaded.value) return
|
||||
msgList.value.push({
|
||||
type: 'user',
|
||||
msg: textarea.value
|
||||
})
|
||||
loaded.value = true
|
||||
getConversation(textarea.value)
|
||||
textarea.value = ''
|
||||
}
|
||||
const curNode = reactive({})
|
||||
|
||||
const params = reactive(
|
||||
{
|
||||
prompt: '',
|
||||
dataset_id: '',
|
||||
template: ''
|
||||
}
|
||||
)
|
||||
|
||||
// 大模型对话
|
||||
const getConversation = async (val) => {
|
||||
try {
|
||||
params.prompt = `按照${val}的要求,针对${curNode.edustage}${curNode.edusubject}课标,对${curNode.itemtitle}进行教学分析`
|
||||
params.template = props.item.prompt
|
||||
|
||||
let data = null;
|
||||
// 教学大模型
|
||||
if(props.curMode == 1){
|
||||
const res = await sendChart({
|
||||
content: params.prompt,
|
||||
conversationId: props.conversation_id,
|
||||
stream: false
|
||||
})
|
||||
data = res.data
|
||||
}
|
||||
else{
|
||||
// 知识库模型
|
||||
const res = await completion(params)
|
||||
data = res.data
|
||||
}
|
||||
|
||||
msgList.value.push({
|
||||
type: 'robot',
|
||||
msg: data.answer,
|
||||
})
|
||||
} finally {
|
||||
loaded.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const saveAdjust = (item) => {
|
||||
isDialog.value = false
|
||||
emitter.emit('onSaveAdjust', item.msg)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
let data = sessionStore.get('subject.curNode')
|
||||
Object.assign(curNode, data);
|
||||
// 框架设计 用课标的dataset_id
|
||||
let jsonKey = `课标-${data.edustage}-${data.edusubject}`
|
||||
params.dataset_id = dataSetJson[jsonKey]
|
||||
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.custom-header {
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.icon-guanbi {
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.dialog-content {
|
||||
padding-top: 10px;
|
||||
padding-bottom: 20px;
|
||||
|
||||
.chart-con {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
|
||||
.flex-end {
|
||||
width: 100%;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.flex-start {
|
||||
width: 100%;
|
||||
justify-content: flex-start;
|
||||
flex-direction: column;
|
||||
|
||||
}
|
||||
|
||||
.chart-item {
|
||||
border-radius: 5px;
|
||||
padding: 5px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.user {
|
||||
background: #F2F2F2;
|
||||
margin-bottom: 10px;
|
||||
|
||||
}
|
||||
|
||||
.robot {
|
||||
background: #409EFF;
|
||||
color: #FFF;
|
||||
}
|
||||
|
||||
.replace-item {
|
||||
font-size: 12px;
|
||||
color: #409EFF;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.input-box {
|
||||
position: relative;
|
||||
|
||||
.ipt-icon {
|
||||
cursor: pointer;
|
||||
padding: 0 5px;
|
||||
|
||||
.icon-fasong {
|
||||
font-size: 26px;
|
||||
color: #409EFF;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.chart-loading,
|
||||
.chart-loading>div {
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.chart-loading {
|
||||
display: block;
|
||||
font-size: 0;
|
||||
color: #66b1ff;
|
||||
}
|
||||
|
||||
.chart-loading.la-dark {
|
||||
color: #66b1ff;
|
||||
}
|
||||
|
||||
.chart-loading>div {
|
||||
display: inline-block;
|
||||
float: none;
|
||||
background-color: currentColor;
|
||||
border: 0 solid currentColor;
|
||||
}
|
||||
|
||||
.chart-loading {
|
||||
width: 54px;
|
||||
height: 18px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.chart-loading>div:nth-child(1) {
|
||||
animation-delay: -200ms;
|
||||
}
|
||||
|
||||
.chart-loading>div:nth-child(2) {
|
||||
animation-delay: -100ms;
|
||||
}
|
||||
|
||||
.chart-loading>div:nth-child(3) {
|
||||
animation-delay: 0ms;
|
||||
}
|
||||
|
||||
.chart-loading>div {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 100%;
|
||||
margin-right: 4px;
|
||||
animation: ball-pulse 1s ease infinite;
|
||||
}
|
||||
|
||||
@keyframes ball-pulse {
|
||||
|
||||
0%,
|
||||
60%,
|
||||
100% {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
30% {
|
||||
opacity: 0.1;
|
||||
transform: scale(0.01);
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -9,25 +9,33 @@
|
|||
<el-button type="primary" @click="createAi">
|
||||
<i class="iconfont icon-chuangzuo"></i>生成教学大纲
|
||||
</el-button>
|
||||
<el-button type="danger" :disabled="!!curItem.parentId" @click="delAnswer">
|
||||
<i class="iconfont icon-shanchu"></i>
|
||||
删除大纲
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="center-con" v-loading="loading">
|
||||
<TypingEffect v-if="answer" :text="answer" :delay="10" aiShow/>
|
||||
<el-empty v-if="!answer" description="请选择符合您需要的教学模式,生成教学大纲" />
|
||||
<!-- <v-md-editor v-if="markeDownAnswer" :model-value="markeDownAnswer" mode="preview"></v-md-editor> -->
|
||||
<v-md-preview v-if="markeDownAnswer" :text="markeDownAnswer"></v-md-preview>
|
||||
|
||||
<el-empty v-else description="请选择符合您需要的教学模式,生成教学大纲" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted, onUnmounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import emitter from '@/utils/mitt'
|
||||
import * as commUtils from '@/utils/comm.js'
|
||||
import { createChart, sendChart } from '@/api/ai/index'
|
||||
import { completion, addSyllabus } from '@/api/mode/index.js'
|
||||
import TypingEffect from '@/components/typing-effect/index.vue'
|
||||
import { completion, addSyllabus, removeSyllabus, modelList } from '@/api/mode/index.js'
|
||||
import { createOutlineV2 } from '@/utils/ppt-request.js'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { cloneDeep } from 'lodash'
|
||||
|
||||
const curMode = ref(2)
|
||||
|
||||
|
@ -40,7 +48,8 @@ const modeOptions = ref([
|
|||
},
|
||||
{
|
||||
label: '知识库模型',
|
||||
value: 2
|
||||
value: 2,
|
||||
disabled: false
|
||||
}
|
||||
])
|
||||
|
||||
|
@ -49,6 +58,14 @@ const selectedData = ref([])
|
|||
emitter.on('selected', (data) => {
|
||||
selectedData.value = data
|
||||
})
|
||||
// 回显大纲
|
||||
const curItem = reactive({})
|
||||
emitter.on('onShow', (data) => {
|
||||
let outline = cloneDeep(JSON.parse(data.outline))
|
||||
markeDownAnswer.value = outline.markdown
|
||||
emitter.emit('onResult', cloneDeep(data))
|
||||
Object.assign(curItem, data)
|
||||
})
|
||||
|
||||
|
||||
const params = reactive(
|
||||
|
@ -61,21 +78,23 @@ const params = reactive(
|
|||
|
||||
// 研读
|
||||
const loading = ref(false)
|
||||
const answer = ref('')
|
||||
// const answer = reactive({})
|
||||
const markeDownAnswer = ref('')
|
||||
|
||||
const createAi = async () => {
|
||||
console.log(selectedData.value)
|
||||
if (selectedData.value.length == 0) {
|
||||
ElMessage.warning('请先选择教学环节后再生成教学大纲')
|
||||
return
|
||||
}
|
||||
onSaveTemp()
|
||||
return
|
||||
let str = selectedData.value.map( item => item.name).join('、')
|
||||
let bookV = curNode.roottitle.split('-')[1] + '版'
|
||||
loading.value = true
|
||||
try {
|
||||
|
||||
params.prompt = `针对${curNode.edustage}${curNode.edusubject}${bookV}${curNode.itemtitle}这一课,根据以下教学环节:${str},进行课件教学PPT内容设计`
|
||||
let str = selectedData.value.map( item => item.name).join('、')
|
||||
// let bookV = curNode.roottitle.split('-')[1] + '版'
|
||||
loading.value = true
|
||||
|
||||
try {
|
||||
params.prompt = prompt.value.replace(/{模板名称}/g, str)
|
||||
|
||||
//params.prompt = `针对${curNode.edustage}${curNode.edusubject}${bookV}${curNode.itemtitle}这一课,根据以下教学环节:${str},进行课件教学PPT内容设计,按照幻灯片1、幻灯片2、...的格式`
|
||||
// params.template = item.prompt
|
||||
|
||||
// 教学大模型
|
||||
|
@ -91,48 +110,68 @@ const createAi = async ()=>{
|
|||
// 知识库模型
|
||||
else {
|
||||
const res = await completion(params)
|
||||
|
||||
data = res.data
|
||||
}
|
||||
console.log(data)
|
||||
emitter('onResult', data.answer)
|
||||
answer.value = getResult(data.answer)
|
||||
|
||||
// onSaveTemp(item)
|
||||
|
||||
const res = await createOutlineV2({ query: data.answer })
|
||||
|
||||
markeDownAnswer.value = data.answer
|
||||
let outline = JSON.stringify({
|
||||
json: res.outline,
|
||||
markdown: data.answer
|
||||
})
|
||||
|
||||
|
||||
Object.assign(curItem, {...curItem, outline})
|
||||
|
||||
emitter.emit('onResult', curItem)
|
||||
onSaveTemp(outline)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 保存模板
|
||||
const onSaveTemp = async (data) => {
|
||||
if (data == '') return
|
||||
console.log(selectedData)
|
||||
const onSaveTemp = async (outline) => {
|
||||
let modelIds = selectedData.value.map(item => item.id).join(',')
|
||||
console.log(modelIds)
|
||||
console.log(user)
|
||||
const data1 = {
|
||||
const data = {
|
||||
eduId: curNode.id,
|
||||
outline: data,
|
||||
outline,
|
||||
outlineType: curMode.value == 1 ? 0 : 1,
|
||||
modelIds,
|
||||
sourceType: 1,
|
||||
createUserId: 1
|
||||
}
|
||||
// const res = await addSyllabus(data)
|
||||
|
||||
if(!item.resultId){
|
||||
item.resultId = res.data
|
||||
createUserId: user.userId,
|
||||
createUserName: user.nickName
|
||||
}
|
||||
await addSyllabus(data)
|
||||
emitter.emit('getLastInfo')
|
||||
}
|
||||
|
||||
|
||||
// 去掉字符串中的 ### **
|
||||
let getResult = (str) => {
|
||||
let newStr = str.replace(/#+|(\*\*)/g, '');
|
||||
return newStr
|
||||
// 删除大纲
|
||||
const delAnswer = () => {
|
||||
if(!curItem.id) return
|
||||
ElMessageBox.confirm(
|
||||
'确定要删除大纲吗?',
|
||||
'温馨提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
.then(async () => {
|
||||
await removeSyllabus(curItem.id)
|
||||
ElMessage.success('操作成功')
|
||||
markeDownAnswer.value = ''
|
||||
|
||||
emitter.emit('resetSelect')
|
||||
})
|
||||
.catch(() => {})
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 千帆创建对话
|
||||
const conversation_id = ref('')
|
||||
|
@ -143,9 +182,24 @@ const getChartId = () => {
|
|||
})
|
||||
}
|
||||
|
||||
onUnmounted(()=>{
|
||||
emitter.off('selected')
|
||||
})
|
||||
// 查询prompt 替换
|
||||
const prompt = ref('')
|
||||
const getPrompt = async () => {
|
||||
const { rows } = await modelList({ model: 5 })
|
||||
|
||||
let str = rows.find(item => item.name.indexOf('框架设计') != -1).prompt
|
||||
|
||||
str = str.replace('{学段}', curNode.edustage)
|
||||
str = str.replace('{学科}', curNode.edusubject)
|
||||
let bookV = curNode.roottitle + '版'
|
||||
str = str.replace('{教材版本}', bookV)
|
||||
str = str.replace('{课程名称}', `《${curNode.itemtitle}》`)
|
||||
|
||||
prompt.value = str
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const curNode = reactive({})
|
||||
onMounted(() => {
|
||||
|
@ -154,6 +208,14 @@ onMounted(() => {
|
|||
// 框架设计 用课标的dataset_id
|
||||
let jsonKey = `课标-${data.edustage}-${data.edusubject}`
|
||||
params.dataset_id = commUtils.dataSetJson[jsonKey]
|
||||
if(!params.dataset_id){
|
||||
curMode.value = 1
|
||||
modeOptions.value.forEach(item => {
|
||||
if(item.value == 2){
|
||||
item.disabled = true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 获取百度千帆会话ID
|
||||
conversation_id.value = localStorage.getItem('conversation_id')
|
||||
|
@ -161,6 +223,16 @@ onMounted(() => {
|
|||
getChartId();
|
||||
}
|
||||
|
||||
getPrompt()
|
||||
|
||||
})
|
||||
|
||||
|
||||
onUnmounted(() => {
|
||||
emitter.off('selected')
|
||||
emitter.off('onShow')
|
||||
emitter.off('editItem')
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
|
@ -169,13 +241,16 @@ onMounted(() => {
|
|||
height: 100%;
|
||||
font-size: 15px;
|
||||
flex-direction: column;
|
||||
|
||||
.center-header {
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.icon-jiahao {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.center-con {
|
||||
flex: 1;
|
||||
margin-top: 5px;
|
||||
|
@ -183,6 +258,23 @@ onMounted(() => {
|
|||
border-radius: 5px;
|
||||
text-align: left;
|
||||
overflow-y: auto;
|
||||
padding: 15px;
|
||||
|
||||
.con-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-top: 15px;
|
||||
.item-name{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.item-text {
|
||||
background: #F2F2F2;
|
||||
padding: 15px;
|
||||
border-radius: 5px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,16 +2,33 @@
|
|||
<el-dialog v-model="isDialog" :show-close="false" width="900" destroy-on-close>
|
||||
<template #header>
|
||||
<div class="custom-header flex">
|
||||
<span>{{ item.name }}</span>
|
||||
<span>编辑大纲</span>
|
||||
<i class="iconfont icon-guanbi" @click="isDialog = false"></i>
|
||||
</div>
|
||||
</template>
|
||||
<div class="dialog-content">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-input v-model="textarea" :autosize="{ minRows: 5, maxRows: 15 }" type="textarea" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="dialog-content" v-loading="loading">
|
||||
<template v-if="props.index == -1">
|
||||
<div class="flex mb-5">
|
||||
<span class="name">标题:</span>
|
||||
<el-input v-model="editItem.title" />
|
||||
</div>
|
||||
<div class="flex mb-5">
|
||||
<span class="name">副标题</span>
|
||||
<el-input v-model="editItem.subTitle" />
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="flex mb-5">
|
||||
<span class="name">标题:</span>
|
||||
<el-input v-model="editItem.chapterTitle" />
|
||||
</div>
|
||||
<div class="flex">
|
||||
<span class="name">内容:</span>
|
||||
<div class="flex edit-con">
|
||||
<el-input class="mb-3" v-model="item.chapterTitle" v-for="item in editItem.chapterContents" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
</div>
|
||||
<template #footer>
|
||||
|
@ -26,34 +43,53 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch} from 'vue'
|
||||
import { reactive, ref, watch} from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { editSyllabus } from '@/api/mode/index.js'
|
||||
import { cloneDeep } from 'lodash';
|
||||
import emitter from '@/utils/mitt';
|
||||
|
||||
const textarea = ref('')
|
||||
|
||||
|
||||
const isDialog = defineModel()
|
||||
const loading = ref(false)
|
||||
|
||||
const props = defineProps({
|
||||
item: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return { name: '11' }
|
||||
}
|
||||
|
||||
},
|
||||
index: {
|
||||
type: [Number, String]
|
||||
}
|
||||
})
|
||||
|
||||
watch(() => props.item.answer, (newVal) => {
|
||||
const editItem = reactive({})
|
||||
|
||||
watch(() => isDialog.value, (newVal) => {
|
||||
if(newVal){
|
||||
textarea.value = newVal
|
||||
let data = cloneDeep(props.item)
|
||||
Object.assign(editItem, data)
|
||||
}
|
||||
|
||||
},{ deep: true })
|
||||
|
||||
const emit = defineEmits(['saveEdit'])
|
||||
const onSave = () =>{
|
||||
emitter.emit('changeResult', textarea.value)
|
||||
emitter.emit('editItem', editItem)
|
||||
isDialog.value = false
|
||||
return
|
||||
loading.value = true
|
||||
let data = cloneDeep(props.item)
|
||||
data.outline = textarea.value
|
||||
|
||||
editSyllabus(data).then( res =>{
|
||||
isDialog.value = false
|
||||
ElMessage.success('操作成功')
|
||||
emitter.emit('onShow', data)
|
||||
}).finally( ()=>{
|
||||
loading.value = false
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
@ -72,6 +108,12 @@ const onSave = () =>{
|
|||
|
||||
.dialog-content {
|
||||
padding-top: 10px;
|
||||
|
||||
.name{
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.edit-con{
|
||||
width: 100%;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -1,159 +0,0 @@
|
|||
<template>
|
||||
<el-dialog v-model="mode" :show-close="false" width="600" append-to-body destroy-on-close>
|
||||
<template #header>
|
||||
<div class="custom-header flex">
|
||||
<span>{{ item.ex3 == '1' ? '请输入新的模板名称' : item.isAdd ? '添加提示词' : '编辑提示词' }}</span>
|
||||
<i class="iconfont icon-guanbi" @click="mode = false"></i>
|
||||
</div>
|
||||
</template>
|
||||
<div class="dialog-content" v-loading="loading">
|
||||
<p class="small-tip" v-if="item && item.ex3 == '1'">*当前模板为系统预设,不支持直接操作。需要复制一份为自己的然后再操作</p>
|
||||
<el-form :model="form" label-width="auto">
|
||||
<el-form-item label="名称">
|
||||
<el-input v-model="form.name" />
|
||||
</el-form-item>
|
||||
<el-form-item label="提示词" v-if="item.ex3 == '1' ? false : true">
|
||||
<el-input v-model="form.prompt" type="textarea" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="mode = false">取消</el-button>
|
||||
<el-button type="primary" @click="saveAdd">
|
||||
确定
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import emitter from '@/utils/mitt';
|
||||
import { addKeyWords, addChildTemp, editChildTemp } from '@/api/mode/index'
|
||||
|
||||
const mode = defineModel()
|
||||
const props = defineProps({
|
||||
modeType: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
item: { // 当前操作的模板
|
||||
type: Object,
|
||||
default: () => {
|
||||
return { ex3: '' }
|
||||
}
|
||||
},
|
||||
|
||||
})
|
||||
|
||||
const form = reactive({
|
||||
name: '',
|
||||
prompt: '',
|
||||
})
|
||||
|
||||
|
||||
watch(() => mode.value, (newVal) => {
|
||||
if(newVal){
|
||||
if (props.item.isAdd) {
|
||||
form.name = ''
|
||||
form.prompt = ''
|
||||
}
|
||||
else{
|
||||
form.name = props.item?.name
|
||||
form.prompt = props.item?.prompt
|
||||
|
||||
}
|
||||
}
|
||||
},{ deep: true})
|
||||
|
||||
const loading = ref(false)
|
||||
const saveAdd = async () => {
|
||||
loading.value = true
|
||||
|
||||
if (props.item.ex3 == '1') {
|
||||
let id; // id 为主模板id
|
||||
if (props.item.isAdd) {
|
||||
id = props.item.id
|
||||
}
|
||||
else{
|
||||
// 编辑状态下 item 为子模板 主模板则是item.parentId
|
||||
id = props.item.parentId
|
||||
}
|
||||
try {
|
||||
// 系统预设模板 copy一份
|
||||
const { msg } = await addKeyWords({ name: form.name, id })
|
||||
emitter.emit('onGetMain', props.item)
|
||||
ElMessage.success(msg)
|
||||
mode.value = false
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
} else {
|
||||
if (props.item.isAdd) {
|
||||
onAddChildTemp(props.item.id)
|
||||
}
|
||||
else {
|
||||
try {
|
||||
let data = JSON.parse(JSON.stringify(props.item))
|
||||
data.name = form.name;
|
||||
data.prompt = form.prompt
|
||||
const { msg } = await editChildTemp(data)
|
||||
emitter.emit('onGetChild', data )
|
||||
ElMessage.success(msg)
|
||||
mode.value = false
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 添加子模板
|
||||
const onAddChildTemp = async (parentId) => {
|
||||
// 添加子模板
|
||||
let obj = {
|
||||
name: form.name,
|
||||
type: 2, // 子模板 固定值为2
|
||||
sortNum: 1,
|
||||
parentId,
|
||||
lmType: 1,
|
||||
model: props.modeType,
|
||||
prompt: form.prompt,
|
||||
ex1: props.item.ex1, //学段
|
||||
ex2: props.item.ex2, // 学科
|
||||
ex3: '', //是否系统预设 这里默认空
|
||||
}
|
||||
try {
|
||||
var { msg } = await addChildTemp(obj)
|
||||
emitter.emit('onGetChild')
|
||||
ElMessage.success(msg)
|
||||
mode.value = false
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.custom-header {
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.icon-guanbi {
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.small-tip {
|
||||
text-align: left;
|
||||
font-size: 12px;
|
||||
margin-bottom: 15px;
|
||||
color: #F56C6C;
|
||||
}
|
||||
</style>
|
|
@ -1,193 +1,398 @@
|
|||
<template>
|
||||
<div class="container-left flex">
|
||||
<div class="left-header flex">教学模式</div>
|
||||
<div class="left-con" v-loading="loading">
|
||||
<el-empty v-if="!(tempList.length)" description="暂无数据" />
|
||||
<div class="con-item" v-for="item in tempList" :key="item.id" :class=" actId == item.id ? 'item-act' : ''">
|
||||
<div class="item-header flex">
|
||||
<div class="container-left flex" v-loading="loading">
|
||||
<div class="left-header flex">
|
||||
<span>教学模式</span>
|
||||
<div>
|
||||
<el-button type="primary" link @click="resetSelect">重置</el-button>
|
||||
<el-button type="primary" link @click="
|
||||
addVisible = true,
|
||||
addChild = false,
|
||||
isEdit = false
|
||||
"><i class="iconfont icon-jiahao"></i>新增</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="left-list">
|
||||
<div class="item" v-for="item in templateList" :key="item.id">
|
||||
<div class="item-name flex" @mouseenter="item.isAdd = true" @mouseleave="item.isAdd = false"
|
||||
@click="toggleParent(item)">
|
||||
<div class="flex">
|
||||
<span>{{ item.name }}</span>
|
||||
<el-button type="primary" link @click="onSelect(item)">选择模式</el-button>
|
||||
<!--个人教学模式才会有添加、编辑-->
|
||||
<div v-if="!item.ex3" class="ml-3">
|
||||
<el-button type="primary" link @click.stop="addModeChild(item)">添加</el-button>
|
||||
<el-button type="primary" link @click.stop="editMode(item)">编辑</el-button>
|
||||
</div>
|
||||
<div class="content-list">
|
||||
<div class="item-list flex" >
|
||||
<el-card class="item-card" shadow="never" v-for="el in item.child" :key="el.id">
|
||||
<p class="card-name">
|
||||
<el-text line-clamp="1" :title="el.name">
|
||||
{{ el.name }}
|
||||
</el-text>
|
||||
</p>
|
||||
<div class="card-text">
|
||||
<el-text line-clamp="4" :title="el.prompt">
|
||||
{{ el.prompt }}
|
||||
</el-text>
|
||||
</div>
|
||||
</el-card>
|
||||
<!--加号 数鼠标悬浮 显示-->
|
||||
<i v-show="item.isAdd && !item.selected" class="iconfont icon-jiahao"></i>
|
||||
<!--减号 选中之后显示-->
|
||||
<i v-show="item.selected" class="iconfont icon-zuixiaohua"></i>
|
||||
</div>
|
||||
<div class="item-child flex" :class="child.selected ? 'act-child' : ''" v-for="child in item.children"
|
||||
:key="child.id" @mouseenter="child.isAdd = true" @mouseleave="child.isAdd = false"
|
||||
@click="toggleChild(item, child)">
|
||||
<div>
|
||||
<span>{{ child.name }}</span>
|
||||
<!--个人教学模式才会有编辑-->
|
||||
<el-button v-if="!child.ex3" class="ml-3" type="primary" link @click.stop="editMode(child)">编辑</el-button>
|
||||
</div>
|
||||
<i v-show="child.isAdd && !child.selected" class="iconfont icon-jiahao"></i>
|
||||
<i v-show="child.selected" class="iconfont icon-zuixiaohua"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--弹窗-->
|
||||
<el-dialog v-model="addVisible" append-to-body :show-close="false" width="550" :before-close="handleBeforeClose"
|
||||
style="border-radius: 10px; padding: 10px 15px">
|
||||
<template #header>
|
||||
<div class="mode-dialog-header flex">
|
||||
<span>{{ addChild ? '教学环节' : '教学模式' }}</span>
|
||||
<i class="iconfont icon-guanbi" @click="addVisible = false"></i>
|
||||
</div>
|
||||
</template>
|
||||
<el-form ref="ruleFormRef" style="max-width: 600px" :model="ruleForm" :rules="rules" label-width="auto"
|
||||
class="demo-ruleForm">
|
||||
<el-form-item :label="`教学${addChild ? '环节' : '模式'}名称`" prop="name">
|
||||
<div class="flex" style="width: 100%">
|
||||
<el-input v-model="ruleForm.name" />
|
||||
<el-button v-if="isEdit" link type="danger" class="ml-5 mr-3" @click="onDel">删除</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="说明" v-if="addChild" prop="prompt">
|
||||
<el-input v-model="ruleForm.prompt" type="textarea" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="mt-10 form-btn">
|
||||
<el-button @click="closeDialog">关闭</el-button>
|
||||
<el-button type="primary" @click="onSubmit(ruleFormRef)">保存</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted, onUnmounted } from 'vue';
|
||||
import emitter from '@/utils/mitt';
|
||||
import { ref, reactive, onMounted, onUnmounted } from 'vue'
|
||||
import { modelList } from '@/api/mode/index'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import emitter from '@/utils/mitt'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { addChildTemp, editChildTemp, removeChildTemp, syllabusList } from '@/api/mode'
|
||||
import { cloneDeep } from 'lodash'
|
||||
|
||||
const { user } = useUserStore()
|
||||
|
||||
// 获取模板
|
||||
let list = ref([])
|
||||
const getTemplate = async (id) => {
|
||||
const { rows } = await modelList({ createUser: user.userId, model: 4, type: 1, pageNum: 1, pageSize: 10000})
|
||||
list.value = rows
|
||||
if(list.value.length){
|
||||
getChildTemp(id)
|
||||
}
|
||||
}
|
||||
|
||||
// 获取子模板
|
||||
const actId = ref('')
|
||||
const loading = ref(false)
|
||||
const tempList = ref([])
|
||||
const getChildTemp = async (parentId) => {
|
||||
tempList.value.length = 0
|
||||
const templateList = ref([])
|
||||
const getTemplate = async () => {
|
||||
loading.value = true
|
||||
for (let item of list.value) {
|
||||
try {
|
||||
const { rows } = await modelList({ model: 4, type: 2, parentId: item.id })
|
||||
tempList.value.push({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
child: rows
|
||||
const { rows } = await modelList({
|
||||
createUser: user.userId,
|
||||
model: 4,
|
||||
pageNum: 1,
|
||||
pageSize: 10000
|
||||
})
|
||||
} finally {
|
||||
loading.value = false
|
||||
|
||||
// 过滤出 type 为 1 的项
|
||||
let ary1 = rows.filter((item) => item.type === 1)
|
||||
templateList.value = ary1.map((parent) => {
|
||||
parent.children = rows.filter((child) => child.type === 2 && child.parentId === parent.id)
|
||||
return parent
|
||||
})
|
||||
getSyllabus()
|
||||
}
|
||||
actId.value = tempList.value[0].id
|
||||
|
||||
// 查询生成大纲记录
|
||||
const getSyllabus = async () => {
|
||||
const { rows } = await syllabusList({
|
||||
createUserId: user.userId,
|
||||
eduId: curNode.id,
|
||||
sourceType: 1,
|
||||
pageSize: 1,
|
||||
orderByColumn: 'createTime',
|
||||
isAsc: 'desc'
|
||||
})
|
||||
if (rows && rows.length) {
|
||||
const idsAry = rows
|
||||
.at(-1)
|
||||
.modelIds.split(',')
|
||||
.map((item) => Number(item))
|
||||
// 设置选中
|
||||
let ary = []
|
||||
templateList.value.forEach((parent) => {
|
||||
parent.children.forEach((child) => {
|
||||
child.selected = idsAry.includes(child.id)
|
||||
if (child.selected) {
|
||||
ary.push(child)
|
||||
}
|
||||
if(parentId){
|
||||
const item = tempList.value.find(item => item.id == parentId)
|
||||
emitter.emit('changeMode', item)
|
||||
})
|
||||
// 更新父项的 selected 状态
|
||||
parent.selected = parent.children.every((child) => child.selected)
|
||||
})
|
||||
// 回显大纲数据
|
||||
emitter.emit('onShow', rows.at(-1))
|
||||
emitter.emit('selected', ary)
|
||||
}
|
||||
}
|
||||
|
||||
// 重置选中
|
||||
const resetSelect = () => {
|
||||
templateList.value.forEach((item) => {
|
||||
item.selected = false
|
||||
item.children.forEach((el) => {
|
||||
el.selected = false
|
||||
})
|
||||
})
|
||||
emitter.emit('selected', [])
|
||||
}
|
||||
|
||||
emitter.on('resetSelect', () => {
|
||||
resetSelect()
|
||||
getSyllabus()
|
||||
})
|
||||
emitter.on('getLastInfo',() =>{
|
||||
getSyllabus()
|
||||
})
|
||||
|
||||
// 点击教学模式
|
||||
const toggleParent = (parent) => {
|
||||
parent.selected = !parent.selected
|
||||
parent.children.forEach((child) => {
|
||||
child.selected = parent.selected
|
||||
})
|
||||
const selectedData = templateList.value
|
||||
.map((item) => item.children.filter((child) => child.selected))
|
||||
.flat()
|
||||
// .flat()将二维数组扁平化为一维数组
|
||||
emitter.emit('selected', selectedData)
|
||||
}
|
||||
|
||||
// 点击教学环节
|
||||
const toggleChild = (parent, child) => {
|
||||
child.selected = !child.selected
|
||||
updateParentSelection(parent)
|
||||
const selectedData = templateList.value
|
||||
.map((item) => item.children.filter((child) => child.selected))
|
||||
.flat()
|
||||
emitter.emit('selected', selectedData)
|
||||
}
|
||||
|
||||
// 检查父项(教学模式)的所有子项(教学环节)是否都被选中,如果是,则设置父项为选中状态,否则取消选中
|
||||
const updateParentSelection = (parent) => {
|
||||
parent.selected = parent.children.every((child) => child.selected)
|
||||
}
|
||||
|
||||
// 弹窗
|
||||
const addVisible = ref(false)
|
||||
|
||||
const ruleFormRef = ref()
|
||||
const rules = reactive({
|
||||
name: [{ required: true, message: '不能为空', trigger: 'blur' }]
|
||||
})
|
||||
const ruleForm = reactive({
|
||||
name: '',
|
||||
prompt: ''
|
||||
})
|
||||
// 提交
|
||||
const onSubmit = async (formEl) => {
|
||||
if (!formEl) return
|
||||
await formEl.validate(async (valid, fields) => {
|
||||
if (valid) {
|
||||
// 修改
|
||||
if (isEdit.value) {
|
||||
let data = cloneDeep(curEditItem)
|
||||
data.name = ruleForm.name
|
||||
await editChildTemp(data)
|
||||
}
|
||||
// 新增
|
||||
else {
|
||||
emitter.emit('changeMode', tempList.value[0])
|
||||
let obj = {
|
||||
ex1: curNode.edustage,
|
||||
ex2: curNode.edusubject,
|
||||
model: 4,
|
||||
name: ruleForm.name,
|
||||
sortNum: 1,
|
||||
type: 1
|
||||
}
|
||||
// 新增教学环节
|
||||
if (addChild.value) {
|
||||
obj.parentId = curEditItem.id
|
||||
obj.prompt = ruleForm.prompt
|
||||
obj.type = 2
|
||||
}
|
||||
await addChildTemp(obj)
|
||||
}
|
||||
ElMessage.success('操作成功')
|
||||
resetForm()
|
||||
addVisible.value = false
|
||||
getTemplate()
|
||||
} else {
|
||||
console.log('error submit!', fields)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 是否编辑
|
||||
const isEdit = ref(false)
|
||||
// 区分是新增教学模式false 还是现在教学环节true
|
||||
const addChild = ref(false)
|
||||
|
||||
// 操作之后获取子模板
|
||||
emitter.on('onGetChild', async (data) => {
|
||||
|
||||
await getTemplate(data.parentId)
|
||||
|
||||
})
|
||||
// 操作之后获取主模板
|
||||
emitter.on('onGetMain', (item) => {
|
||||
getTemplate(item.parentId)
|
||||
})
|
||||
|
||||
// 选择模板
|
||||
const emit = defineEmits([''])
|
||||
const onSelect = (item) =>{
|
||||
actId.value = item.id
|
||||
item.child.forEach(el =>{
|
||||
el.aiShow = false
|
||||
})
|
||||
emitter.emit('changeMode', item)
|
||||
const curEditItem = reactive({})
|
||||
const addModeChild = (item) => {
|
||||
isEdit.value = false
|
||||
Object.assign(curEditItem, item)
|
||||
addChild.value = true
|
||||
addVisible.value = true
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
const editMode = (item) => {
|
||||
isEdit.value = true
|
||||
addChild.value = false
|
||||
Object.assign(curEditItem, item)
|
||||
ruleForm.name = item.name
|
||||
addVisible.value = true
|
||||
}
|
||||
|
||||
// 删除 教学模式 教学环节
|
||||
const onDel = () => {
|
||||
ElMessageBox.confirm('确定要删除模板吗?', '温馨提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(async () => {
|
||||
await removeChildTemp(curEditItem.id)
|
||||
ElMessage.success('操作成功')
|
||||
resetForm()
|
||||
addVisible.value = false
|
||||
getTemplate()
|
||||
})
|
||||
.catch(() => { })
|
||||
}
|
||||
|
||||
const closeDialog = () => {
|
||||
handleBeforeClose(() => (addVisible.value = false))
|
||||
}
|
||||
|
||||
const handleBeforeClose = (done) => {
|
||||
resetForm()
|
||||
done()
|
||||
}
|
||||
const resetForm = () => {
|
||||
if (ruleFormRef.value) {
|
||||
ruleFormRef.value.resetFields()
|
||||
}
|
||||
}
|
||||
|
||||
const curNode = reactive({})
|
||||
onMounted(() => {
|
||||
let data = sessionStore.get('subject.curNode')
|
||||
Object.assign(curNode, data);
|
||||
Object.assign(curNode, data)
|
||||
getTemplate()
|
||||
})
|
||||
|
||||
|
||||
// 解绑
|
||||
onUnmounted(() => {
|
||||
|
||||
emitter.off('onGetMain');
|
||||
emitter.off('onGetChild');
|
||||
emitter.off('resetSelect')
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.container-left {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 15px;
|
||||
flex-direction: column;
|
||||
|
||||
.left-header {
|
||||
height: 45px;
|
||||
background: #F6F6F6;
|
||||
border-radius: 5px 0 0 0;
|
||||
align-items: center;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
text-indent: 2em;
|
||||
}
|
||||
|
||||
.left-con {
|
||||
flex: 1;
|
||||
background: #fff;
|
||||
border-radius: 0 0 0 5px;
|
||||
padding: 15px;
|
||||
box-sizing: border-box;
|
||||
font-size: 14px;
|
||||
overflow: auto;
|
||||
.item-header {
|
||||
height: 32px;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.con-item {
|
||||
margin-bottom: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 10px;
|
||||
}
|
||||
.item-list{
|
||||
align-items: center;
|
||||
|
||||
padding: 10px;
|
||||
.icon-jiahao {
|
||||
font-size: 12px;
|
||||
}
|
||||
.item-act{
|
||||
border: solid 1px #409eff;
|
||||
}
|
||||
|
||||
.left-list {
|
||||
flex: 1;
|
||||
margin-top: 5px;
|
||||
background-color: #fff;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.item-card {
|
||||
width: 130px;
|
||||
font-size: 13px;
|
||||
padding: 10px;
|
||||
margin-right: 20px;
|
||||
flex-shrink: 0;
|
||||
border-radius: 10px;
|
||||
:deep(.el-card__body) {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.card-name {
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.card-text {
|
||||
text-align: left;
|
||||
padding: 0 10px;
|
||||
line-height: 30px;
|
||||
overflow-y: auto;
|
||||
|
||||
.el-text{
|
||||
font-size: 12px !important;
|
||||
.item-name {
|
||||
line-height: 40px;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
justify-content: space-between;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.item-child {
|
||||
padding-left: 3em;
|
||||
justify-content: space-between;
|
||||
cursor: pointer;
|
||||
align-items: center;
|
||||
padding-right: 10px;
|
||||
margin-bottom: 3px;
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
border-radius: 50%;
|
||||
background-color: #666;
|
||||
position: absolute;
|
||||
left: 2em;
|
||||
top: 50%;
|
||||
transform: translate(0, -50%);
|
||||
}
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
font-weight: bold;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.icon-jiahao {
|
||||
color: #409eff;
|
||||
}
|
||||
|
||||
.icon-zuixiaohua {
|
||||
color: #f56c6c;
|
||||
}
|
||||
|
||||
.act-child {
|
||||
border-radius: 5px;
|
||||
background: #eaf3ff;
|
||||
|
||||
&::after {
|
||||
background-color: #409eff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.mode-dialog-header {
|
||||
justify-content: space-between;
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
|
||||
.icon-guanbi {
|
||||
font-size: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.content-list{
|
||||
overflow-x: auto
|
||||
}
|
||||
.content-list::-webkit-scrollbar {
|
||||
height: 8px;
|
||||
|
||||
.form-btn {
|
||||
text-align: right;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
</style>
|
|
@ -1,386 +0,0 @@
|
|||
<template>
|
||||
<div class="container-left flex" v-loading="loading">
|
||||
<div class="left-header flex">
|
||||
<span>教学模式</span>
|
||||
<div>
|
||||
<el-button type="primary" link @click="resetSelect">重置</el-button>
|
||||
<el-button type="primary" link @click="addVisible = true; addChild = false; isEdit = false"><i class="iconfont icon-jiahao"
|
||||
></i>新增</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="left-list">
|
||||
<div class="item" v-for="item in templateList" :key="item.id">
|
||||
<div class="item-name flex" @mouseenter="item.isAdd = true" @mouseleave="item.isAdd = false"
|
||||
@click="handleItem(item)">
|
||||
<div class="flex">
|
||||
<span>{{ item.name }}</span>
|
||||
<!--个人教学模式才会有添加、编辑-->
|
||||
<div v-if="!item.ex3" class="ml-3">
|
||||
<el-button type="primary" link @click.stop="addModeChild(item)">添加</el-button>
|
||||
<el-button type="primary" link @click.stop="editMode(item)">编辑</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<!--加号 数鼠标悬浮 显示-->
|
||||
<i v-show="item.isAdd && !item.isSelect" class="iconfont icon-jiahao"></i>
|
||||
<!--减号 选中之后显示-->
|
||||
<i v-show="item.isSelect" class="iconfont icon-zuixiaohua"></i>
|
||||
</div>
|
||||
<div class="item-child flex" :class="el.isSelect ? 'act-child' : ''" v-for="el in item.child" :key="el.id"
|
||||
@mouseenter="el.isAdd = true" @mouseleave="el.isAdd = false" @click="handleItemChild(el)">
|
||||
<div>
|
||||
<span>{{ el.name }}</span>
|
||||
<!--个人教学模式才会有编辑-->
|
||||
<el-button v-if="!el.ex3" class="ml-3" type="primary" link @click.stop="editMode(el)">编辑</el-button>
|
||||
</div>
|
||||
<i v-show="el.isAdd && !el.isSelect" class="iconfont icon-jiahao"></i>
|
||||
<i v-show="el.isSelect" class="iconfont icon-zuixiaohua "></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--弹窗-->
|
||||
<el-dialog v-model="addVisible" append-to-body :show-close="false" width="550" :before-close="handleBeforeClose"
|
||||
style="border-radius: 10px; padding: 10px 15px;">
|
||||
<template #header>
|
||||
<div class="mode-dialog-header flex">
|
||||
<span>{{ addChild ? '教学环节' : '教学模式' }}</span>
|
||||
<i class="iconfont icon-guanbi" @click="addVisible = false"></i>
|
||||
</div>
|
||||
</template>
|
||||
<el-form ref="ruleFormRef" style="max-width: 600px" :model="ruleForm" :rules="rules" label-width="auto"
|
||||
class="demo-ruleForm">
|
||||
<el-form-item :label="`教学${ addChild ? '环节' : '模式'}名称`" prop="name">
|
||||
<div class="flex" style="width: 100%;">
|
||||
<el-input v-model="ruleForm.name" />
|
||||
<el-button v-if="isEdit" link type="danger" class="ml-5 mr-3" @click="onDel">删除</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="说明" v-if="addChild" prop="prompt">
|
||||
<el-input v-model="ruleForm.prompt" type="textarea" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="mt-10 form-btn">
|
||||
<el-button @click="closeDialog">关闭</el-button>
|
||||
<el-button type="primary" @click="onSubmit(ruleFormRef)">保存</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { modelList } from '@/api/mode/index'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import emitter from '@/utils/mitt'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { addChildTemp, editChildTemp, removeChildTemp } from '@/api/mode'
|
||||
import { cloneDeep } from 'lodash'
|
||||
|
||||
|
||||
const { user } = useUserStore()
|
||||
|
||||
// 获取主模板
|
||||
const loading = ref(false)
|
||||
let list = ref([])
|
||||
const getTemplate = async (id) => {
|
||||
loading.value = true
|
||||
const { rows } = await modelList({ createUser: user.userId, model: 4, type: 1, pageNum: 1, pageSize: 10000 })
|
||||
loading.value = false
|
||||
list.value = rows
|
||||
if (list.value.length) {
|
||||
getChildTemp(id)
|
||||
}
|
||||
}
|
||||
|
||||
// 获取子模板
|
||||
const templateList = ref([])
|
||||
const getChildTemp = async () => {
|
||||
templateList.value = []
|
||||
loading.value = true
|
||||
|
||||
for (let item of list.value) {
|
||||
try {
|
||||
let { rows } = await modelList({ model: 4, type: 2, parentId: item.id })
|
||||
templateList.value.push({
|
||||
...item,
|
||||
child: rows
|
||||
})
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 重置选中
|
||||
const resetSelect = () =>{
|
||||
templateList.value.forEach(item =>{
|
||||
item.isSelect = false
|
||||
item.child.forEach( el=>{
|
||||
el.isSelect = false
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const handleItem = (item) => {
|
||||
if(item.newMode) return
|
||||
item.isSelect = !item.isSelect
|
||||
item.child.forEach(el => {
|
||||
el.isSelect = !el.isSelect
|
||||
})
|
||||
|
||||
let data = collectSelectedItems(templateList.value)
|
||||
emitter.emit('selected', data)
|
||||
}
|
||||
|
||||
const handleItemChild = (el) =>{
|
||||
el.isSelect = !el.isSelect
|
||||
|
||||
let data = collectSelectedItems(templateList.value)
|
||||
emitter.emit('selected', data)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 定义一个函数来过滤 children 中 isSelect 为 true 的对象
|
||||
const collectSelectedItems = (data) => {
|
||||
let result = [];
|
||||
|
||||
// 遍历每个父节点
|
||||
data.forEach(parent => {
|
||||
if (Array.isArray(parent.child)) {
|
||||
// 使用 filter 方法筛选出 children 中 isSelect 为 true 的对象
|
||||
const selectedChildren = parent.child.filter(child => child.isSelect === true);
|
||||
|
||||
// 将筛选后的子节点添加到结果数组中
|
||||
result = result.concat(selectedChildren.map(child => ({
|
||||
...child
|
||||
})));
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 弹窗
|
||||
const addVisible = ref(false)
|
||||
|
||||
const ruleFormRef = ref()
|
||||
const rules = reactive({
|
||||
name: [
|
||||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||||
]
|
||||
})
|
||||
const ruleForm = reactive({
|
||||
name: '',
|
||||
prompt: ''
|
||||
})
|
||||
// 提交
|
||||
const onSubmit = async (formEl) =>{
|
||||
if (!formEl) return
|
||||
await formEl.validate(async (valid, fields) => {
|
||||
if (valid) {
|
||||
|
||||
// 修改
|
||||
if(isEdit.value){
|
||||
let data = cloneDeep(curEditItem)
|
||||
data.name = ruleForm.name
|
||||
await editChildTemp(data)
|
||||
}
|
||||
// 新增
|
||||
else{
|
||||
let obj = {
|
||||
ex1: curNode.edustage,
|
||||
ex2: curNode.edusubject,
|
||||
model: 4,
|
||||
name: ruleForm.name,
|
||||
sortNum: 1,
|
||||
type: 1
|
||||
}
|
||||
// 新增教学环节
|
||||
if(addChild.value){
|
||||
obj.parentId = curEditItem.id
|
||||
obj.prompt = ruleForm.prompt
|
||||
obj.type = 2
|
||||
}
|
||||
await addChildTemp(obj)
|
||||
|
||||
}
|
||||
ElMessage.success('操作成功')
|
||||
resetForm()
|
||||
addVisible.value = false
|
||||
getTemplate()
|
||||
} else {
|
||||
console.log('error submit!', fields)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 是否编辑
|
||||
const isEdit = ref(false)
|
||||
// 区分是新增教学模式false 还是现在教学环节true
|
||||
const addChild = ref(false)
|
||||
|
||||
const curEditItem = reactive({})
|
||||
const addModeChild = (item) =>{
|
||||
isEdit.value = false
|
||||
Object.assign(curEditItem, item)
|
||||
addChild.value = true
|
||||
addVisible.value = true
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
const editMode = (item)=>{
|
||||
isEdit.value = true
|
||||
addChild.value = false
|
||||
Object.assign(curEditItem, item)
|
||||
ruleForm.name = item.name
|
||||
addVisible.value = true
|
||||
}
|
||||
|
||||
// 删除 教学模式 教学环节
|
||||
const onDel = () =>{
|
||||
ElMessageBox.confirm(
|
||||
'确定要删除模板吗?',
|
||||
'温馨提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
.then(async () => {
|
||||
await removeChildTemp(curEditItem.id)
|
||||
ElMessage.success('操作成功')
|
||||
resetForm()
|
||||
addVisible.value = false
|
||||
getTemplate()
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
|
||||
|
||||
const closeDialog = () =>{
|
||||
handleBeforeClose(() => addVisible.value = false);
|
||||
}
|
||||
|
||||
const handleBeforeClose = (done) =>{
|
||||
resetForm()
|
||||
done()
|
||||
}
|
||||
const resetForm = () => {
|
||||
if (ruleFormRef.value) {
|
||||
ruleFormRef.value.resetFields();
|
||||
}
|
||||
};
|
||||
|
||||
const curNode = reactive({})
|
||||
onMounted(() => {
|
||||
let data = sessionStore.get('subject.curNode')
|
||||
Object.assign(curNode, data);
|
||||
getTemplate()
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.container-left {
|
||||
height: 100%;
|
||||
font-size: 15px;
|
||||
flex-direction: column;
|
||||
|
||||
.left-header {
|
||||
height: 32px;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.icon-jiahao {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.left-list {
|
||||
flex: 1;
|
||||
margin-top: 5px;
|
||||
background-color: #fff;
|
||||
border-radius: 5px;
|
||||
text-align: left;
|
||||
padding: 0 10px;
|
||||
line-height: 30px;
|
||||
overflow-y: auto;
|
||||
|
||||
.item-name {
|
||||
line-height: 40px;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
justify-content: space-between;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.item-child {
|
||||
padding-left: 3em;
|
||||
justify-content: space-between;
|
||||
cursor: pointer;
|
||||
align-items: center;
|
||||
padding-right: 10px;
|
||||
margin-bottom: 3px;
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
border-radius: 50%;
|
||||
background-color: #666;
|
||||
position: absolute;
|
||||
left: 2em;
|
||||
top: 50%;
|
||||
transform: translate(0, -50%);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
font-weight: bold;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.icon-jiahao {
|
||||
color: #409eff;
|
||||
}
|
||||
|
||||
.icon-zuixiaohua {
|
||||
color: #f56c6c;
|
||||
}
|
||||
|
||||
.act-child {
|
||||
border-radius: 5px;
|
||||
background: #eaf3ff;
|
||||
|
||||
&::after {
|
||||
background-color: #409eff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.mode-dialog-header {
|
||||
justify-content: space-between;
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
|
||||
.icon-guanbi {
|
||||
font-size: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
.form-btn{
|
||||
text-align: right;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
</style>
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
<template>
|
||||
<el-dialog v-model="open" v-bind="dAttrs">
|
||||
<el-dialog class="aix-progress-dialog" v-model="open" v-bind="dAttrs">
|
||||
<el-progress type="dashboard" v-bind="$attrs.pg" />
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
@ -29,5 +29,10 @@ const dAttrs = computed(() => {
|
|||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
||||
<style>
|
||||
.aix-progress-dialog .el-dialog__body{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
|
@ -1,107 +1,49 @@
|
|||
<template>
|
||||
<div class="container-right flex">
|
||||
<div class="right-header flex">
|
||||
<div class="header-left">
|
||||
<!-- <el-button type="primary" link>
|
||||
<i class="iconfont icon-jiahao"></i>新活动
|
||||
</el-button>
|
||||
<el-button type="primary" link>
|
||||
<i class="iconfont icon-baocun"></i>保存为教学模式
|
||||
</el-button> -->
|
||||
</div>
|
||||
<div class="header-right">
|
||||
<el-select v-model="curMode" placeholder="Select" class="mr-4 w-30">
|
||||
<el-option v-for="item in modeOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
<el-button type="primary" :disabled="!(resultList.length)" @click="getCompletion">一键研读</el-button>
|
||||
<el-button type="danger" @click="onCreate">生成PPT</el-button>
|
||||
<span>预览</span>
|
||||
<div>
|
||||
<el-button :disabled="!result?.outline" type="danger" @click="onCreate">一键生成</el-button>
|
||||
<el-button :disabled="!result?.parentId" @click="openAiPPT">编辑</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right-con flex" ref="listRef">
|
||||
<el-empty v-if="!(resultList.length)" description="暂无数据" />
|
||||
<div class="con-item flex" v-for="(item, index) in resultList" :key="item.id" v-loading="item.loading">
|
||||
<div class="item-top flex">
|
||||
<span>{{ item.name }}</span>
|
||||
<el-popover placement="bottom-end" trigger="hover" popper-class="template-custom-popover">
|
||||
<template #reference>
|
||||
<el-button link type="primary">
|
||||
<i class="iconfont icon-shenglvehao"></i></el-button>
|
||||
</template>
|
||||
<template #default>
|
||||
<el-button type="primary" link @click="editKeyWord(item, false)">编辑</el-button>
|
||||
<el-button type="primary" link @click="removeItem(item, true)">移除</el-button>
|
||||
</template>
|
||||
</el-popover>
|
||||
</div>
|
||||
<div class="item-bom">
|
||||
<div class="item-prompt">{{ item.prompt }}</div>
|
||||
<div class="item-answer" v-if="item.answer">
|
||||
<div class="answer-text">
|
||||
<TypingEffect v-if="isStarted[index]" :text="item.answer" :delay="10" :aiShow="item.aiShow"
|
||||
@complete="handleCompleteText($event, index)" @updateScroll="scrollToBottom($event, index)" />
|
||||
</div>
|
||||
<div class="item-btn flex">
|
||||
<el-button type="primary" link @click="againResult(index, item)">
|
||||
<i class="iconfont icon-ai1"></i>
|
||||
重新生成
|
||||
</el-button>
|
||||
<el-button type="primary" link @click="onAdjust(index, item)">
|
||||
<i class="iconfont icon-duihua"></i>
|
||||
AI对话调整
|
||||
</el-button>
|
||||
<el-button type="primary" link @click="onEdit(index, item)">
|
||||
<i class="iconfont icon-bianji1"></i>
|
||||
手动编辑结果
|
||||
</el-button>
|
||||
<div class="right-con">
|
||||
<el-empty v-if="!result?.parentId" description="请先生成教学大纲,再生成教学课件" />
|
||||
<div v-for="(item,index) in pptSlides" class="right-con-item">
|
||||
<div>{{index+1}}</div><img :src="item.fileurl">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<EditDialog v-model="isEdit" :item="curItem" />
|
||||
<AdjustDialog v-model="isAdjust" :item="curItem" :curMode="curMode" :conversation_id="conversation_id" />
|
||||
<PptDialog @add-success="addAiPPT" :dataList="resultList" v-model="pptDialog" />
|
||||
<PptDialog @close-dialogs="pptDialog = false" @add-success="addAiPPT" :dataList="result" v-model="pptDialog" />
|
||||
<progress-dialog v-model:visible="pgDialog.visible" v-bind="pgDialog" />
|
||||
<!--添加、编辑提示词-->
|
||||
<keywordDialog v-model="isWordDialog" :item="curItem" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, onUnmounted, reactive, nextTick } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import {ref, onUnmounted, onMounted, reactive} from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import emitter from '@/utils/mitt'
|
||||
import EditDialog from './edit-dialog.vue'
|
||||
import AdjustDialog from './adjust-dialog.vue'
|
||||
import progressDialog from './progress-dialog.vue'
|
||||
import { completion, tempResult, tempSave, removeChildTemp, editTempResult, modelList } from '@/api/mode/index.js'
|
||||
import { createChart, sendChart } from '@/api/ai/index'
|
||||
// import { dataSetJson } from '@/utils/comm.js'
|
||||
import PptDialog from "@/views/prepare/container/pptist-dialog.vue";
|
||||
import msgUtils from "@/plugins/modal";
|
||||
import {PPTXFileToJson} from "@/AixPPTist/src/hooks/useImport";
|
||||
import {slidesToImg} from "@/utils/ppt";
|
||||
import {getEntpcoursefile, listEntpcoursefileNew} from "@/api/education/entpcoursefile";
|
||||
import {sessionStore} from "@/utils/store";
|
||||
import * as API_smarttalk from "@/api/file";
|
||||
import * as API_entpcourse from "@/api/education/entpcourse";
|
||||
import * as API_entpcoursefile from "@/api/education/entpcoursefile";
|
||||
import * as commUtils from '@/utils/comm.js'
|
||||
import PptDialog from '@/views/prepare/container/pptist-dialog.vue'
|
||||
import keywordDialog from './keyword-dialog.vue'
|
||||
import TypingEffect from '@/components/typing-effect/index.vue'
|
||||
import { cloneDeep } from 'lodash'
|
||||
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { PPTXFileToJson } from '@/AixPPTist/src/hooks/useImport' // ppt转json
|
||||
import * as API_entpcourse from '@/api/education/entpcourse' // 相关api
|
||||
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api
|
||||
import * as Api_server from '@/api/apiService' // 相关api
|
||||
import * as API_smarttalk from '@/api/file' // 文件相关api
|
||||
import msgUtils from '@/plugins/modal'
|
||||
import { getEntpcoursefile } from '@/api/education/entpcoursefile'
|
||||
import { createWindow } from '@/utils/tool' // 消息工具
|
||||
import { slidesToImg } from '@/utils/ppt' // ppt相关工具
|
||||
|
||||
import {createWindow} from "@/utils/tool";
|
||||
import {editSyllabus} from "@/api/mode";
|
||||
import { getSmarttalkPage } from "@/api/file"
|
||||
import useUserStore from '@/store/modules/user'
|
||||
const userStore = useUserStore()
|
||||
const pptDialog = ref(false)
|
||||
const resultList = ref([])
|
||||
const result = ref(null)
|
||||
const courseObj = reactive({
|
||||
node: null, // 选择的课程节点
|
||||
})
|
||||
const curNode = reactive({})
|
||||
const pgDialog = reactive({ // 弹窗-进度条
|
||||
visible: false,
|
||||
title: 'PPT解析中...',
|
||||
|
@ -119,214 +61,28 @@ const pgDialog = reactive({ // 弹窗-进度条
|
|||
}
|
||||
})
|
||||
|
||||
const curMode = ref(2)
|
||||
const modeOptions = ref([
|
||||
{
|
||||
label: '教学大模型',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: '知识库模型',
|
||||
value: 2
|
||||
}
|
||||
])
|
||||
const pptSlides = ref([])
|
||||
|
||||
emitter.on('changeMode', (item) => {
|
||||
resultList.value = item.child
|
||||
getTempResult(item.id)
|
||||
emitter.on('onResult', (data)=>{
|
||||
console.log(data)
|
||||
result.value = data
|
||||
if (!!result.value.parentId) {
|
||||
listEntpcoursefileNew({parentid: result.value.parentId}).then(res=>{
|
||||
pptSlides.value = res.rows
|
||||
})
|
||||
}else {
|
||||
pptSlides.value = []
|
||||
}
|
||||
})
|
||||
|
||||
const onCreate = () =>{
|
||||
let isAnswer = resultList.value.every(item => !item.answer)
|
||||
if(isAnswer){
|
||||
if(!result.value){
|
||||
ElMessage.warning('请先进行研读')
|
||||
return
|
||||
}
|
||||
pptDialog.value = true
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 一键研读
|
||||
const getCompletion = async () => {
|
||||
isStarted.value = new Array(resultList.length).fill(false)
|
||||
isStarted.value[0] = true
|
||||
|
||||
resultList.value.forEach(item => {
|
||||
if (item.answer) {
|
||||
item.answer = ''
|
||||
}
|
||||
})
|
||||
for (let item of resultList.value) {
|
||||
|
||||
try {
|
||||
item.loading = true
|
||||
item.aiShow = true
|
||||
|
||||
let str = cloneDeep(prompt.value)
|
||||
str = str.replace(/{模板名称}/g, item.name)
|
||||
params.prompt = str
|
||||
params.template = item.prompt
|
||||
|
||||
// 教学大模型
|
||||
let data = null
|
||||
if (curMode.value == 1) {
|
||||
const res = await sendChart({
|
||||
content: params.prompt,
|
||||
conversationId: conversation_id.value,
|
||||
stream: false
|
||||
})
|
||||
data = res.data
|
||||
}
|
||||
// 知识库模型
|
||||
else {
|
||||
const res = await completion(params)
|
||||
data = res.data
|
||||
}
|
||||
|
||||
item.answer = getResult(data.answer)
|
||||
onSaveTemp(item)
|
||||
} finally {
|
||||
item.loading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const handleCompleteText = async (answer, index) => {
|
||||
if (index < resultList.value.length - 1) {
|
||||
isStarted.value[index + 1] = true; // 开始显示下一个文本
|
||||
}
|
||||
if (isAgain.value) {
|
||||
try {
|
||||
await editTempResult({ id: resultList.value[index].resultId, content: answer })
|
||||
} finally {
|
||||
isAgain.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 保存模板
|
||||
const onSaveTemp = async (item) => {
|
||||
if (item.answer == '') return
|
||||
|
||||
const data = {
|
||||
mainModelId: item.parentId,
|
||||
modelId: item.id,
|
||||
examDocld: '',
|
||||
content: item.answer,
|
||||
ex1: curNode.id
|
||||
}
|
||||
const res = await tempSave(data)
|
||||
|
||||
if(!item.resultId){
|
||||
item.resultId = res.data
|
||||
}
|
||||
}
|
||||
|
||||
const isWordDialog = ref(false)
|
||||
const editKeyWord = (item, val) => {
|
||||
/**
|
||||
* isAdd: 子模板中的移除 为编辑false 头部删除 添加提示词为新增 true
|
||||
*/
|
||||
Object.assign(curItem, item)
|
||||
curItem.isAdd = val
|
||||
isWordDialog.value = true
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 移除模板
|
||||
const removeItem = async (item, isChild) => {
|
||||
/**
|
||||
* item: 当前操作的模板
|
||||
* isChild: 子模板中的移除为 true
|
||||
*/
|
||||
if (item.ex3 != '1') {
|
||||
ElMessageBox.confirm(
|
||||
'确认是否移除?',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
).then(() => {
|
||||
removeChildTemp(item.id).then(res => {
|
||||
ElMessage.success('操作成功')
|
||||
if (isChild) {
|
||||
// 获取子模板
|
||||
emitter.emit('onGetChild', item)
|
||||
}
|
||||
else {
|
||||
// 获取主模板
|
||||
// getTemplateList()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
else {
|
||||
// editKeyWord(item, !isChild)
|
||||
}
|
||||
}
|
||||
const listRef = ref()
|
||||
// 查询模板结果
|
||||
const isStarted = ref([]);
|
||||
const getTempResult = (id) => {
|
||||
tempResult({ mainModelId: id, pageNum: 1, pageSize: 10000, ex1: curNode.id }).then(res => {
|
||||
let rows = res.rows
|
||||
if (rows.length > 0) {
|
||||
isStarted.value = new Array(rows.length).fill(true)
|
||||
resultList.value.forEach(item => {
|
||||
rows.forEach(el => {
|
||||
if (item.id == el.modelId) {
|
||||
item.answer = getResult(el.content)
|
||||
item.resultId = el.id
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
const scrollToBottom = (height, index) => {
|
||||
|
||||
if (listRef.value) {
|
||||
let sum = 0
|
||||
let listDom = listRef.value.children
|
||||
|
||||
if (index == 0) {
|
||||
// 220 去掉头部
|
||||
let screenHeight = window.innerHeight - 220
|
||||
if (height > screenHeight) {
|
||||
listRef.value.scrollTop = (height - screenHeight + 50)
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (let i = 0; i < index; i++) {
|
||||
sum += listDom[i].clientHeight
|
||||
}
|
||||
listRef.value.scrollTop = sum + height
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 去掉字符串中的 ### **
|
||||
let getResult = (str) => {
|
||||
let newStr = str.replace(/#+|(\*\*)/g, '');
|
||||
return newStr
|
||||
}
|
||||
|
||||
const params = reactive(
|
||||
{
|
||||
prompt: '',
|
||||
dataset_id: '',
|
||||
template: ''
|
||||
}
|
||||
)
|
||||
const prompt = ref('')
|
||||
|
||||
|
||||
const addAiPPT = async (res) => {
|
||||
// res = { url: 'https://bjcdn.openstorage.cn/xinghuo-privatedata/%2Ftmp/apiTempFileba724e0344f74e1480535eedf3ebec661601807661085006275/%E9%87%91%E9%A9%AC%E5%A5%96%E5%B0%B4%E5%B0%AC%E4%BA%8B%E4%BB%B6%E5%88%86%E6%9E%90%E4%B8%8E%E5%BA%94%E5%AF%B9%E7%AD%96%E7%95%A5.pptx' }
|
||||
let node = courseObj.node
|
||||
|
@ -373,6 +129,10 @@ const addAiPPT = async (res) => {
|
|||
if (res_3 && res_3.code == 200) {
|
||||
msgUtils.msgSuccess('生成PPT课件成功')
|
||||
//TODO 打开生成的课件
|
||||
updateGen(parentid)
|
||||
listEntpcoursefileNew({parentid: parentid}).then(res=>{
|
||||
pptSlides.value = res.rows
|
||||
})
|
||||
const res = await getEntpcoursefile(parentid)
|
||||
if (res && res.code === 200) {
|
||||
openPublicScreen('edit', res.data, smarttalk.resData) // 打开公屏-窗口
|
||||
|
@ -384,9 +144,31 @@ const addAiPPT = async (res) => {
|
|||
}
|
||||
}
|
||||
}
|
||||
}).finally(()=>{
|
||||
pgDialog.visible = false
|
||||
})
|
||||
}
|
||||
|
||||
const openAiPPT = async () =>{
|
||||
let parentid = result.value.parentId
|
||||
const res = await getEntpcoursefile(parentid)
|
||||
if (res && res.code === 200) {
|
||||
const smarttalk = await getSmarttalkPage({fileId: parentid})
|
||||
if (smarttalk && smarttalk.rows.length>0) {
|
||||
openPublicScreen('edit', res.data, smarttalk.rows[0]) // 打开公屏-窗口
|
||||
}else {
|
||||
ElMessage.warning(res.msg||'没有查询到课件!')
|
||||
}
|
||||
} else {
|
||||
ElMessage.warning(res.msg||'文件获取异常!')
|
||||
}
|
||||
}
|
||||
|
||||
const updateGen = (parentid)=>{
|
||||
result.value.parentId = parentid
|
||||
editSyllabus(result.value)
|
||||
}
|
||||
|
||||
const openPublicScreen = (type, resource, currData)=> {
|
||||
sessionStore.set('curr.resource', resource) // 缓存当前资源信息
|
||||
if (type=='edit') sessionStore.set('curr.smarttalk', currData) // 缓存当前文件smarttalk
|
||||
|
@ -401,92 +183,50 @@ const openPublicScreen = (type, resource, currData)=> {
|
|||
}
|
||||
})
|
||||
}
|
||||
const isEdit = ref(false)
|
||||
// 当前操作的索引
|
||||
const curIndex = ref(-1)
|
||||
// 当前操作的item
|
||||
const curItem = reactive({})
|
||||
|
||||
// 重新生成
|
||||
const isAgain = ref(false)
|
||||
const againResult = async (index, item) => {
|
||||
isAgain.value = true
|
||||
isStarted.value[index] = false
|
||||
resultList.value[index].answer = ''
|
||||
if (index == 0) {
|
||||
listRef.value.scrollTop = 0
|
||||
|
||||
} else {
|
||||
scrollToBottom(50, index)
|
||||
// 图片|音频|视频 转换为在线地址
|
||||
const toRousrceUrl = async (o) => {
|
||||
if (!!o.src) { // 如果有src就转换
|
||||
const isBase64 = /^data:image\/(\w+);base64,/.test(o.src)
|
||||
const isBlobUrl = /^blob:/.test(o.src)
|
||||
console.log('isBase64', o, isBase64)
|
||||
if (isBase64) {
|
||||
const bolb = commUtils.base64ToBlob(o.src)
|
||||
const fileName = Date.now() + '.png'
|
||||
const file = commUtils.blobToFile(bolb, fileName)
|
||||
// o.src = fileName
|
||||
// console.log('file', file)
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
const res = await Api_server.Other.uploadFile(formData)
|
||||
if (res && res.code == 200) {
|
||||
const url = res?.url
|
||||
url && (o.src = url)
|
||||
}
|
||||
|
||||
try {
|
||||
await nextTick()
|
||||
resultList.value[index].loading = true
|
||||
item.aiShow = true
|
||||
|
||||
let str = cloneDeep(prompt.value)
|
||||
str = str.replace(/{模板名称}/g, item.name)
|
||||
params.prompt = str
|
||||
params.template = item.prompt
|
||||
|
||||
let data = null;
|
||||
// 教学大模型
|
||||
if (curMode.value == 1) {
|
||||
const res = await sendChart({
|
||||
content: params.prompt,
|
||||
conversationId: conversation_id.value,
|
||||
stream: false
|
||||
})
|
||||
data = res.data
|
||||
} else {
|
||||
// 知识库模型
|
||||
const res = await completion(params)
|
||||
data = res.data
|
||||
} else if (isBlobUrl) { // 视频和音频
|
||||
const res = await fetch(o.src)
|
||||
const blob = await res.blob()
|
||||
const fileName = o.type == 'video' ? Date.now() + '.mp4' : Date.now() + '.mp3'
|
||||
const file = commUtils.blobToFile(blob, fileName)
|
||||
// o.src = fileName
|
||||
// console.log('file', file)
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
const ress = await Api_server.Other.uploadFile(formData)
|
||||
if (ress && ress.code == 200) {
|
||||
const url = ress?.url
|
||||
url && (o.src = url)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (o?.background?.image) await toRousrceUrl(o.background.image)
|
||||
if (o?.elements) {
|
||||
for (let element of o.elements) {
|
||||
await toRousrceUrl(element);
|
||||
}
|
||||
|
||||
resultList.value[index].answer = getResult(data.answer)
|
||||
isStarted.value[index] = true
|
||||
} finally {
|
||||
resultList.value[index].loading = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 对话调整
|
||||
const isAdjust = ref(false)
|
||||
const onAdjust = (index, item) => {
|
||||
curIndex.value = index
|
||||
Object.assign(curItem, item)
|
||||
isAdjust.value = true
|
||||
}
|
||||
|
||||
// 替换分析结果
|
||||
emitter.on('onSaveAdjust', (item) => {
|
||||
resultList.value[curIndex.value].answer = item
|
||||
onEditSave(resultList.value[curIndex.value])
|
||||
})
|
||||
|
||||
|
||||
// 保存 重新研读后的结果
|
||||
const onEditSave = async (item) => {
|
||||
const { msg } = await editTempResult({ id: item.resultId, content: item.answer })
|
||||
ElMessage.success(msg)
|
||||
getChildTemplate()
|
||||
}
|
||||
|
||||
// 编辑
|
||||
const onEdit = (index, item) => {
|
||||
curIndex.value = index
|
||||
Object.assign(curItem, item)
|
||||
isEdit.value = true
|
||||
}
|
||||
emitter.on('changeResult', (item) => {
|
||||
resultList.value[curIndex.value].answer = item
|
||||
})
|
||||
|
||||
// ======== zdg start ============
|
||||
// 统一HTTP处理
|
||||
const HTTP_SERVER_API = (type, params = {}) => {
|
||||
switch (type) {
|
||||
case 'addSmarttalk': { // 获取课程
|
||||
|
@ -564,214 +304,43 @@ const getDefParams = (params) => {
|
|||
}
|
||||
return Object.assign(def, params)
|
||||
}
|
||||
// 图片|音频|视频 转换为在线地址
|
||||
const toRousrceUrl = async (o) => {
|
||||
if (!!o.src) { // 如果有src就转换
|
||||
const isBase64 = /^data:image\/(\w+);base64,/.test(o.src)
|
||||
const isBlobUrl = /^blob:/.test(o.src)
|
||||
console.log('isBase64', o, isBase64)
|
||||
if (isBase64) {
|
||||
const bolb = commUtils.base64ToBlob(o.src)
|
||||
const fileName = Date.now() + '.png'
|
||||
const file = commUtils.blobToFile(bolb, fileName)
|
||||
// o.src = fileName
|
||||
// console.log('file', file)
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
const res = await Api_server.Other.uploadFile(formData)
|
||||
if (res && res.code == 200) {
|
||||
const url = res?.url
|
||||
url && (o.src = url)
|
||||
}
|
||||
} else if (isBlobUrl) { // 视频和音频
|
||||
const res = await fetch(o.src)
|
||||
const blob = await res.blob()
|
||||
const fileName = o.type == 'video' ? Date.now() + '.mp4' : Date.now() + '.mp3'
|
||||
const file = commUtils.blobToFile(blob, fileName)
|
||||
// o.src = fileName
|
||||
// console.log('file', file)
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
const ress = await Api_server.Other.uploadFile(formData)
|
||||
if (ress && ress.code == 200) {
|
||||
const url = ress?.url
|
||||
url && (o.src = url)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (o?.background?.image) await toRousrceUrl(o.background.image)
|
||||
if (o?.elements) {
|
||||
for (let element of o.elements) {
|
||||
await toRousrceUrl(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
// ======== zdg end ============
|
||||
|
||||
// 创建对话
|
||||
const conversation_id = ref('')
|
||||
const getChartId = () => {
|
||||
createChart({ app_id: '712ff0df-ed6b-470f-bf87-8cfbaf757be5' }).then(res => {
|
||||
localStorage.setItem("conversation_id", res.data.conversation_id);
|
||||
conversation_id.value = res.data.conversation_id;
|
||||
})
|
||||
}
|
||||
|
||||
// 查询prompt 替换
|
||||
const getPrompt = async () => {
|
||||
const { rows } = await modelList({ model: 5 })
|
||||
let str = rows.find(item => item.name.indexOf('框架设计') != -1).prompt
|
||||
str = str.replace('{学段}', curNode.edustage)
|
||||
str = str.replace('{学科}', curNode.edusubject)
|
||||
let bookV = curNode.roottitle.split('-')[1] + '版本'
|
||||
str = str.replace('{教材版本}', bookV)
|
||||
str = str.replace('{课程名称}', `《${curNode.itemtitle}》`)
|
||||
prompt.value = str
|
||||
}
|
||||
|
||||
const curNode = reactive({})
|
||||
onMounted(()=>{
|
||||
let data = sessionStore.get('subject.curNode')
|
||||
Object.assign(curNode, data);
|
||||
courseObj.node = data
|
||||
// 框架设计 用课标的dataset_id
|
||||
let jsonKey = `课标-${data.edustage}-${data.edusubject}`
|
||||
params.dataset_id = commUtils.dataSetJson[jsonKey]
|
||||
|
||||
// 获取百度千帆会话ID
|
||||
conversation_id.value = localStorage.getItem('conversation_id')
|
||||
if (!conversation_id.value) {
|
||||
getChartId();
|
||||
}
|
||||
|
||||
// 获取prompt
|
||||
getPrompt()
|
||||
})
|
||||
|
||||
|
||||
// 解绑
|
||||
onUnmounted(()=>{
|
||||
emitter.off('changeMode')
|
||||
emitter.off('changeResult')
|
||||
emitter.off('changeAdjust')
|
||||
emitter.off('onSaveAdjust');
|
||||
emitter.off('onResult')
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.container-right{
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
|
||||
font-size: 15px;
|
||||
flex-direction: column;
|
||||
.right-header{
|
||||
height: 45px;
|
||||
background: #fff;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 20px;
|
||||
border-radius: 0 5px 0 0;
|
||||
.icon-jiahao{
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.right-con{
|
||||
flex: 1;
|
||||
background: #F6F6F6;
|
||||
padding: 15px;
|
||||
flex-direction: column;
|
||||
margin-top: 5px;
|
||||
background-color: #fff;
|
||||
border-radius: 5px;
|
||||
overflow-y: auto;
|
||||
|
||||
.con-item {
|
||||
width: 100%;
|
||||
flex-direction: column;
|
||||
padding-bottom: 20px;
|
||||
position: relative;
|
||||
padding-left: 15px;
|
||||
box-sizing: border-box;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
border-radius: 50%;
|
||||
background: #409eff;
|
||||
position: absolute;
|
||||
left: -8px;
|
||||
top: 5px;
|
||||
.right-con-item{
|
||||
display: flex;
|
||||
margin: 10px 0;
|
||||
justify-content: space-around;
|
||||
img{
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
width: 2px;
|
||||
height: 100%;
|
||||
background: #409eff;
|
||||
position: absolute;
|
||||
left: -1px;
|
||||
top: 5px;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
&::before {
|
||||
content: '';
|
||||
width: 0
|
||||
}
|
||||
}
|
||||
|
||||
.item-top {
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 5px;
|
||||
|
||||
.icon-shenglvehao {
|
||||
font-weight: bold
|
||||
}
|
||||
}
|
||||
|
||||
.item-bom {
|
||||
background: #fff;
|
||||
padding: 15px;
|
||||
border-radius: 5px;
|
||||
|
||||
.item-prompt {
|
||||
text-align: left;
|
||||
margin-bottom: 5px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.item-answer {
|
||||
padding: 10px;
|
||||
background: #F2F2F2;
|
||||
border-radius: 5px;
|
||||
|
||||
.answer-text {
|
||||
background: #fff;
|
||||
border-radius: 5px;
|
||||
margin-bottom: 10px;
|
||||
text-align: left;
|
||||
font-size: 13px;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.item-btn {
|
||||
justify-content: flex-end;
|
||||
|
||||
.iconfont {
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
.icon-ai1 {
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
.template-custom-popover {
|
||||
width: 110px !important;
|
||||
min-width: 110px !important;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
<template>
|
||||
<div class="container-right flex">
|
||||
<div class="right-header flex">
|
||||
<span>课件预览</span>
|
||||
<div>
|
||||
<el-button type="danger" @click="onCreate">一键生成</el-button>
|
||||
<el-button>编辑课件</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right-con">
|
||||
<el-empty v-if="!result" description="请先生成教学大纲,再生成教学课件" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, onUnmounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import emitter from '@/utils/mitt'
|
||||
|
||||
const result = ref('')
|
||||
emitter.on('onResult', (data)=>{
|
||||
result.value = data
|
||||
})
|
||||
|
||||
const onCreate = () =>{
|
||||
if(!result.value){
|
||||
ElMessage.warning('请先进行研读')
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
onUnmounted(()=>{
|
||||
emitter.off('onResult')
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.container-right{
|
||||
height: 100%;
|
||||
font-size: 15px;
|
||||
flex-direction: column;
|
||||
.right-header{
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
.icon-jiahao{
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
.right-con{
|
||||
flex: 1;
|
||||
margin-top: 5px;
|
||||
background-color: #fff;
|
||||
border-radius: 5px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
|
@ -1,54 +1,35 @@
|
|||
<template>
|
||||
<div class="page-design flex">
|
||||
<div class="page-left">
|
||||
|
||||
<left />
|
||||
</div>
|
||||
<div class="page-right">
|
||||
|
||||
<right />
|
||||
</div>
|
||||
<!-- <el-row :gutter="20">
|
||||
<div class="page-design">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="5">
|
||||
<Left />
|
||||
</el-col>
|
||||
<el-col :span="13">
|
||||
<el-col :span="15">
|
||||
<Center />
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-col :span="4">
|
||||
<Right />
|
||||
</el-col>
|
||||
</el-row> -->
|
||||
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import left from './container/left.vue';
|
||||
import right from './container/right.vue';
|
||||
// import Left from './container/left2.vue'
|
||||
// import Center from './container/center.vue'
|
||||
// import Right from './container/right2.vue'
|
||||
import Left from './container/left.vue'
|
||||
import Center from './container/center.vue'
|
||||
import Right from './container/right.vue'
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// .page-design {
|
||||
// height: 100%;
|
||||
// .el-row{
|
||||
// height: 100%;
|
||||
// .el-col{
|
||||
// height: 100%;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
.page-design {
|
||||
height: 100%;
|
||||
.page-left{
|
||||
width: 50%;
|
||||
|
||||
.el-row {
|
||||
height: 100%;
|
||||
|
||||
.el-col {
|
||||
height: 100%;
|
||||
}
|
||||
.page-right{
|
||||
width: 50%;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,14 @@
|
|||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { env } = require('process');
|
||||
|
||||
// 读取当前的package.json文件
|
||||
const packageJsonPath = path.join(__dirname, 'package.json');
|
||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
||||
console.log(env)
|
||||
let res = env.npm_lifecycle_event.replace("build", "").replace(":", "");
|
||||
res = res&&res!=='prod'?"-" + res:"";
|
||||
packageJson.name = "aix-win-ws" + res
|
||||
|
||||
// 将修改后的内容写回package.json文件
|
||||
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
Loading…
Reference in New Issue