Merge branch 'main' into zhuhao_dev
This commit is contained in:
commit
e985c2e7af
|
@ -6,11 +6,6 @@ directories:
|
|||
win:
|
||||
executableName: AIx
|
||||
icon: resources/logo2.ico
|
||||
extraFiles:
|
||||
- from: ./node_modules/im_electron_sdk/lib/
|
||||
to: ./resources
|
||||
filter:
|
||||
- '**/*'
|
||||
files:
|
||||
- '!**/.vscode/*'
|
||||
- '!src/*'
|
||||
|
@ -51,3 +46,9 @@ publish:
|
|||
url: https://prev.ysaix.com:7868/src/assets/smarttalk/
|
||||
electronDownload:
|
||||
mirror: https://npmmirror.com/mirrors/electron/
|
||||
# 额外依赖打包到输出目录
|
||||
extraFiles:
|
||||
- from: ./node_modules/im_electron_sdk/lib/
|
||||
to: ./resources
|
||||
filter:
|
||||
- '**/*'
|
||||
|
|
|
@ -13,11 +13,6 @@ asarUnpack:
|
|||
win:
|
||||
executableName: AIx
|
||||
icon: resources/logo2.ico
|
||||
extraFiles:
|
||||
- from: ./node_modules/im_electron_sdk/lib/
|
||||
to: ./resources
|
||||
filter:
|
||||
- '**/*'
|
||||
nsis:
|
||||
oneClick: false
|
||||
allowToChangeInstallationDirectory: true
|
||||
|
@ -50,3 +45,9 @@ publish:
|
|||
url: http://localhost:3000
|
||||
electronDownload:
|
||||
mirror: https://npmmirror.com/mirrors/electron/
|
||||
# 额外依赖打包到输出目录
|
||||
extraFiles:
|
||||
- from: ./node_modules/im_electron_sdk/lib/
|
||||
to: ./resources
|
||||
filter:
|
||||
- '**/*'
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
"pinia-plugin-persistedstate": "^3.2.1",
|
||||
"spark-md5": "^3.0.2",
|
||||
"vue-router": "^4.4.0",
|
||||
"xgplayer": "^3.0.19",
|
||||
"xlsx": "^0.18.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -155,7 +155,6 @@ async function createLinkWin(data) {
|
|||
// 初始化完成
|
||||
app.on('ready', () => {
|
||||
process.env.LANG = 'en_US.UTF-8'
|
||||
process.env['ELECTRON_DISABLE_SANDBOX'] = true;
|
||||
// 设置应用程序用户模型标识符
|
||||
electronApp.setAppUserModelId('com.electron')
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:"
|
||||
/> -->
|
||||
<meta http-equiv="Content-Security-Policy" content="connect-src *; default-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src * 'self' data: blob:" />
|
||||
<meta http-equiv="Content-Security-Policy" content="connect-src *; default-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *;img-src * 'self' data: blob:" />
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -13,9 +13,11 @@ export class ApiService {
|
|||
if (!!data) config[method=='get'?'params':'data'] = data
|
||||
if (!!option) Object.assign(config, option)
|
||||
// 特殊格式处理
|
||||
if (type == 'file') config.headers = { 'Content-Type': 'multipart/form-data' }
|
||||
else if (type == 'json') config.headers = { 'Content-Type': 'application/json' }
|
||||
else if (type == 'form') config.headers = { 'Content-Type': 'application/x-www-form-urlencoded' }
|
||||
let headers
|
||||
if (type == 'file') headers = { 'Content-Type': 'multipart/form-data' }
|
||||
else if (type == 'json') headers = { 'Content-Type': 'application/json' }
|
||||
else if (type == 'form') headers = { 'Content-Type': 'application/x-www-form-urlencoded' }
|
||||
headers && (config.headers = { ...config.headers, ...headers })
|
||||
return request(config)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -160,10 +160,12 @@ export function deleteSmartReserv(id) {
|
|||
})
|
||||
}
|
||||
export function startClass(id, ex3) {
|
||||
const params = {id}
|
||||
!!ex3 && (params.ex3 = ex3)
|
||||
return request({
|
||||
url: '/smarttalk/classReserv/startClass',
|
||||
method: 'get',
|
||||
params: {id, ex3}
|
||||
params
|
||||
})
|
||||
}
|
||||
export function endClass(id) {
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
//查询第三方课件的接口
|
||||
import request from '@/utils/request'
|
||||
//获取学科
|
||||
export const getSubjects = (params) => {
|
||||
return request({
|
||||
url: '/smarttalk/cnjy/getSubjects',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
//获取教材版本
|
||||
export const getTextbookVersion = (params) => {
|
||||
return request({
|
||||
url: '/smarttalk/cnjy/getVersions',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
//获得书籍
|
||||
export const getTextbook = (params) => {
|
||||
return request({
|
||||
url: '/smarttalk/cnjy/getBooks',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
//获取书籍章节
|
||||
export const getBook = (params) => {
|
||||
return request({
|
||||
url: '/smarttalk/cnjy/getChapters',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
//获取知识点信息
|
||||
export const getKnowledge = (params) => {
|
||||
return request({
|
||||
url: '/smarttalk/cnjy/getKnowledgePoints',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
//查询列表资源
|
||||
export const getBookList = (params) => {
|
||||
return request({
|
||||
url: '/smarttalk/cnjy/getDocuments',
|
||||
method: 'post',
|
||||
params
|
||||
})
|
||||
}
|
||||
//获取图片路径
|
||||
export const getImgPath = (params) => {
|
||||
return request({
|
||||
url: '/smarttalk/cnjy/getPreview',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
@font-face {
|
||||
font-family: "iconfont"; /* Project id 2794390 */
|
||||
src: url('iconfont.woff2?t=1723453634574') format('woff2'),
|
||||
url('iconfont.woff?t=1723453634574') format('woff'),
|
||||
url('iconfont.ttf?t=1723453634574') format('truetype'),
|
||||
url('iconfont.svg?t=1723453634574#iconfont') format('svg');
|
||||
src: url('iconfont.woff2?t=1724212790213') format('woff2'),
|
||||
url('iconfont.woff?t=1724212790213') format('woff'),
|
||||
url('iconfont.ttf?t=1724212790213') format('truetype'),
|
||||
url('iconfont.svg?t=1724212790213#iconfont') format('svg');
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
|
@ -14,6 +14,90 @@
|
|||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.icon-yiwen:before {
|
||||
content: "\e687";
|
||||
}
|
||||
|
||||
.icon-yiwen-01:before {
|
||||
content: "\e688";
|
||||
}
|
||||
|
||||
.icon-yihuo:before {
|
||||
content: "\e689";
|
||||
}
|
||||
|
||||
.icon-a-yiwen:before {
|
||||
content: "\e6b1";
|
||||
}
|
||||
|
||||
.icon-zan:before {
|
||||
content: "\e658";
|
||||
}
|
||||
|
||||
.icon-zan1:before {
|
||||
content: "\e659";
|
||||
}
|
||||
|
||||
.icon-zan2:before {
|
||||
content: "\e65a";
|
||||
}
|
||||
|
||||
.icon-zan3:before {
|
||||
content: "\e65c";
|
||||
}
|
||||
|
||||
.icon-zan4:before {
|
||||
content: "\e67c";
|
||||
}
|
||||
|
||||
.icon-yizan:before {
|
||||
content: "\e67e";
|
||||
}
|
||||
|
||||
.icon-zan5:before {
|
||||
content: "\e67f";
|
||||
}
|
||||
|
||||
.icon-zan-yizan:before {
|
||||
content: "\e680";
|
||||
}
|
||||
|
||||
.icon-zan6:before {
|
||||
content: "\e681";
|
||||
}
|
||||
|
||||
.icon-MBEfenggeduosetubiao-xihuan:before {
|
||||
content: "\e682";
|
||||
}
|
||||
|
||||
.icon-zan7:before {
|
||||
content: "\e683";
|
||||
}
|
||||
|
||||
.icon-zan11:before {
|
||||
content: "\e6ff";
|
||||
}
|
||||
|
||||
.icon-zan8:before {
|
||||
content: "\e684";
|
||||
}
|
||||
|
||||
.icon-dianzan-red:before {
|
||||
content: "\e685";
|
||||
}
|
||||
|
||||
.icon-zan9:before {
|
||||
content: "\e69e";
|
||||
}
|
||||
|
||||
.icon-zanping:before {
|
||||
content: "\100ae";
|
||||
}
|
||||
|
||||
.icon-zan10:before {
|
||||
content: "\e686";
|
||||
}
|
||||
|
||||
.icon-arrangement:before {
|
||||
content: "\e656";
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -5,6 +5,153 @@
|
|||
"css_prefix_text": "icon-",
|
||||
"description": "",
|
||||
"glyphs": [
|
||||
{
|
||||
"icon_id": "20574719",
|
||||
"name": "疑问",
|
||||
"font_class": "yiwen",
|
||||
"unicode": "e687",
|
||||
"unicode_decimal": 59015
|
||||
},
|
||||
{
|
||||
"icon_id": "21052326",
|
||||
"name": "yiwen-01",
|
||||
"font_class": "yiwen-01",
|
||||
"unicode": "e688",
|
||||
"unicode_decimal": 59016
|
||||
},
|
||||
{
|
||||
"icon_id": "30456317",
|
||||
"name": "疑惑",
|
||||
"font_class": "yihuo",
|
||||
"unicode": "e689",
|
||||
"unicode_decimal": 59017
|
||||
},
|
||||
{
|
||||
"icon_id": "33439935",
|
||||
"name": "[疑问]",
|
||||
"font_class": "a-yiwen",
|
||||
"unicode": "e6b1",
|
||||
"unicode_decimal": 59057
|
||||
},
|
||||
{
|
||||
"icon_id": "1242129",
|
||||
"name": "赞",
|
||||
"font_class": "zan",
|
||||
"unicode": "e658",
|
||||
"unicode_decimal": 58968
|
||||
},
|
||||
{
|
||||
"icon_id": "1741390",
|
||||
"name": "赞",
|
||||
"font_class": "zan1",
|
||||
"unicode": "e659",
|
||||
"unicode_decimal": 58969
|
||||
},
|
||||
{
|
||||
"icon_id": "3159200",
|
||||
"name": "赞",
|
||||
"font_class": "zan2",
|
||||
"unicode": "e65a",
|
||||
"unicode_decimal": 58970
|
||||
},
|
||||
{
|
||||
"icon_id": "3402139",
|
||||
"name": "赞",
|
||||
"font_class": "zan3",
|
||||
"unicode": "e65c",
|
||||
"unicode_decimal": 58972
|
||||
},
|
||||
{
|
||||
"icon_id": "4931286",
|
||||
"name": "赞 (1)",
|
||||
"font_class": "zan4",
|
||||
"unicode": "e67c",
|
||||
"unicode_decimal": 59004
|
||||
},
|
||||
{
|
||||
"icon_id": "4942300",
|
||||
"name": "已赞",
|
||||
"font_class": "yizan",
|
||||
"unicode": "e67e",
|
||||
"unicode_decimal": 59006
|
||||
},
|
||||
{
|
||||
"icon_id": "5806181",
|
||||
"name": "赞",
|
||||
"font_class": "zan5",
|
||||
"unicode": "e67f",
|
||||
"unicode_decimal": 59007
|
||||
},
|
||||
{
|
||||
"icon_id": "7172310",
|
||||
"name": "赞-已赞",
|
||||
"font_class": "zan-yizan",
|
||||
"unicode": "e680",
|
||||
"unicode_decimal": 59008
|
||||
},
|
||||
{
|
||||
"icon_id": "7293361",
|
||||
"name": "赞2",
|
||||
"font_class": "zan6",
|
||||
"unicode": "e681",
|
||||
"unicode_decimal": 59009
|
||||
},
|
||||
{
|
||||
"icon_id": "8705087",
|
||||
"name": "MBE风格多色图标-喜欢",
|
||||
"font_class": "MBEfenggeduosetubiao-xihuan",
|
||||
"unicode": "e682",
|
||||
"unicode_decimal": 59010
|
||||
},
|
||||
{
|
||||
"icon_id": "10024138",
|
||||
"name": "赞",
|
||||
"font_class": "zan7",
|
||||
"unicode": "e683",
|
||||
"unicode_decimal": 59011
|
||||
},
|
||||
{
|
||||
"icon_id": "11055391",
|
||||
"name": "赞",
|
||||
"font_class": "zan11",
|
||||
"unicode": "e6ff",
|
||||
"unicode_decimal": 59135
|
||||
},
|
||||
{
|
||||
"icon_id": "11086734",
|
||||
"name": "赞",
|
||||
"font_class": "zan8",
|
||||
"unicode": "e684",
|
||||
"unicode_decimal": 59012
|
||||
},
|
||||
{
|
||||
"icon_id": "23592614",
|
||||
"name": "点赞",
|
||||
"font_class": "dianzan-red",
|
||||
"unicode": "e685",
|
||||
"unicode_decimal": 59013
|
||||
},
|
||||
{
|
||||
"icon_id": "26327261",
|
||||
"name": "赞",
|
||||
"font_class": "zan9",
|
||||
"unicode": "e69e",
|
||||
"unicode_decimal": 59038
|
||||
},
|
||||
{
|
||||
"icon_id": "27804883",
|
||||
"name": "赞评",
|
||||
"font_class": "zanping",
|
||||
"unicode": "100ae",
|
||||
"unicode_decimal": 65710
|
||||
},
|
||||
{
|
||||
"icon_id": "29252894",
|
||||
"name": "赞",
|
||||
"font_class": "zan10",
|
||||
"unicode": "e686",
|
||||
"unicode_decimal": 59014
|
||||
},
|
||||
{
|
||||
"icon_id": "4978988",
|
||||
"name": "作业-布置作业",
|
||||
|
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 264 KiB After Width: | Height: | Size: 337 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -75,8 +75,7 @@ const curBookImg = ref('')
|
|||
const curBookPath = ref('')
|
||||
// 上册
|
||||
const volumeOne = ref([])
|
||||
// 下册
|
||||
const volumeTwo = ref([])
|
||||
|
||||
// 当前节点
|
||||
const currentNode = reactive({
|
||||
data:{}
|
||||
|
@ -111,9 +110,11 @@ const getSubjectContent = async () => {
|
|||
//获取教材版本
|
||||
await getSubject()
|
||||
//上册
|
||||
volumeOne.value = data.filter(item => item.level == 1 && item.semester == '上册')
|
||||
//下册
|
||||
volumeTwo.value = data.filter(item => item.level == 1 && item.semester == '下册')
|
||||
/**
|
||||
* 不区分上下册
|
||||
* 2024/08/20调整
|
||||
*/
|
||||
volumeOne.value = data.filter(item => item.level == 1)
|
||||
getTreeData()
|
||||
}
|
||||
|
||||
|
@ -132,12 +133,8 @@ const changeBook = ({ id, itemtitle, avartar, fileurl }) => {
|
|||
const getTreeData = () => {
|
||||
//数据过滤
|
||||
let upData = transData(volumeOne.value)
|
||||
let downData = transData(volumeTwo.value)
|
||||
if(upData.length && downData.length){
|
||||
treeData.value = [...upData,...downData]
|
||||
}
|
||||
else if(upData.length || downData.length){
|
||||
treeData.value = upData.length ? upData : downData
|
||||
if(upData.length){
|
||||
treeData.value = [...upData]
|
||||
}
|
||||
else{
|
||||
treeData.value = []
|
||||
|
|
|
@ -0,0 +1,287 @@
|
|||
<template>
|
||||
<div class="book-wrap">
|
||||
<el-scrollbar height="100%">
|
||||
<div class="book-name">
|
||||
<el-dropdown style="width: 100%;height: 100%">
|
||||
<div class="el-dropdown-link flex" style="width: 100%;height: 100%;justify-content: space-between;align-items: center">
|
||||
<span>{{titleName}}</span>
|
||||
<!-- <i class="iconfont icon-xiangyou"></i>-->
|
||||
</div>
|
||||
<!-- 学科学段选择-->
|
||||
<template #dropdown>
|
||||
<div style="width: 300px;padding: 20px">
|
||||
<ThirdIndex @getVertion="getVertion"></ThirdIndex>
|
||||
</div>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
<div class="book-list" v-loading="treeLoading">
|
||||
<el-tree ref="refTree" :data="treeData" :props="defaultProps" node-key="id"
|
||||
:default-expanded-keys="defaultExpandedKeys" :current-node-key="node.currentNodeId" highlight-current
|
||||
@node-click="handleNodeClick">
|
||||
</el-tree>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import ThirdIndex from './third/index.vue'
|
||||
import {nextTick, reactive, ref,onMounted,watch} from 'vue'
|
||||
import {getBook, getTextbook} from '@/api/file/third'
|
||||
import useThirdStore from '@/store/modules/thirdTextbook'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
||||
const useThird = useThirdStore()
|
||||
const useStore = useUserStore()
|
||||
const emit = defineEmits(['nodeClick'])
|
||||
const titleName = ref('')
|
||||
//树结构的数据
|
||||
const treeData = ref([])
|
||||
// 默认展开的节点
|
||||
const defaultExpandedKeys = ref([])
|
||||
const treeLoading = ref(false)
|
||||
const node = reactive({
|
||||
// 当前节点
|
||||
currentNode:{
|
||||
data:{}
|
||||
},
|
||||
// 当前选中的节点ID
|
||||
currentNodeId:0,
|
||||
// 当前选中的节点名称
|
||||
currentNodeName:''
|
||||
})
|
||||
//获取bookid
|
||||
const bookId = ref(0)
|
||||
//获取第一步所有章节
|
||||
const getVertion = (data) => {
|
||||
const arr = [...data]
|
||||
treeData.value = arr.map(item => {
|
||||
return {
|
||||
level:0,
|
||||
id: item.versionId,
|
||||
name: item.versionName,
|
||||
childs: []
|
||||
}
|
||||
})
|
||||
nextTick(() => {
|
||||
defaultExpandedKeys.value = [treeData.value[0].id]
|
||||
node.currentNode.data = treeData.value[0]
|
||||
node.currentNodeId = treeData.value[0].id
|
||||
node.currentNodeName = treeData.value[0].name
|
||||
treeLoading.value = false
|
||||
})
|
||||
}
|
||||
//初始化树形结构
|
||||
const getCurrent = (data) => {
|
||||
if(!data || data.length == 0) return
|
||||
nextTick(() => {
|
||||
defaultExpandedKeys.value = [data[0].id]
|
||||
node.currentNode.data = data[0]
|
||||
node.currentNodeId = data[0].id
|
||||
node.currentNodeName = data[0].name
|
||||
})
|
||||
}
|
||||
//获取教材
|
||||
const textbook = async (item) => {
|
||||
treeLoading.value = true
|
||||
const res = await getTextbook({versionId:item.id})
|
||||
if(res.code === 200){
|
||||
item.childs = res.data.map(items => {
|
||||
return {
|
||||
level:1,
|
||||
id: items.bookId,
|
||||
name: items.bookName,
|
||||
childs: []
|
||||
}
|
||||
})
|
||||
getCurrent(item.childs)
|
||||
treeLoading.value = false
|
||||
}
|
||||
}
|
||||
//获取年级
|
||||
const grade = async (item) => {
|
||||
treeLoading.value = true
|
||||
bookId.value = item.id
|
||||
const res = await getBook({bookId:item.id})
|
||||
if(res.code === 200){
|
||||
item.childs = res.data.map(items => {
|
||||
return {
|
||||
...items,
|
||||
}
|
||||
})
|
||||
getLastLevelData(item.childs)
|
||||
getCurrent(item.childs)
|
||||
treeLoading.value = false
|
||||
}
|
||||
}
|
||||
const getLastLevelData = (tree) => {
|
||||
let lastLevelData = [];
|
||||
// 递归函数遍历树形结构
|
||||
function traverseTree(nodes) {
|
||||
nodes.forEach((node) => {
|
||||
// 如果当前节点有子节点,继续遍历
|
||||
if (node.childs && node.childs.length > 0) {
|
||||
traverseTree(node.childs);
|
||||
} else {
|
||||
// 如果没有子节点,说明是最后一层的节点
|
||||
lastLevelData.push(node);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 调用递归函数开始遍历
|
||||
traverseTree(tree);
|
||||
|
||||
// 返回最后一层的数据
|
||||
return lastLevelData;
|
||||
}
|
||||
|
||||
//点击节点
|
||||
const handleNodeClick = (data,node) => {
|
||||
/**
|
||||
* data : 当前节点数据
|
||||
* node : 当前节点对象 包含当前节点所有数据 parent属性 指向父节点Node对象
|
||||
*/
|
||||
switch(node.data.level){
|
||||
case 0: textbook(data); break;
|
||||
case 1: grade(data); break;
|
||||
default: {
|
||||
getCurrent(data.childs);
|
||||
//获取资源列表
|
||||
emit('nodeClick',{
|
||||
chapterId:data.id,
|
||||
bookId:bookId.value,
|
||||
stage:data.stage,
|
||||
subjectId:data.subjectId,
|
||||
})
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//缓存
|
||||
onMounted(() => {
|
||||
titleName.value = `${useStore.user.edustage}-${useStore.user.edusubject}`
|
||||
treeLoading.value = true
|
||||
})
|
||||
//监听数据变化
|
||||
watch(() => useThird,() => {
|
||||
titleName.value = `${useStore.user.edustage}-${useStore.user.edusubject}`
|
||||
},{deep:true})
|
||||
|
||||
const defaultProps = {
|
||||
children: 'childs',
|
||||
label: 'name',
|
||||
class: 'textbook-tree'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.book-wrap {
|
||||
width: 300px;
|
||||
height: 100%;
|
||||
background: #ffffff;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 0px 20px 0px rgba(99, 99, 99, 0.06);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
|
||||
.book-name {
|
||||
background-color: #ffffff;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 45px;
|
||||
padding: 0 15px;
|
||||
z-index: 1;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
color: #3b3b3b;
|
||||
cursor: pointer;
|
||||
border-bottom: solid #f4f5f7 1px;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
border-radius: 10px 10px 0 0;
|
||||
}
|
||||
|
||||
.book-list {
|
||||
padding: 45px 10px 0 10px;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.choose-dialog) {
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.choose-book-header {
|
||||
justify-content: space-between;
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
|
||||
.icon-guanbi {
|
||||
font-size: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.textbook-container {
|
||||
.textbook-item {
|
||||
padding: 10px 20px;
|
||||
align-items: center;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
|
||||
.book-name {
|
||||
margin-left: 20px;
|
||||
color: #3b3b3b;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: #f4f7f9;
|
||||
}
|
||||
}
|
||||
|
||||
.active-item {
|
||||
background-color: #f4f7f9;
|
||||
|
||||
.book-name {
|
||||
color: #368fff;
|
||||
font-weight: bold
|
||||
}
|
||||
}
|
||||
|
||||
.textbook-img {
|
||||
width: 55px;
|
||||
height: 70px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-tree-node) {
|
||||
.el-tree-node__content {
|
||||
height: 40px;
|
||||
border-radius: 10px;
|
||||
|
||||
&:hover {
|
||||
background-color: #eaf3ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tree-label {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
:deep(.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content) {
|
||||
background-color: #eaf3ff !important;
|
||||
color: #409EFF
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,70 @@
|
|||
<template>
|
||||
<el-tabs v-model="active" class="demo-tabs" @tab-change="handleClick">
|
||||
<template v-for="(item,index) in gradeList" :key="index">
|
||||
<el-tab-pane :label="item.label" :name="item.value">
|
||||
<SelectSubject ref="selectSubject" :subjectList="subjectList" @clickTag="getTagId"></SelectSubject>
|
||||
</el-tab-pane>
|
||||
</template>
|
||||
</el-tabs>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {ref,onMounted} from 'vue'
|
||||
import { gradeList } from '@/utils/resourceDict'
|
||||
import SelectSubject from './selectSubject.vue'
|
||||
import {getSubjects,getTextbookVersion} from '@/api/file/third'
|
||||
import useThirdStore from '@/store/modules/thirdTextbook'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
const useThird = useThirdStore()
|
||||
const useStore = useUserStore()
|
||||
|
||||
const emit = defineEmits(['getVertion'])
|
||||
const active = ref(1)
|
||||
//用来获取所有学科
|
||||
const subjectList = ref([])
|
||||
//用来获取学科的id
|
||||
const textbookVersionId = ref(0)
|
||||
const handleClick = (tab) => {
|
||||
getSubject(tab)
|
||||
}
|
||||
//获取当前学段所有学科
|
||||
const getSubject = (value) => {
|
||||
const currentIndex = gradeList.findIndex(item => item.value === value)
|
||||
getSubjects({stage:value}).then(res => {
|
||||
if(res.code === 200){
|
||||
subjectList.value = res.data.map(item => {
|
||||
return {
|
||||
...item,
|
||||
gradeName:gradeList[currentIndex].label
|
||||
}
|
||||
})
|
||||
const nameIndex = subjectList.value.findIndex(item => item.subjectName === useStore.user.edusubject)
|
||||
getTagId({subjectId:subjectList.value[nameIndex].subjectId,subjectName:subjectList.value[nameIndex].subjectName})
|
||||
if(textbookVersionId.value === 0){
|
||||
getTagId(subjectList.value[0])
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取教材列表
|
||||
const getTagId = (item) => {
|
||||
textbookVersionId.value = item.subjectId
|
||||
const currentIndex = gradeList.findIndex(item => item.value === active.value)
|
||||
getTextbookVersion({stage:active.value,subjectId:textbookVersionId.value}).then(res => {
|
||||
if(res.code === 200){
|
||||
emit('getVertion',res.data)
|
||||
useThird.getSelectBookInfo({...item,activeGrade:active.value,gradeName:gradeList[currentIndex].label})
|
||||
}
|
||||
})
|
||||
}
|
||||
onMounted(() => {
|
||||
const currentIndex = gradeList.findIndex(item => item.label === useStore.user.edustage)
|
||||
//首次渲染获取
|
||||
getSubject(gradeList[currentIndex].value)
|
||||
active.value = gradeList[currentIndex].value
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,35 @@
|
|||
<template>
|
||||
<template v-for="item in subjectList" :key="item.subjectId">
|
||||
<el-tag
|
||||
:type="useStore.user.edusubject === item.subjectName && useStore.user.edustage === item.gradeName ? 'primary' : 'info'"
|
||||
effect="dark"
|
||||
round
|
||||
class="tagItem"
|
||||
:style="useStore.user.edusubject === item.subjectName && useStore.user.edustage === item.gradeName ? {'cursor': 'pointer'} : {'cursor': 'no-Drop'}"
|
||||
>
|
||||
{{ item.subjectName }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<script setup name="selectSubject">
|
||||
import useUserStore from "@/store/modules/user";
|
||||
const useStore = useUserStore()
|
||||
const props = defineProps({
|
||||
subjectList: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['clickTag'])
|
||||
// const clickTag = (item) => {
|
||||
// emit('clickTag',item)
|
||||
// }
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.tagItem{
|
||||
margin-right: 5px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,124 @@
|
|||
<template>
|
||||
<el-drawer v-model="model" class="preview-drawer" title="title" :modal="false" :with-header="false" append-to-body
|
||||
size="50%">
|
||||
<div class="flex drawer-header">
|
||||
<div>
|
||||
<div class="flex file-name">
|
||||
<FileImage :size="30" :file-name="'row.fileName'" />
|
||||
<span class="name">{{ row.fileShowName }}</span>
|
||||
</div>
|
||||
<div class="flex file-tag">
|
||||
<el-tag type="info" class="tag">{{ row.fileSuffix }}</el-tag>
|
||||
<el-tag type="info" class="tag">{{ row.fileFlag }}</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="header-close" @click="onClose"><i class="iconfont icon-guanbi"></i></div>
|
||||
</div>
|
||||
<div class="drawer-content">
|
||||
<!-- <iframe src="./aaa.pdf" width="600px" height="600px"></iframe> -->
|
||||
<!-- <div ref="playerRef" class="video-box"></div> -->
|
||||
<!-- <video src="" controls autoplay></video> -->
|
||||
<el-image style="width: 100%;" src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg" />
|
||||
</div>
|
||||
</el-drawer>
|
||||
</template>
|
||||
<script setup>
|
||||
import { watch, ref, nextTick } from 'vue'
|
||||
import Player from 'xgplayer'
|
||||
import 'xgplayer/dist/index.min.css'
|
||||
import FileImage from '@/components/file-image/index.vue'
|
||||
|
||||
|
||||
const model = defineModel()
|
||||
const props = defineProps({
|
||||
row: {
|
||||
type: Object,
|
||||
default(){
|
||||
return {}
|
||||
}
|
||||
},
|
||||
})
|
||||
const playerRef = ref();
|
||||
const handleClose = () => {
|
||||
|
||||
}
|
||||
// 关闭
|
||||
const onClose = () => {
|
||||
model.value = false
|
||||
}
|
||||
|
||||
const init = () => {
|
||||
nextTick(() => {
|
||||
// 播放器 基础用法
|
||||
let player = new Player({
|
||||
el: playerRef.value,
|
||||
url: '//sf1-cdn-tos.huoshanstatic.com/obj/media-fe/xgplayer_doc_video/mp4/xgplayer-demo-360p.mp4',
|
||||
width: '100%',
|
||||
autoplay: false,// 是否自动播放(默认false)
|
||||
videoAttributes: {// video扩展属性
|
||||
crossOrigin: 'anonymous',// 元素获取数据的 CORS 请求的配置
|
||||
},
|
||||
cssFullscreen: false,
|
||||
loop:true,// 是否开启循环播放(默认false)
|
||||
commonStyle:{
|
||||
progressColor: '#cccccce6',//进度条底色
|
||||
},
|
||||
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
watch(model, (newVal) => {
|
||||
if (newVal) {
|
||||
// init()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-drawer__body) {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.preview-drawer {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.drawer-header {
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
|
||||
.file-name {
|
||||
align-items: center;
|
||||
margin-bottom: 5px;
|
||||
|
||||
.name {
|
||||
margin-left: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.file-tag {
|
||||
.tag {
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.header-close {
|
||||
cursor: pointer;
|
||||
|
||||
.icon-guanbi {
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.drawer-content {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.video-box {
|
||||
width: 100%;
|
||||
height: 300px
|
||||
}
|
||||
</style>
|
|
@ -88,8 +88,6 @@ const curBookId = ref(-1)
|
|||
const curBookName = ref('')
|
||||
// 上册
|
||||
const volumeOne = ref([])
|
||||
// 下册
|
||||
const volumeTwo = ref([])
|
||||
// 当前节点
|
||||
const currentNode = reactive({
|
||||
data: {}
|
||||
|
@ -127,9 +125,12 @@ const getSubjectContent = async () => {
|
|||
//获取教材版本
|
||||
getSubject()
|
||||
//上册
|
||||
volumeOne.value = data.filter(item => item.level == 1 && item.semester == '上册')
|
||||
//下册
|
||||
volumeTwo.value = data.filter(item => item.level == 1 && item.semester == '下册')
|
||||
/**
|
||||
* 不区分上下册
|
||||
* 2024/08/20调整
|
||||
*/
|
||||
volumeOne.value = data.filter(item => item.level == 1)
|
||||
|
||||
getTreeData()
|
||||
}
|
||||
|
||||
|
@ -160,13 +161,8 @@ const isHaveUnit = (id) => {
|
|||
const getTreeData = () => {
|
||||
//数据过滤
|
||||
let upData = transData(volumeOne.value)
|
||||
let downData = transData(volumeTwo.value)
|
||||
|
||||
if(upData.length && downData.length){
|
||||
treeData.value = [...upData,...downData]
|
||||
}
|
||||
else if(upData.length || downData.length){
|
||||
treeData.value = upData.length ? upData : downData
|
||||
if(upData.length){
|
||||
treeData.value = [...upData]
|
||||
}
|
||||
else{
|
||||
treeData.value = []
|
||||
|
|
|
@ -100,12 +100,17 @@ const renderPage = async (canvasobj) => {
|
|||
})
|
||||
}
|
||||
// 保存数据
|
||||
const savaDataStore = () => {
|
||||
const savaDataStore = (type) => {
|
||||
if(!toolState.isToolWin){
|
||||
toolState.isPdfWin=false
|
||||
toolState.showBoardAll=true //恢复默认值
|
||||
ipcRenderer.invoke('tool-sphere:reset') //重置tool状态
|
||||
ipcRenderer.send('open-PDF:minimize')
|
||||
if(type=='rest'){
|
||||
ipcRenderer.invoke('tool-sphere:reset') //重置tool状态
|
||||
ipcRenderer.send('open-PDF:close')
|
||||
}else{
|
||||
ipcRenderer.invoke('open-PDF:minimize')
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
imgarr.value.forEach((a) => {
|
||||
|
@ -139,8 +144,15 @@ const savaDataStore = () => {
|
|||
Promise.all(promises).then(res=>{
|
||||
toolState.isPdfWin=false
|
||||
toolState.showBoardAll=true //恢复默认值
|
||||
ipcRenderer.invoke('tool-sphere:reset') //重置tool状态
|
||||
ipcRenderer.send('open-PDF:minimize')
|
||||
// ipcRenderer.send('open-PDF:minimize')
|
||||
if(type=='rest'){
|
||||
ipcRenderer.invoke('tool-sphere:reset') //重置tool状态
|
||||
ipcRenderer.send('open-PDF:close')
|
||||
}else{
|
||||
ipcRenderer.send('open-PDF:minimize')
|
||||
}
|
||||
// ipcRenderer.send('open-PDF:close')
|
||||
|
||||
})
|
||||
}
|
||||
const updatePage = (canvasobj) => {
|
||||
|
|
|
@ -0,0 +1,323 @@
|
|||
<template>
|
||||
<el-dialog v-model="model" center top="10vh" width="600px" :show-close="false" destroy-on-close append-to-body
|
||||
style="border-radius: 10px; padding: 10px 15px">
|
||||
<template #header>
|
||||
<div class="homerwork-header flex">
|
||||
<span>{{ title }}</span>
|
||||
<i class="iconfont icon-guanbi" @click="cloneDialog(ruleFormRef)"></i>
|
||||
</div>
|
||||
</template>
|
||||
<div v-loading="setLoading">
|
||||
<el-form :model="form" label-width="80px" ref="ruleFormRef" :rules="rules">
|
||||
<el-form-item label="班级" prop="grade">
|
||||
<el-scrollbar max-height="200px" style="width: 100%">
|
||||
<el-tree :props="defaultProps" :load="getLoad" node-key="id" highlight-current @check="handleCheckChange"
|
||||
lazy show-checkbox />
|
||||
</el-scrollbar>
|
||||
</el-form-item>
|
||||
<el-form-item label="选中学生" prop="student">
|
||||
<el-scrollbar max-height="200px">
|
||||
<el-tag v-for="(tag, index) in studentList" :key="tag.studentid" closable type="primary"
|
||||
@close="delStudent(index)">
|
||||
{{ tag.name }}
|
||||
</el-tag>
|
||||
</el-scrollbar>
|
||||
</el-form-item>
|
||||
<el-form-item label="完成要求" prop="feedback">
|
||||
<el-radio-group v-model="form.feedback">
|
||||
<el-radio value="必做" size="large">必做</el-radio>
|
||||
<el-radio value="选做" size="large">选做</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="截止时间" prop="deaddate">
|
||||
<el-date-picker v-model="form.deaddate" value-format="YYYY-MM-DD HH:mm" format="YYYY-MM-DD HH:mm"
|
||||
time-format="HH:mm" type="datetime" :clearable="false" placeholder="请选择截止时间" />
|
||||
</el-form-item>
|
||||
<el-form-item label="推荐用时" prop="timelength">
|
||||
<el-input-number v-model="form.timelength" :min="1" :max="500" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click.stop="cloneDialog(ruleFormRef)">取消</el-button>
|
||||
<el-button type="primary" @click.stop="onSubmit(ruleFormRef)"> 确定 </el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { listClassmain, listClassgroup } from '@/api/classManage/index'
|
||||
import { saveByClassWorkArray } from '@/api/teaching/classwork'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { uniqBy, groupBy } from 'lodash'
|
||||
|
||||
const model = defineModel({ type: Boolean, default: false })
|
||||
const props = defineProps({
|
||||
entpcourseid: {
|
||||
default: ''
|
||||
},
|
||||
row: {
|
||||
default: ''
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: '布置作业'
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['on-close', 'on-success'])
|
||||
const ruleFormRef = ref('')
|
||||
// 配置项
|
||||
const defaultProps = {
|
||||
children: 'children',
|
||||
label: 'label',
|
||||
isLeaf: 'leaf'
|
||||
}
|
||||
|
||||
// loading
|
||||
const setLoading = ref(false)
|
||||
// 用户信息
|
||||
const userInfo = useUserStore().user
|
||||
// 班级列表
|
||||
const gradeList = ref([])
|
||||
// 选中的学生列表
|
||||
const studentList = ref([])
|
||||
// 表单
|
||||
const form = reactive({
|
||||
feedback: '必做',
|
||||
deaddate: '',
|
||||
timelength: 1
|
||||
})
|
||||
// 表单校验
|
||||
const validateGrade = (rule, value, callback) => {
|
||||
if (studentList.value.length == 0) {
|
||||
callback(new Error('请勾选班级或者学生'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
const validateStudent = (rule, value, callback) => {
|
||||
if (studentList.value.length == 0) {
|
||||
callback(new Error('学生不能为空'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
const rules = reactive({
|
||||
grade: [{ validator: validateGrade, trigger: 'blur' }],
|
||||
student: [{ validator: validateStudent, trigger: 'blur' }]
|
||||
})
|
||||
|
||||
// 获取班级
|
||||
const getGradeList = async () => {
|
||||
let { rows } = await listClassmain({
|
||||
classuserid: userInfo.userId,
|
||||
pageSize: 100,
|
||||
status: 'open'
|
||||
})
|
||||
rows.forEach((item) => {
|
||||
item.label = item.caption
|
||||
item.level = 0
|
||||
item.leaf = false
|
||||
item.children = []
|
||||
item.classstudentlist = JSON.parse('[' + item.classstudentlist + ']')
|
||||
item.classstudentlist.forEach((el) => {
|
||||
el.classId = item.id
|
||||
})
|
||||
})
|
||||
return rows
|
||||
}
|
||||
// 获取节点下一级
|
||||
const getLoad = async (node, resolve) => {
|
||||
// 获取一级节点 班级
|
||||
if (node.level == 0) {
|
||||
gradeList.value = await getGradeList()
|
||||
resolve(gradeList.value)
|
||||
}
|
||||
// 获取二级节点 小组
|
||||
if (node.level == 1) {
|
||||
listClassgroup({ classid: node.key, orderby: 'orderidx', pageSize: 100 }).then((res) => {
|
||||
if (res.rows.length > 0) {
|
||||
let ary = []
|
||||
res.rows.forEach((item) => {
|
||||
if (item.parentid === 0) {
|
||||
//studentGroup 小组学生 为三级节点
|
||||
let studentGroup = JSON.parse('[' + item.studentlist + ']')
|
||||
studentGroup.forEach((el) => {
|
||||
el.label = el.name
|
||||
el.leaf = true
|
||||
el.level = 2
|
||||
el.id = el.studentid
|
||||
el.classId = item.classid
|
||||
})
|
||||
ary.push({
|
||||
label: item.groupname,
|
||||
leaf: false,
|
||||
...item,
|
||||
level: 1,
|
||||
// children 小组学生 三级节点 这样就不用再从接口拿
|
||||
children: studentGroup
|
||||
})
|
||||
}
|
||||
})
|
||||
resolve(ary)
|
||||
} else {
|
||||
// 班级下面没有小组 直接取学生
|
||||
let students = node.data.classstudentlist
|
||||
students.forEach((item) => {
|
||||
item.label = item.name
|
||||
item.level = 2
|
||||
item.leaf = true
|
||||
})
|
||||
resolve(students)
|
||||
}
|
||||
})
|
||||
}
|
||||
// 三级节点 小组学生
|
||||
if (node.level == 2) {
|
||||
resolve(node.data.children)
|
||||
}
|
||||
}
|
||||
//节点勾选后触发 拿学生
|
||||
const handleCheckChange = (data, checked) => {
|
||||
studentList.value = []
|
||||
// 选中节点集合
|
||||
let checkNodes = checked.checkedNodes
|
||||
let ary = []
|
||||
checkNodes.forEach((item) => {
|
||||
// 一级节点 班级
|
||||
if (item.level == 0) {
|
||||
ary = [...ary, ...item.classstudentlist]
|
||||
}
|
||||
// 二级节点 班级下面的小组
|
||||
if (item.level == 1) {
|
||||
ary = [...ary, ...item.children]
|
||||
}
|
||||
// 三级节点 小组下面的学生
|
||||
if (item.level == 2) {
|
||||
ary = [...ary, item]
|
||||
}
|
||||
})
|
||||
studentList.value = uniqBy(ary, 'studentid')
|
||||
}
|
||||
// 删除学生
|
||||
const delStudent = (index) => {
|
||||
studentList.value.splice(index, 1)
|
||||
}
|
||||
|
||||
const onSubmit = (formEl) => {
|
||||
if (!formEl) return
|
||||
formEl.validate((valid) => {
|
||||
if (valid) {
|
||||
/**
|
||||
* 根据学生列表中的classId分班
|
||||
* studentList 为选中的所有学生 这些学生可能来自不同班级
|
||||
*/
|
||||
let gradeObj = groupBy(studentList.value, 'classId')
|
||||
// 处理要提交的参数
|
||||
let ary = []
|
||||
for (const value in gradeObj) {
|
||||
//这些参数 参照AIx web端 作业推送
|
||||
let obj = {
|
||||
id: 0,
|
||||
parentid: props.row.id,
|
||||
classid: value,
|
||||
classcourseid: 0,
|
||||
entpcourseid: props.entpcourseid,
|
||||
studentlist: JSON.stringify(gradeObj[value]),
|
||||
feedback: form.feedback,
|
||||
workkey: '',
|
||||
timelength: form.timelength,
|
||||
weights: 1,
|
||||
deaddate: form.deaddate,
|
||||
workdate: getCurrentDate(),
|
||||
uniquekey: props.row.uniquekey,
|
||||
entpcourseworklist: '[' + props.row.entpcourseworklist + ']',
|
||||
needMsgNotifine: 'false',
|
||||
msgkey: 'newclasswork',
|
||||
title: '作业任务',
|
||||
msgcontent: '',
|
||||
teachername: userInfo.nickName,
|
||||
unixstamp: new Date().getTime(),
|
||||
worktype: props.row.worktype
|
||||
}
|
||||
ary.push(obj)
|
||||
}
|
||||
setLoading.value = true
|
||||
saveByClassWorkArray({
|
||||
classworkarray: JSON.stringify(ary)
|
||||
})
|
||||
.then(() => {
|
||||
setLoading.value = false
|
||||
ElMessage.success('操作成功')
|
||||
emit('on-success')
|
||||
cloneDialog(formEl)
|
||||
})
|
||||
.catch(() => {
|
||||
setLoading.value = false
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const expandedKeys = ref([])
|
||||
const checkedKeys = ref([])
|
||||
// 关闭弹窗
|
||||
const cloneDialog = (formEl) => {
|
||||
studentList.value = []
|
||||
checkedKeys.value = []
|
||||
expandedKeys.value = []
|
||||
formEl.resetFields()
|
||||
model.value = false
|
||||
}
|
||||
// 获取当前年月日
|
||||
const getCurrentDate = () => {
|
||||
const now = new Date()
|
||||
const year = now.getFullYear()
|
||||
let month = now.getMonth() + 1 // 月份是从0开始的,所以需要+1
|
||||
let day = now.getDate()
|
||||
if (month < 10) {
|
||||
month = '0' + month
|
||||
}
|
||||
if (day < 10) {
|
||||
day = '0' + day
|
||||
}
|
||||
return `${year}-${month}-${day}`
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// 默认当前
|
||||
form.deaddate = getCurrentDate() + ' ' + '10:00:00'
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.homerwork-header {
|
||||
justify-content: space-between;
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
|
||||
.icon-guanbi {
|
||||
font-size: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.el-tag {
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.dialog-footer {
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
:deep(.el-checkbox) {
|
||||
transform: scale(1.3);
|
||||
}
|
||||
</style>
|
|
@ -381,14 +381,14 @@ const TIMResult= {
|
|||
*
|
||||
* | 名称 | 含义 | 值(number) |
|
||||
* | ---- | ---- | ---- |
|
||||
* | kTIMLog_Off | 关闭日志输出 | 0 |
|
||||
* | kTIMLog_Test | 失败,IM SDK未初始化 | 1 |
|
||||
* | kTIMLog_Verbose | 失败,IM SDK未初始化 | 2 |
|
||||
* | kTIMLog_Debug | 接口调用失败,错误的Json格式或Json Key | 3 |
|
||||
* | kTIMLog_Info | 接口调用失败,参数错误 | 4 |
|
||||
* | kTIMLog_Warn | 接口调用失败,无效的会话 | 5 |
|
||||
* | kTIMLog_Error | 接口调用失败,无效的群组 | 6 |
|
||||
* | kTIMLog_Assert | 断言日志| 7 |
|
||||
* | kTIMLog_Off | 关闭日志输出 | 0 |
|
||||
* | kTIMLog_Test | 全量日志 | 1 |
|
||||
* | kTIMLog_Verbose| 开发调试过程中一些详细信息日志 | 2 |
|
||||
* | kTIMLog_Debug | 调试日志 | 3 |
|
||||
* | kTIMLog_Info | 信息日志 | 4 |
|
||||
* | kTIMLog_Warn | 警告日志 | 5 |
|
||||
* | kTIMLog_Error | 错误日志 | 6 |
|
||||
* | kTIMLog_Assert | 断言日志 | 7 |
|
||||
*/
|
||||
const TIMLogLevel= {
|
||||
kTIMLog_Off : 0,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
// @ts-ignore
|
||||
const API = window?.api || {}
|
||||
const timRenderInstance = API.getTimRender()
|
||||
const timRenderInstance = API?.getTimRender?.() || {}
|
||||
|
||||
// im 事件监听
|
||||
export class IMListeners {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
import * as TYPES from './enumbers' // sdk相关枚举
|
||||
import MsgEnum from './msgEnum' // 消息相关枚举(自定义)
|
||||
import IMListeners from './imLiseners' // im消息-监听器
|
||||
// @ts-ignore
|
||||
const API = window.api
|
||||
// TIM生成签名
|
||||
// import * as GenerateUserSig from './userSig' // 引入签名生成器
|
||||
|
@ -25,29 +26,33 @@ export class ImChat {
|
|||
}
|
||||
defOption = { // 默认配置
|
||||
// 日志等级-全量日志
|
||||
log_level: TYPES.TIMLogLevel.kTIMLog_Test,
|
||||
log_level: TYPES.TIMLogLevel.kTIMLog_Off,
|
||||
// 群组类型-会议群(Meeting),成员上限 6000 人
|
||||
group_type: TYPES.TIMGroupType.kTIMGroup_ChatRoom,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 构造函数
|
||||
* @param {number} SDKAppID
|
||||
* @param {string} userSig
|
||||
* @param {string} userID
|
||||
* @param {boolean} isInit
|
||||
*/
|
||||
constructor(SDKAppID, userSig, userID, isInit) {
|
||||
this.SDKAppID = SDKAppID
|
||||
this.userSig = userSig
|
||||
// const sig = 'eJwtjN0KgjAYQN9l16Vzcz8I3RhE9J*JV94IW-ZV6nASWfTurfTynAPnjdLNyXvoFkWIeBhN-gxK1x2cYdCMTQnlYmxW3QpjQKEo4BhjGgrKh6KfBlrtPGOMuDTYDqqfE26BWUjEeIHSrW1cL-SulHd5KI7zxDbpdh1cX0nuX7JK7HtroNerZhnnPpYz9PkCe5Mx1w__'
|
||||
// this.userSig = sig
|
||||
this.userID = userID
|
||||
window.test = this
|
||||
// this.timGroupId = '@TGS#3CYWMK2ON' // 测试使用
|
||||
if (isInit) return this.init()
|
||||
// window.test = this
|
||||
if (isInit) this.init()
|
||||
}
|
||||
// 设置配置
|
||||
async setConfig() {
|
||||
await this.timChat.TIMSetConfig({ // TIMSetConfigParam
|
||||
json_config: { // JSONCongfig
|
||||
set_config_log_level: this.defOption.log_level,
|
||||
set_config_callback_log_level: this.defOption.log_level,
|
||||
// set_config_is_log_output_console: true,
|
||||
set_config_log_level: TYPES.TIMLogLevel.kTIMLog_Test,
|
||||
set_config_callback_log_level: TYPES.TIMLogLevel.kTIMLog_Error,
|
||||
set_config_is_log_output_console: true,
|
||||
// set_config_user_config: { // 用户配置
|
||||
// user_config_is_read_receipt: true, // true表示要收已读回执事件
|
||||
// user_config_is_sync_report: true, // true表示服务端要删掉已读状态
|
||||
|
@ -63,7 +68,6 @@ export class ImChat {
|
|||
// 日志监听
|
||||
this.timChat.TIMSetLogCallback({
|
||||
callback: data => {
|
||||
// console.log('[im-chat]:', data[1])
|
||||
this.setConsole('%cchat-log ', data[1])
|
||||
},
|
||||
user_data: ''
|
||||
|
@ -91,15 +95,18 @@ export class ImChat {
|
|||
}
|
||||
// 生成签名
|
||||
genTestUserSig() {
|
||||
const options = {
|
||||
SDKAppID: this.SDKAppID,
|
||||
secretKey: this.secretKey,
|
||||
userID: this.userID,
|
||||
}
|
||||
const { userSig } = GenerateUserSig.genTestUserSig(options)
|
||||
this.userSig = userSig
|
||||
// const options = {
|
||||
// SDKAppID: this.SDKAppID,
|
||||
// secretKey: this.secretKey,
|
||||
// userID: this.userID,
|
||||
// }
|
||||
// const { userSig } = GenerateUserSig.genTestUserSig(options)
|
||||
// this.userSig = userSig
|
||||
}
|
||||
// 监听
|
||||
/**
|
||||
* @description 监听消息
|
||||
* @param {Function} callback
|
||||
*/
|
||||
watch(callback) {
|
||||
// // 先移除监听
|
||||
// this.timChat.TIMRemoveRecvNewMsgCallback()
|
||||
|
@ -162,16 +169,20 @@ export class ImChat {
|
|||
logout() {
|
||||
if (!this.timChat) return
|
||||
return this.timChat.TIMLogout().then(res => {
|
||||
console.log('登出成功', res)
|
||||
this.setConsole('%cim-chat: logout', '登出成功')
|
||||
this.status.isLogin = false
|
||||
this.timChat.TIMUninit() // 反初始化
|
||||
return res
|
||||
}).catch(error => {
|
||||
console.log('登出失败', error)
|
||||
this.setConsole('%cim-chat: logout', '登出失败', error)
|
||||
return error
|
||||
})
|
||||
}
|
||||
// 创建群组 群名和初始成员 userID
|
||||
/**
|
||||
* @description 创建群组 群名和初始成员 userID
|
||||
* @param {any} name
|
||||
* @param {any[]} memberList
|
||||
*/
|
||||
createGroup(name, memberList=[]) {
|
||||
if (!this.timChat) return
|
||||
if (!!this.timGroupId) return console.log('群组已存在')
|
||||
|
@ -220,7 +231,10 @@ export class ImChat {
|
|||
data: '', // 用户自定义数据
|
||||
})
|
||||
}
|
||||
// 设置群消息接收
|
||||
/**
|
||||
* @description 设置群消息接收
|
||||
* @param {string} timGroupId
|
||||
*/
|
||||
setGroupMsgReceive(timGroupId) {
|
||||
if (!this.timGroupId) this.timGroupId = timGroupId || ''
|
||||
if (!this.timGroupId) return console.log('timGroupId为空')
|
||||
|
@ -240,7 +254,11 @@ export class ImChat {
|
|||
return error
|
||||
})
|
||||
}
|
||||
// 发送消息
|
||||
/**
|
||||
* @description 发送消息
|
||||
* @param {any} conv_id
|
||||
* @param {any} msg
|
||||
*/
|
||||
sendMsg(conv_id, msg) {
|
||||
if (!conv_id) return console.log('conv_id为空')
|
||||
if (typeof msg == 'object') msg = JSON.stringify(msg)
|
||||
|
@ -259,15 +277,33 @@ export class ImChat {
|
|||
user_data: '', // 用户自定义数据
|
||||
// callback: (data) => {}
|
||||
}
|
||||
console.log('发送消息', option)
|
||||
// console.log('发送消息', option)
|
||||
this.setConsole('%cim-chat: 发送消息', option)
|
||||
return this.timChat.TIMMsgSendMessageV2(option)
|
||||
}
|
||||
/**
|
||||
* @description 发送群消息
|
||||
* @param {any} msg
|
||||
* @param {*} head
|
||||
* @param {*} type
|
||||
*/
|
||||
sendMsgGroup(msg, head, type) {
|
||||
const msgObj = this.getMsgObj(head, msg, type)
|
||||
// console.log('发送群消息', msgObj)
|
||||
return this.sendMsg(this.timGroupId, msgObj)
|
||||
}
|
||||
// 发送关闭(下课)消息
|
||||
sendMsgClosed(){
|
||||
const msg = this.getMsgObj(MsgEnum.HEADS.MSG_closed, '下课', MsgEnum.TYPES.TEACHER)
|
||||
const msg = this.getMsgObj(MsgEnum.HEADS.MSG_closed, '下课')
|
||||
return this.sendMsg(this.timGroupId, msg)
|
||||
}
|
||||
// 获取消息对象
|
||||
/**
|
||||
* @description 获取消息对象
|
||||
* @param {string} msgHead
|
||||
* @param {string} msg
|
||||
* @param {string} type
|
||||
* @param {string|number} sender
|
||||
*/
|
||||
getMsgObj(msgHead, msg, type, sender, option={}) {
|
||||
if (!msgHead) throw new Error('msgHead is required')
|
||||
if (!msg) throw new Error('msg is required')
|
||||
|
@ -275,19 +311,27 @@ export class ImChat {
|
|||
return {
|
||||
msgKey: msgHead,
|
||||
msgcontent: msg,
|
||||
msgType: type ?? MsgEnum.TYPES.STUDENT, // 默认为学生
|
||||
msgType: type || MsgEnum.TYPES.TEACHER, // 默认为老师
|
||||
senduserid: sender ?? this.userID,
|
||||
...option
|
||||
}
|
||||
}
|
||||
// 设置控制台样式
|
||||
/**
|
||||
* @description 设置控制台样式
|
||||
* @param {string} hearStr
|
||||
* @param {string[]} args
|
||||
*/
|
||||
setConsole(hearStr,...args) {
|
||||
const css = 'color: #fff;background-color:#2ccb92;padding:3px 5px;border-radius:3px;'
|
||||
const time = new Date().toLocaleTimeString()
|
||||
if (!hearStr) hearStr = '%c' + time
|
||||
console.log(hearStr, css, ...args)
|
||||
}
|
||||
// 获取数据字符串
|
||||
/**
|
||||
* @description 获取数据字符串
|
||||
* @param {*} data
|
||||
* @returns
|
||||
*/
|
||||
toStr = (data) => {
|
||||
if (typeof data === 'string') data = {type: data}
|
||||
return JSON.stringify(data)
|
||||
|
|
|
@ -95,6 +95,7 @@ export class MsgEnum {
|
|||
// === 新定义-消息头 ===
|
||||
/** @desc: 点赞 */
|
||||
MSG_0001: 0x0001,
|
||||
/** @desc: 疑惑 */
|
||||
MSG_0002: 0x0002,
|
||||
MSG_0003: 0x0003,
|
||||
MSG_0004: 0x0004,
|
||||
|
@ -109,6 +110,7 @@ export class MsgEnum {
|
|||
MSG_0013: 0x000d,
|
||||
MSG_0014: 0x000e,
|
||||
MSG_0015: 0x000f,
|
||||
/** @desc: 作业推送 */
|
||||
MSG_0016: 0x0010,
|
||||
MSG_0017: 0x0011,
|
||||
MSG_0018: 0x0012,
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
import { defineStore } from 'pinia'
|
||||
|
||||
const useThirdStore = defineStore('third', {
|
||||
state: () => ({
|
||||
activeGrade:'',
|
||||
gradeName:'',
|
||||
subjectName:'',
|
||||
textbookVersionId:''
|
||||
}),
|
||||
actions: {
|
||||
// 登录
|
||||
getSelectBookInfo(params){
|
||||
this.activeGrade = params.activeGrade
|
||||
this.gradeName = params.gradeName
|
||||
this.subjectName = params.subjectName
|
||||
this.textbookVersionId = params.textbookVersionId
|
||||
}
|
||||
|
||||
},
|
||||
persist: true
|
||||
})
|
||||
|
||||
export default useThirdStore
|
|
@ -7,7 +7,6 @@ export const hasPermission = (value, def = true) => {
|
|||
if (!value) {
|
||||
return def
|
||||
}
|
||||
|
||||
const allCodeList = useUserStore().roles
|
||||
// 如果不是数组,直接判断pinia里的权限数组有没有相同的元素即可
|
||||
if (!Array.isArray(value)) {
|
||||
|
@ -15,4 +14,4 @@ export const hasPermission = (value, def = true) => {
|
|||
}
|
||||
// intersection是lodash提供的一个方法,用于返回一个所有给定数组都存在的元素组成的数组
|
||||
return array.intersection(value, allCodeList).length > 0
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,11 @@ export const tabs = [
|
|||
{
|
||||
label: '校本资源',
|
||||
value: '校本'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '第三方资源',
|
||||
value: '第三方'
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
|
@ -67,3 +71,45 @@ export const resourceType = [
|
|||
value: '教案'
|
||||
}
|
||||
]
|
||||
// 年级划分
|
||||
export const gradeList = [
|
||||
{
|
||||
label:'小学',
|
||||
value:1
|
||||
},
|
||||
{
|
||||
label:'初中',
|
||||
value:2
|
||||
},
|
||||
{
|
||||
label:'高中',
|
||||
value:3
|
||||
},
|
||||
]
|
||||
//课件类别
|
||||
export const coursewareTypeList = [
|
||||
{
|
||||
label:'全部',
|
||||
value:''
|
||||
},
|
||||
{
|
||||
label:'课件',
|
||||
value:3
|
||||
},
|
||||
{
|
||||
label:'教案',
|
||||
value:8
|
||||
},
|
||||
{
|
||||
label:'试卷',
|
||||
value:7
|
||||
},
|
||||
{
|
||||
label:'学案',
|
||||
value:4
|
||||
},
|
||||
{
|
||||
label:'素材',
|
||||
value:6
|
||||
},
|
||||
]
|
||||
|
|
|
@ -115,6 +115,16 @@ export const createWindow = async (type, data) => {
|
|||
return wins_tool
|
||||
}
|
||||
case 'open-PDF': { //课本展示-pdf
|
||||
if(winPdf){ //判断是否已经打开
|
||||
if (winPdf.isMinimized()){
|
||||
winPdf.restore();
|
||||
} else{
|
||||
winPdf.focus();
|
||||
toolState.isPdfWin=true
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
const option = data.option||{}
|
||||
const defOption = {
|
||||
frame: false, // 要创建无边框窗口
|
||||
|
@ -123,12 +133,6 @@ export const createWindow = async (type, data) => {
|
|||
}
|
||||
data.isConsole = true // 是否开启控制台
|
||||
data.option = {...defOption, ...option}
|
||||
if(winPdf){ //判断是否已经打开
|
||||
// if (winPdf.isMinimized()) winPdf.restore();
|
||||
winPdf.focus();
|
||||
// toolState.isPdfWin=true
|
||||
return
|
||||
}
|
||||
const win = await toolWindow(data)
|
||||
win.type = type // 唯一标识
|
||||
win.show()
|
||||
|
@ -190,7 +194,6 @@ export function toolWindow({url, isConsole, isWeb=true, option={}}) {
|
|||
// 内部监听器-是否打印
|
||||
if (!!isConsole) {
|
||||
win.webContents.on('console-message', (e,leve,m,lin,s) => {
|
||||
console.log(m)
|
||||
if(m.startsWith('%c')){ // 特殊打印
|
||||
const arr = m.match(/(%c[^ ]+)(?:\s+(.*;))(.*)/)
|
||||
console.log(arr[1],arr[2],arr[3])
|
||||
|
@ -240,12 +243,22 @@ const eventHandles = (type, win) => {
|
|||
break}
|
||||
case 'open-PDF': {
|
||||
// 最小化窗口 minimize()
|
||||
Remote.ipcMain.once('open-PDF:minimize', () => {
|
||||
Remote.ipcMain.handle('open-PDF:minimize', () => {
|
||||
// winPdf=null
|
||||
// win&&win.destroy()
|
||||
win&&win.minimize(); //缩小功能
|
||||
})
|
||||
// 关闭窗口
|
||||
Remote.ipcMain.once('open-PDF:close', () => {
|
||||
winPdf=null
|
||||
win&&win.destroy()
|
||||
// win&&win.minimize(); //缩小功能
|
||||
})
|
||||
publicMethods() // 加载公共方法
|
||||
const on = {
|
||||
onClosed: () => {
|
||||
Remote.ipcMain.removeHandler('open-PDF:minimize')
|
||||
}
|
||||
}
|
||||
publicMethods(on) // 加载公共方法
|
||||
break}
|
||||
default:
|
||||
break
|
||||
|
|
|
@ -26,7 +26,10 @@
|
|||
<i class="iconfont icon-xiayiye"></i>
|
||||
<span class="texts">下一页</span>
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="pdf-btn-right">
|
||||
<el-button @click="minimize" >最小化</el-button>
|
||||
<el-button @click="minimize('rest')" >关闭</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -72,9 +75,10 @@ const navtopage = (type) => {
|
|||
pdfCanvaslist.value.initPdf('rest')
|
||||
}
|
||||
// 关闭窗口
|
||||
const minimize = async () => {
|
||||
await pdfCanvaslist.value.savaDataStore()
|
||||
const minimize = async (type='minimize') => {
|
||||
await pdfCanvaslist.value.savaDataStore(type)
|
||||
}
|
||||
|
||||
const handleUpdate = (data) => {
|
||||
numPagesTotal.value = data
|
||||
if (numPagesTotal.value == 1) {
|
||||
|
@ -138,7 +142,8 @@ const getUniqueArrayByLastOccurrence=(array)=> {
|
|||
flex-wrap: wrap;
|
||||
.pdf-btn {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
// right: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
|
||||
border-radius: 5px 0 0 0;
|
||||
|
@ -163,5 +168,28 @@ const getUniqueArrayByLastOccurrence=(array)=> {
|
|||
}
|
||||
}
|
||||
}
|
||||
.pdf-btn-right{
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
|
||||
border-radius: 5px 0 0 0;
|
||||
button {
|
||||
margin-left: 0;
|
||||
border: none;
|
||||
font-size: 16px;
|
||||
// padding: 4px 7px;
|
||||
border-radius: 0;
|
||||
width: 80px;
|
||||
height: 70px;
|
||||
:deep(> span) {
|
||||
display: block !important;
|
||||
}
|
||||
.iconfont {
|
||||
font-size: 26px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,332 +0,0 @@
|
|||
<template>
|
||||
<el-dialog v-model="dialogVisible" center top="10vh" width="600px" :show-close="false" append-to-body
|
||||
style="border-radius: 10px; padding: 10px 15px;">
|
||||
<template #header>
|
||||
<div class="homerwork-header flex">
|
||||
<span>{{ title }}</span>
|
||||
<i class="iconfont icon-guanbi" @click="cloneDialog"></i>
|
||||
</div>
|
||||
</template>
|
||||
<div v-loading="setLoading">
|
||||
<el-form :model="form" label-width="80px" ref="ruleForm" :rules="rules">
|
||||
<el-form-item label="班级" prop="grade">
|
||||
<el-scrollbar max-height="200px" style="width: 100%;">
|
||||
<el-tree ref="treeRef" :data="gradeList" :props="defaultProps" :load="getLoad" node-key="id"
|
||||
@check="handleCheckChange" lazy show-checkbox />
|
||||
</el-scrollbar>
|
||||
</el-form-item>
|
||||
<el-form-item label="选中学生" prop="student">
|
||||
<el-scrollbar max-height="200px">
|
||||
<el-tag v-for="(tag, index) in studentList" :key="tag.studentid" closable type="primary"
|
||||
@close="delStudent(index)">
|
||||
{{ tag.name }}
|
||||
</el-tag>
|
||||
</el-scrollbar>
|
||||
</el-form-item>
|
||||
<el-form-item label="完成要求" prop="feedback">
|
||||
<el-radio-group v-model="form.feedback">
|
||||
<el-radio value="必做" size="large">必做</el-radio>
|
||||
<el-radio value="选做" size="large">选做</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="截止时间" prop="deaddate">
|
||||
<el-date-picker v-model="form.deaddate" value-format="YYYY-MM-DD HH:mm" format="YYYY-MM-DD HH:mm"
|
||||
time-format="HH:mm" type="datetime" :clearable="false" placeholder="请选择截止时间" />
|
||||
</el-form-item>
|
||||
<el-form-item label="推荐用时" prop="timelength">
|
||||
<el-input-number v-model="form.timelength" :min="1" :max="500" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click.stop="cloneDialog">取消</el-button>
|
||||
<el-button type="primary" @click.stop="onSubmit('ruleForm')">
|
||||
确定
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { listClassmain, listClassgroup } from '@/api/classManage/index'
|
||||
import { saveByClassWorkArray } from '@/api/teaching/classwork'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { uniqBy, groupBy } from 'lodash'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
entpcourseid: {
|
||||
default: ''
|
||||
},
|
||||
row: {
|
||||
default: ''
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: '布置作业'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
||||
return {
|
||||
dialogVisible: false,
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'label',
|
||||
isLeaf: 'leaf',
|
||||
},
|
||||
setLoading: false,
|
||||
// 用户信息
|
||||
userInfo: null,
|
||||
// 班级列表
|
||||
gradeList: [],
|
||||
curGradeId: '',
|
||||
// 小组列表
|
||||
groupList: [],
|
||||
// 选中的学生
|
||||
studentList: [],
|
||||
// 表单
|
||||
form: {
|
||||
feedback: '必做',
|
||||
deaddate: '',
|
||||
timelength: 1
|
||||
},
|
||||
// 表单规则
|
||||
rules: {
|
||||
grade: [
|
||||
{ validator: this.validateGrade, trigger: 'blur' }
|
||||
],
|
||||
student: [
|
||||
{ validator: this.validateStudent, trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
//截至时间默认值
|
||||
this.form.deaddate = this.getCurrentDate() + ' ' + '10:00:00'
|
||||
this.userInfo = useUserStore().user
|
||||
},
|
||||
methods: {
|
||||
// 获取班级列表
|
||||
getGradeList() {
|
||||
listClassmain({ classuserid: this.userInfo.userId, pageSize: 100, status: 'open' }).then(res => {
|
||||
let list = res.rows
|
||||
list.forEach(item => {
|
||||
item.label = item.caption
|
||||
item.level = 0
|
||||
item.children = []
|
||||
item.classstudentlist = JSON.parse("[" + item.classstudentlist + "]")
|
||||
item.classstudentlist.forEach(el => {
|
||||
el.classId = item.id
|
||||
})
|
||||
})
|
||||
this.gradeList = list
|
||||
})
|
||||
},
|
||||
// 获取节点下一级
|
||||
getLoad(node, resolve) {
|
||||
if (node.level == 0) return resolve([])
|
||||
// 获取二级节点 小组
|
||||
if (node.level == 1) {
|
||||
listClassgroup({ classid: node.key, orderby: 'orderidx', pageSize: 100 }).then(res => {
|
||||
if (res.rows.length > 0) {
|
||||
let ary = []
|
||||
res.rows.forEach(item => {
|
||||
if (item.parentid === 0) {
|
||||
//studentGroup 小组学生
|
||||
let studentGroup = JSON.parse("[" + item.studentlist + "]")
|
||||
studentGroup.forEach(el => {
|
||||
el.label = el.name
|
||||
el.leaf = true
|
||||
el.level = 2,
|
||||
el.id = el.studentid
|
||||
el.classId = item.classid
|
||||
})
|
||||
ary.push({
|
||||
label: item.groupname,
|
||||
...item,
|
||||
level: 1,
|
||||
children: studentGroup
|
||||
})
|
||||
}
|
||||
})
|
||||
resolve(ary)
|
||||
}
|
||||
else {
|
||||
resolve([])
|
||||
}
|
||||
})
|
||||
}
|
||||
// 三级节点 小组学生
|
||||
if (node.level == 2) {
|
||||
resolve(node.data.children)
|
||||
}
|
||||
|
||||
},
|
||||
//节点勾选后触发 拿学生
|
||||
handleCheckChange(data, checked) {
|
||||
this.studentList = []
|
||||
// 选中节点集合
|
||||
let checkNodes = checked.checkedNodes
|
||||
let ary = []
|
||||
checkNodes.forEach(item => {
|
||||
// 一级节点 班级
|
||||
if (item.level == 0) {
|
||||
ary = [...ary, ...(item.classstudentlist)]
|
||||
}
|
||||
// 二级节点 班级下面的小组
|
||||
if (item.level == 1) {
|
||||
ary = [...ary, ...(item.children)]
|
||||
}
|
||||
// 三级节点 小组下面的学生
|
||||
if (item.level == 2) {
|
||||
ary = [...ary, item]
|
||||
}
|
||||
})
|
||||
this.studentList = uniqBy(ary, 'studentid')
|
||||
},
|
||||
// 删除学生
|
||||
delStudent(index) {
|
||||
this.studentList.splice(index, 1)
|
||||
},
|
||||
onSubmit(formName) {
|
||||
|
||||
this.$refs[formName].validate(valid => {
|
||||
if (valid) {
|
||||
/**
|
||||
* 根据学生列表中的classId分班
|
||||
* studentList 为选中的所有学生 这些学生可能来自不同班级
|
||||
*/
|
||||
let gradeObj = groupBy(this.studentList, 'classId')
|
||||
// 处理要提交的参数
|
||||
let ary = []
|
||||
for (const value in gradeObj) {
|
||||
//这些参数 参照AIx web端 作业推送
|
||||
let obj = {
|
||||
id: 0,
|
||||
parentid: this.row.id,
|
||||
classid: value,
|
||||
classcourseid: 0,
|
||||
entpcourseid: this.entpcourseid,
|
||||
studentlist: JSON.stringify(gradeObj[value]),
|
||||
feedback: this.form.feedback,
|
||||
workkey: "",
|
||||
timelength: this.form.timelength,
|
||||
weights: 1,
|
||||
deaddate: this.form.deaddate,
|
||||
workdate: this.getCurrentDate(),
|
||||
uniquekey: this.row.uniquekey,
|
||||
entpcourseworklist: "[" + this.row.entpcourseworklist + "]",
|
||||
needMsgNotifine: 'false',
|
||||
msgkey: 'newclasswork',
|
||||
title: "作业任务",
|
||||
msgcontent: '',
|
||||
teachername: this.userInfo.nickName,
|
||||
unixstamp: new Date().getTime(),
|
||||
worktype: this.row.worktype
|
||||
}
|
||||
|
||||
ary.push(obj)
|
||||
}
|
||||
this.setLoading = true
|
||||
saveByClassWorkArray({
|
||||
classworkarray: JSON.stringify(ary)
|
||||
}).then(() => {
|
||||
this.setLoading = false
|
||||
ElMessage.success('操作成功')
|
||||
this.cloneDialog()
|
||||
}).catch(()=>{
|
||||
this.setLoading = false
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
// 关闭弹窗
|
||||
cloneDialog() {
|
||||
this.$emit('on-close')
|
||||
this.studentList = []
|
||||
this.$refs['ruleForm'].resetFields();
|
||||
},
|
||||
// 获取当前年月日
|
||||
getCurrentDate() {
|
||||
const now = new Date();
|
||||
const year = now.getFullYear();
|
||||
let month = now.getMonth() + 1; // 月份是从0开始的,所以需要+1
|
||||
let day = now.getDate()
|
||||
if(month < 10){
|
||||
month = '0' + month
|
||||
}
|
||||
if(day < 10){
|
||||
day = '0' + day
|
||||
}
|
||||
return `${year}-${month}-${day}`;
|
||||
},
|
||||
validateGrade(rule, value, callback) {
|
||||
if (this.studentList.length == 0) {
|
||||
callback(new Error('请勾选班级或者学生'));
|
||||
}
|
||||
else {
|
||||
callback()
|
||||
}
|
||||
},
|
||||
validateStudent(rule, value, callback) {
|
||||
if (this.studentList.length == 0) {
|
||||
callback(new Error('学生不能为空'));
|
||||
}
|
||||
else {
|
||||
callback()
|
||||
}
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
modelValue(val) {
|
||||
this.dialogVisible = val
|
||||
if (val) {
|
||||
this.getGradeList()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.homerwork-header {
|
||||
justify-content: space-between;
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
|
||||
.icon-guanbi {
|
||||
font-size: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.el-tag {
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.dialog-footer{
|
||||
padding-bottom: 10px
|
||||
}
|
||||
|
||||
:deep(.el-checkbox){
|
||||
transform : scale(1.3)
|
||||
}
|
||||
:deep(.el-icon){
|
||||
transform : scale(1.3)
|
||||
}
|
||||
</style>
|
|
@ -114,7 +114,6 @@
|
|||
v-model="setDialog"
|
||||
:entpcourseid="entpcourseid"
|
||||
:row="row"
|
||||
@on-close="closeHomework"
|
||||
/>
|
||||
</div>
|
||||
<reserv
|
||||
|
@ -143,7 +142,7 @@ import { toTimeText } from '@/utils/date'
|
|||
import { ElMessage } from 'element-plus'
|
||||
import { parseCataByNode, creatPPT, asyncLocalFile } from '@/utils/talkFile'
|
||||
import FileOperBatch from '@/views/prepare/container/file-oper-batch.vue'
|
||||
import SetHomework from './container/set-homework.vue'
|
||||
import SetHomework from '@/components/set-homework/index.vue'
|
||||
import outLink from '@/utils/linkConfig'
|
||||
import { createWindow } from '@/utils/tool'
|
||||
import { cloneDeep } from 'lodash'
|
||||
|
@ -487,13 +486,9 @@ export default {
|
|||
this.isLoading = false
|
||||
})
|
||||
},
|
||||
closeHomework() {
|
||||
this.setDialog = false
|
||||
},
|
||||
|
||||
// 打开PDF-课件
|
||||
async navtoPdf() {
|
||||
if (toolStore.isPdfWin) return this.$message.error('您当前已打开课本,请勿重复操作')
|
||||
// if (toolStore.isPdfWin) return this.$message.error('您当前已打开课本,请勿重复操作')
|
||||
let path = await this.getBookPathFromServer()
|
||||
createWindow('open-PDF', {
|
||||
url: '/classBegins/index?textbookId=' + this.uploadData.textbookId + '&path=' + path
|
||||
|
@ -501,7 +496,7 @@ export default {
|
|||
},
|
||||
// 上课-工具类悬浮
|
||||
async openLesson() {
|
||||
await startClass(this.curClassReserv.id)
|
||||
// await startClass(this.curClassReserv.id)
|
||||
createWindow('tool-sphere', {
|
||||
url:
|
||||
'/tool/sphere?entpcourseid=' +
|
||||
|
|
|
@ -7,12 +7,30 @@
|
|||
@click="sourceStore.changeTab(item.value)">{{ item.label
|
||||
}}</el-button>
|
||||
</el-col>
|
||||
<el-col :span="12" class="search-box flex">
|
||||
<el-input v-model="sourceStore.query.fileName" @input="sourceStore.changeName" style="width: 240px"
|
||||
|
||||
<el-col :span="12" class="search-box flex" v-if="isThird">
|
||||
<el-input v-model="sourceStore.thirdQuery.title" @input="onchangeInput()" style="width: 240px"
|
||||
placeholder="请输入关键词" />
|
||||
</el-col>
|
||||
<el-col :span="12" class="search-box flex" v-else>
|
||||
<el-input v-model="sourceStore.query.fileName" @input="onchangeInput()" style="width: 240px"
|
||||
placeholder="请输入关键词" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row class="resoure-btns">
|
||||
|
||||
<!-- 第三方资源筛选-->
|
||||
<el-row class="resoure-btns" v-if="isThird">
|
||||
<el-col :span="24" class="query-row flex">
|
||||
<div class="flex row-left">
|
||||
<el-button v-for="item in coursewareTypeList" :key="item.id"
|
||||
:type="sourceStore.thirdQuery.type == item.value ? 'primary' : ''" round
|
||||
@click="sourceStore.thirdChangeType(item.value)">
|
||||
{{item.label }}
|
||||
</el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row class="resoure-btns" v-else>
|
||||
<el-col :span="24" class="query-row flex">
|
||||
<div class="flex row-left"> <el-select v-model="sourceStore.query.fileSuffix" @change="sourceStore.changeSuffix"
|
||||
style="width: 110px">
|
||||
|
@ -30,13 +48,36 @@
|
|||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {watch,ref,onMounted} from 'vue'
|
||||
import useResoureStore from '../store'
|
||||
|
||||
import {coursewareTypeList} from '@/utils/resourceDict'
|
||||
const isThird = ref(false)
|
||||
const sourceStore = useResoureStore()
|
||||
// 防抖函数
|
||||
const debounce = (fn, t) => {
|
||||
let timer;
|
||||
return function (...args) {
|
||||
if (timer) clearTimeout(timer);
|
||||
timer = setTimeout(() => fn.apply(this, args), t);
|
||||
};
|
||||
};
|
||||
// 初始化防抖函数
|
||||
const debouncedChangeName = debounce(sourceStore.changeName, 300);
|
||||
const onchangeInput = () => {
|
||||
debouncedChangeName()
|
||||
}
|
||||
onMounted(() => {
|
||||
sourceStore.query.fileSource = '平台'
|
||||
})
|
||||
|
||||
watch(() => sourceStore.query.fileSource,() => {
|
||||
sourceStore.query.fileSource === '第三方'?isThird.value = true:isThird.value = false
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.resoure-search {
|
||||
|
@ -81,4 +122,4 @@ const sourceStore = useResoureStore()
|
|||
padding: 3px 15px;
|
||||
font-size: 13px;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
|
|
@ -0,0 +1,260 @@
|
|||
<template>
|
||||
<div v-loading="sourceStore.loading" class="resource-list">
|
||||
<el-scrollbar>
|
||||
<el-empty v-if="!sourceStore.thirdResult.list.length" description="暂无数据" />
|
||||
<ul>
|
||||
<li
|
||||
v-for="item in sourceStore.thirdResult.list"
|
||||
:key="item.itemId"
|
||||
class="list-item"
|
||||
@click="handleRow"
|
||||
>
|
||||
<div class="item-left flex">
|
||||
<div style="position: relative" @click="clickImg(item.itemId)">
|
||||
<FileImage :file-name="item.fileType" :size="50" />
|
||||
<el-icon style="position: absolute;top: 1px;right: 5px"><Search /></el-icon>
|
||||
</div>
|
||||
<div class="flex item-left-content">
|
||||
<div class="name flex" :title="item.title">
|
||||
<div></div>
|
||||
<div
|
||||
style="
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
width: 200px;
|
||||
"
|
||||
>
|
||||
{{ item.title }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-tags flex" style="margin-bottom: 5px;">
|
||||
<el-text type="info" size="small" class="mr-10">标签:</el-text>
|
||||
<el-tag type="info" size="small" class="mr-10">{{ item.year }}</el-tag>
|
||||
<el-tag type="info" size="small" class="mr-10">{{ item.typeName }}</el-tag>
|
||||
<el-tag type="info" size="small" class="mr-10">{{ item.provinceName }}</el-tag>
|
||||
</div>
|
||||
<div class="item-tags flex">
|
||||
<el-text type="info" size="small" class="mr-10">
|
||||
<el-icon><Clock/></el-icon>
|
||||
{{ timestampToDate(item.dateline) }}
|
||||
</el-text>
|
||||
<el-text type="info" size="small" class="mr-10">
|
||||
<el-icon><View /></el-icon>
|
||||
{{ item.viewCount }}人看过
|
||||
</el-text>
|
||||
<el-text type="info" size="small" class="mr-10">
|
||||
<el-icon><Folder /></el-icon>
|
||||
{{ item.formatSize }}
|
||||
</el-text>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</el-scrollbar>
|
||||
<div class="pagination-box">
|
||||
<el-pagination
|
||||
v-model:current-page="sourceStore.thirdQuery.page"
|
||||
v-model:page-size="sourceStore.thirdQuery.perPage"
|
||||
:page-sizes="[10, 20, 30, 50]"
|
||||
background
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="sourceStore.thirdResult.total"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</div>
|
||||
<el-dialog v-model="isViewImg" width="80%" :modal-append-to-body="false" :append-to-body="false">
|
||||
<div class="demo-image__lazy">
|
||||
<el-image v-for="(url,index) in srcList" :key="index" :src="url" lazy />
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!-- <video width="550" controls autoplay loop>-->
|
||||
<!-- <source src="https://sf1-cdn-tos.huoshanstatic.com/obj/media-fe/xgplayer_doc_video/mp4/xgplayer-demo-360p.mp4" type="video/mp4" />-->
|
||||
<!-- </video>-->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
// import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { Clock,View,Folder,Search } from '@element-plus/icons-vue'
|
||||
import FileImage from '@/components/file-image/index.vue'
|
||||
import { getFileSuffix } from '@/utils/ruoyi'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import useResoureStore from '../store'
|
||||
import {getImgPath} from "@/api/file/third";
|
||||
|
||||
const userstore = useUserStore()
|
||||
const sourceStore = useResoureStore()
|
||||
|
||||
// const userInfo = userstore.user
|
||||
//判断是否预览图片
|
||||
const isViewImg = ref(false)
|
||||
//显示图片的路径
|
||||
const srcList = ref([])
|
||||
|
||||
// 分页change
|
||||
const handleSizeChange = (limit) => {
|
||||
sourceStore.thirdQuery.perPage = limit
|
||||
sourceStore.handleQuery()
|
||||
}
|
||||
const handleCurrentChange = (page) => {
|
||||
sourceStore.thirdQuery.page = page
|
||||
sourceStore.handleQuery()
|
||||
}
|
||||
//将时间戳转化为时间的格式
|
||||
function timestampToDate(timestamp) {
|
||||
// 如果时间戳是10位数,则将其转换为毫秒级
|
||||
if (timestamp.toString().length === 10) {
|
||||
timestamp *= 1000;
|
||||
}
|
||||
|
||||
const date = new Date(timestamp);
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,所以加1,并确保两位数
|
||||
const day = String(date.getDate()).padStart(2, '0'); // 确保两位数
|
||||
|
||||
return `${year}-${month}-${day}`;
|
||||
}
|
||||
//获取图片的路径
|
||||
const clickImg = (id) => {
|
||||
srcList.value = []
|
||||
getImgPath({itemId:id}).then(res => {
|
||||
if(res.code === 200){
|
||||
isViewImg.value = true
|
||||
res.data.forEach(item => {
|
||||
item.subsets.forEach(previewItem => {
|
||||
previewItem.previewFiles.forEach(fileItem => {
|
||||
srcList.value.push(fileItem.fileUrl)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
::v-deep(.el-popover) {
|
||||
min-width: 50px;
|
||||
width: 50px !important;
|
||||
}
|
||||
.custom-popover {
|
||||
width: 80px !important;
|
||||
min-width: 80px !important;
|
||||
padding: 5px !important;
|
||||
|
||||
.item-popover-item {
|
||||
padding: 5px 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
|
||||
.iconfont {
|
||||
margin-right: 5px;
|
||||
color: #a2a2a2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.resource-list {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: auto;
|
||||
.list-item {
|
||||
flex: 1;
|
||||
padding: 10px 20px;
|
||||
border-bottom: solid #f1f1f1 1px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
background-color: rgba(144, 147, 153, 0.2);
|
||||
cursor: pointer;
|
||||
}
|
||||
.item-left {
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
.icon {
|
||||
font-size: 50px;
|
||||
}
|
||||
|
||||
.item-left-content {
|
||||
margin-left: 10px;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.name {
|
||||
font-size: 14px;
|
||||
color: #3b3b3b;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.line {
|
||||
width: 1px;
|
||||
height: 15px;
|
||||
background-color: #d9dce2;
|
||||
}
|
||||
|
||||
.item-tags {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.mr-10 {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.gray-text {
|
||||
color: #909399;
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.item-btns {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
:deep(.item-popover) {
|
||||
font-size: 12px;
|
||||
flex-direction: column;
|
||||
|
||||
p {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.icon-shenglvehao {
|
||||
cursor: pointer;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.icon-jiahao {
|
||||
font-size: 12px;
|
||||
margin-right: 3px;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.pagination-box {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
height: 65px;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -1,7 +1,8 @@
|
|||
<template>
|
||||
<div class="page-resource flex">
|
||||
<!--左侧 教材 目录-->
|
||||
<ChooseTextbook @change-book="getData" @node-click="getData" />
|
||||
<Third v-if="isThird" @node-click="getDataOther"></Third>
|
||||
<ChooseTextbook v-else @change-book="getData" @node-click="getData" />
|
||||
|
||||
<div class="page-right">
|
||||
<!-- 搜索 -->
|
||||
|
@ -18,7 +19,9 @@
|
|||
>
|
||||
</ResoureSearch>
|
||||
<!-- 列表 -->
|
||||
<ResoureList />
|
||||
<!-- 第三方列表-->
|
||||
<ThirdList v-if="isThird" />
|
||||
<ResoureList v-else />
|
||||
</div>
|
||||
</div>
|
||||
<!-- 上传弹窗 -->
|
||||
|
@ -26,11 +29,13 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, ref, toRaw } from 'vue'
|
||||
import { onMounted, ref, toRaw,watch } from 'vue'
|
||||
import useResoureStore from './store'
|
||||
import ChooseTextbook from '@/components/choose-textbook/index.vue'
|
||||
import Third from '@/components/choose-textbook/third.vue'
|
||||
import ResoureSearch from './container/resoure-search.vue'
|
||||
import ResoureList from './container/resoure-list.vue'
|
||||
import ThirdList from './container/third-list.vue'
|
||||
import uploadDialog from '@/components/upload-dialog/index.vue'
|
||||
import uploaderState from '@/store/modules/uploader'
|
||||
import { createWindow } from '@/utils/tool'
|
||||
|
@ -41,9 +46,8 @@ const toolStore = useToolState()
|
|||
const openDialog = () => {
|
||||
isDialogOpen.value = true
|
||||
}
|
||||
// onMounted(async () => {
|
||||
// console.log('toolStore: ', toolStore.windowState)
|
||||
// })
|
||||
//判断是否去查看第三方资源
|
||||
const isThird = ref(false)
|
||||
|
||||
// 查询
|
||||
const getData = (data) => {
|
||||
|
@ -67,6 +71,13 @@ const getData = (data) => {
|
|||
}
|
||||
sourceStore.handleQuery()
|
||||
}
|
||||
const getDataOther = (data) => {
|
||||
sourceStore.thirdQuery.chapterId = data.chapterId
|
||||
sourceStore.thirdQuery.bookId = data.bookId
|
||||
sourceStore.thirdQuery.stage = data.stage
|
||||
sourceStore.thirdQuery.subjectId = data.subjectId
|
||||
sourceStore.handleQuery()
|
||||
}
|
||||
|
||||
// 提交文件
|
||||
const submitFile = (data) => {
|
||||
|
@ -92,6 +103,9 @@ const fileCallBack = (res) => {
|
|||
onMounted(() => {
|
||||
sourceStore.getCreate()
|
||||
})
|
||||
watch(() => sourceStore.query.fileSource,() => {
|
||||
sourceStore.query.fileSource === '第三方'?isThird.value = true:isThird.value = false
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { defineStore } from 'pinia'
|
||||
import { getSmarttalkPage } from '@/api/file/index'
|
||||
import { getBookList } from '@/api/file/third'
|
||||
import { tabs, resourceType, resourceFormat } from '@/utils/resourceDict'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { hasPermission } from '@/utils/hasPermission'
|
||||
|
@ -60,23 +61,56 @@ export default defineStore('resource', {
|
|||
isAsc: 'desc',
|
||||
...structQuery
|
||||
},
|
||||
//第三方的查询条件
|
||||
thirdQuery:{
|
||||
page:1,
|
||||
perPage:20,
|
||||
chapterId:0,
|
||||
bookId:0,
|
||||
stage:0,
|
||||
subjectId:0,
|
||||
type:'',
|
||||
title:''
|
||||
},
|
||||
result: {
|
||||
list: [],
|
||||
total: 0
|
||||
}
|
||||
},
|
||||
//第三方的数据单独处理
|
||||
thirdResult:{
|
||||
list: [],
|
||||
total: 0,
|
||||
},
|
||||
}),
|
||||
actions: {
|
||||
handleQuery() {
|
||||
try {
|
||||
this.loading = true
|
||||
let data = { ...this.query }
|
||||
if (data.fileSuffix == -1) {
|
||||
data.fileSuffix = ''
|
||||
if(this.query.fileSource !== '第三方'){
|
||||
let data = { ...this.query }
|
||||
if (data.fileSuffix == -1) {
|
||||
data.fileSuffix = ''
|
||||
}
|
||||
getSmarttalkPage(data).then((res) => {
|
||||
this.result.total = res.total
|
||||
this.result.list = res.rows
|
||||
})
|
||||
}else{
|
||||
let data = JSON.parse(JSON.stringify(this.thirdQuery))
|
||||
if (data.title) {
|
||||
data.title.trim()
|
||||
}else{
|
||||
data.title = null
|
||||
}
|
||||
getBookList(data).then((res) => {
|
||||
if(res.code === 200){
|
||||
if(res.data.code === 0){
|
||||
this.thirdResult.total = res.data.page.totalCount
|
||||
this.thirdResult.list = [...res.data.data]
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
getSmarttalkPage(data).then((res) => {
|
||||
this.result.total = res.total
|
||||
this.result.list = res.rows
|
||||
})
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
|
@ -90,6 +124,11 @@ export default defineStore('resource', {
|
|||
this.query.fileFlag = val
|
||||
this.handleQuery()
|
||||
},
|
||||
thirdChangeType(val) {
|
||||
this.thirdQuery.type = val
|
||||
this.handleQuery()
|
||||
},
|
||||
//第三方的切换类型区别开
|
||||
changeSuffix(val) {
|
||||
this.query.fileSuffix = val
|
||||
this.handleQuery()
|
||||
|
@ -99,12 +138,12 @@ export default defineStore('resource', {
|
|||
this.handleQuery()
|
||||
},
|
||||
getCreate(){
|
||||
if(this.query.fileSource == '平台'){
|
||||
if(this.query.fileSource == '平台' || this.query.fileSource == '第三方' ){
|
||||
this.isCreate = hasPermission(['platformmanager'])
|
||||
}
|
||||
else{
|
||||
this.isCreate = hasPermission(['schoolteacher','headmaster'])
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
})
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
</el-scrollbar>
|
||||
</div>
|
||||
<SetHomework v-model="setDialog" :title="'推送作业'" :entpcourseid="entpcourseid" :row="curRow"
|
||||
@on-close="closeHomework" />
|
||||
@on-close="closeHomework" @on-success="successHomework"/>
|
||||
</div>
|
||||
<div class="homework flex" v-else>
|
||||
<div class="unit-top flex">
|
||||
|
@ -73,18 +73,17 @@
|
|||
import { ref, onMounted, toRaw } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { getSmarttalkPage, getPrepareById } from '@/api/file'
|
||||
import SetHomework from '@/views/prepare/container/set-homework.vue'
|
||||
import { getSmarttalkPage } from '@/api/file'
|
||||
import SetHomework from '@/components/set-homework/index.vue'
|
||||
import FileImage from '@/components/file-image/index.vue'
|
||||
import { useGetHomework } from '@/hooks/useGetHomework'
|
||||
import { ipcMsgSend } from '@/utils/tool'
|
||||
import { ipcMsgSend, ipcMsgSend2, ipcMsgInvoke } from '@/utils/tool'
|
||||
import { useToolState } from '@/store/modules/tool'
|
||||
import { asyncLocalFile } from '@/utils/talkFile'
|
||||
import Lesson from './lesson.vue';
|
||||
import { parseCataByNode } from '@/utils/talkFile'
|
||||
import outLink from '@/utils/linkConfig'
|
||||
import MsgEnum from '@/plugins/imChat/msgEnum' // 消息枚举
|
||||
|
||||
import { ipcMsgSend2 } from '@/utils/tool'
|
||||
const route = useRoute();
|
||||
const usertore = useUserStore().user
|
||||
const toolStore = useToolState()
|
||||
|
@ -97,11 +96,9 @@ const dataList = ref([])
|
|||
const setDialog = ref(false)
|
||||
// 资源数据
|
||||
const resourceList = ref([])
|
||||
|
||||
//
|
||||
//当前点击的数据
|
||||
const curRow = ref('')
|
||||
|
||||
|
||||
const sendHomework = (row) => {
|
||||
curRow.value = row
|
||||
setTimeout(() => {
|
||||
|
@ -110,12 +107,15 @@ const sendHomework = (row) => {
|
|||
setDialog.value = true
|
||||
}
|
||||
//
|
||||
const closeHomework = () => {
|
||||
const closeHomework = async() => {
|
||||
ipcMsgSend('tool-sphere:set:ignore', true)
|
||||
setDialog.value = false
|
||||
}
|
||||
|
||||
|
||||
// 推送成功
|
||||
const successHomework = ()=>{
|
||||
// 发送im消息-推送作业(app|平板)
|
||||
ipcMsgInvoke('im-chat:msg', curRow.value.id, MsgEnum.HEADS.MSG_0016)
|
||||
}
|
||||
// 章节目录change
|
||||
const changeChapter = async (data)=>{
|
||||
const { res } = await useGetHomework(data)
|
||||
dataList.value = res
|
||||
|
|
|
@ -4,7 +4,7 @@ import { onMounted, ref, reactive, watchEffect } from 'vue'
|
|||
import { ImChat } from '@/plugins/imChat'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import * as http from '@/api/apiService' // 自定义api service
|
||||
// import { ipcMsgSend, ipcHandle, ipcMain, ipcMsgInvoke } from '@/utils/tool' // 相关工具
|
||||
import { ipcMsgSend, ipcHandle, ipcMain, ipcMsgInvoke } from '@/utils/tool' // 相关工具
|
||||
const userStore = useUserStore()
|
||||
const emits = defineEmits(['change'])
|
||||
const props = defineProps({
|
||||
|
@ -12,8 +12,7 @@ const props = defineProps({
|
|||
})
|
||||
const imChatObj = reactive({imChat:null})
|
||||
onMounted(() => {
|
||||
// console.log(imChatObj)
|
||||
// initImChat()
|
||||
ipcMainHandle() // 绑定-监听ipcMain im相关消息
|
||||
})
|
||||
// 初始化 im-chat
|
||||
const initImChat = async (timGroupId) => {
|
||||
|
@ -31,13 +30,13 @@ const initImChat = async (timGroupId) => {
|
|||
imChatObj.imChat = new ImChat(sdkAppId, sign, timuserid)
|
||||
// 初始化 im-chat
|
||||
await imChatObj.imChat.init()
|
||||
// 登录 im-chat
|
||||
await imChatObj.imChat.login()
|
||||
// 监听 im-chat 消息
|
||||
imChatObj.imChat.watch((res) => {
|
||||
imChatObj.imChat.setConsole('%cchat-msg', res)
|
||||
msgHandle(res) // 消息处理
|
||||
})
|
||||
// 登录 im-chat(为了不漏消息,需要在登录之前-监听)
|
||||
await imChatObj.imChat.login()
|
||||
// 创建群
|
||||
if (!timGroupId||props.isGroup) { // 创建群
|
||||
await createGroup(groupName)
|
||||
|
@ -95,6 +94,14 @@ const logout = () => imChatObj.imChat?.logout()
|
|||
// 解散群
|
||||
const deleteGroup = () => imChatObj.imChat?.deleteGroup()
|
||||
|
||||
// 绑定-监听ipcMain im相关消息
|
||||
const ipcMainHandle = () => {
|
||||
ipcMain?.removeHandler?.('im-chat:msg') // 先移除已有的 ipcMain 消息
|
||||
ipcMain?.handle?.('im-chat:msg', (e, msg, head, type) => { // 重新绑定 ipcMain 消息
|
||||
return imChatObj.imChat?.sendMsgGroup(msg, head, type)
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({ initImChat, logout, deleteGroup, imChatObj })
|
||||
</script>
|
||||
|
||||
|
|
|
@ -13,9 +13,8 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, nextTick, markRaw, toRaw } from 'vue'
|
||||
import { ref, onMounted, nextTick, toRaw } from 'vue'
|
||||
import { useToolState } from '@/store/modules/tool'
|
||||
import { parseCataByNode } from '@/utils/talkFile'
|
||||
|
||||
const emit = defineEmits(['changeChapter'])
|
||||
const toolStore = useToolState()
|
||||
|
@ -42,18 +41,17 @@ const getTreeData = () => {
|
|||
evaluationList.value = JSON.parse(localStorage.getItem('evaluationList'))
|
||||
|
||||
//上册
|
||||
let volumeOne = evaluationList.value.filter(item => item.level == 1 && item.semester == '上册')
|
||||
//下册
|
||||
let volumeTwo = evaluationList.value.filter(item => item.level == 1 && item.semester == '下册')
|
||||
/**
|
||||
* 不区分上下册
|
||||
* 2024/08/20调整
|
||||
*/
|
||||
let volumeOne = evaluationList.value.filter(item => item.level == 1)
|
||||
|
||||
//数据过滤
|
||||
|
||||
let upData = transData(volumeOne)
|
||||
let downData = transData(volumeTwo)
|
||||
if(upData.length && downData.length){
|
||||
treeData.value = [...upData,...downData]
|
||||
}
|
||||
else if(upData.length || downData.length){
|
||||
treeData.value = upData.length ? upData : downData
|
||||
if(upData.length){
|
||||
treeData.value = [...upData]
|
||||
}
|
||||
else{
|
||||
treeData.value = []
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<template>
|
||||
<div class="warp" ref="btnRef">
|
||||
<div class="warp" ref="btnRef" :style="isFold?'min-height:auto;':''">
|
||||
<slot name="start"></slot>
|
||||
<!-- 工具按钮 -->
|
||||
<el-space direction="vertical">
|
||||
<el-space direction="vertical" v-show="!isFold">
|
||||
<template v-for="(item,index) in list">
|
||||
<slot :name="item.prop" :item="item" :index="index">
|
||||
<div class="c-btn flex flex-col items-center gap-2 p-2" @click.stop="clickHandel(item,$event)">
|
||||
|
@ -13,7 +13,11 @@
|
|||
</template>
|
||||
<slot name="append"></slot>
|
||||
</el-space>
|
||||
<slot name="end"></slot>
|
||||
<slot name="end">
|
||||
<span class="fold" @click="isFold=!isFold" :style="isFold?'margin: 5px;':''">
|
||||
{{isFold?'<<<':'>>>'}}
|
||||
</span>
|
||||
</slot>
|
||||
<!-- 内容部分 -->
|
||||
<transition name="el-fade-in">
|
||||
<div class="c-popover" :style="`--top: ${topPos}px;--height:${hPost}px;`" v-show="isVisible">
|
||||
|
@ -54,6 +58,7 @@ const activeObj = ref(null) // 当前激活的按钮
|
|||
const btnRef = ref(null) // 按钮元素-ref
|
||||
const topPos = ref(30) // 顶部距离-内容的距离
|
||||
const hPost = ref(0) // 顶部距离-内容的距离
|
||||
const isFold = ref(false) // 是否折叠
|
||||
let posBtnAll = {} // 存储位置
|
||||
// === 计算属性 ===
|
||||
const list = computed(() => props.data.map((o,i) => {
|
||||
|
@ -100,7 +105,7 @@ const clickHandel = (o, e) => {
|
|||
min-width: 4em;
|
||||
border-radius: 4em;
|
||||
background-color: #121212;
|
||||
.el-space{margin: 20px 0;}
|
||||
.el-space{margin: 20px 0 0;}
|
||||
.c-btn{
|
||||
color: #d9dce3;
|
||||
cursor: pointer;
|
||||
|
@ -113,6 +118,20 @@ const clickHandel = (o, e) => {
|
|||
background: #454545fa;
|
||||
}
|
||||
}
|
||||
.fold{
|
||||
display: block;
|
||||
color: #ccc;
|
||||
font-size: 14px;
|
||||
padding: 3px 6px;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
margin-bottom: 10px;
|
||||
&:hover{
|
||||
color: #409eff;
|
||||
border-radius: 4px;
|
||||
// background: #454545fa;
|
||||
}
|
||||
}
|
||||
}
|
||||
.c-popover{
|
||||
--top: 30px;
|
||||
|
|
|
@ -1,28 +1,73 @@
|
|||
<template>
|
||||
<el-button v-if="props.test" type="primary" @click="trigger">测试</el-button>
|
||||
<div ref="warpRef" class="c-warp">
|
||||
<template v-for="i in sum">
|
||||
<slot><el-icon><Star /></el-icon></slot>
|
||||
<div v-if="props.test">
|
||||
<el-button type="primary" @click="trigger" v-tap:trigger="">点赞</el-button>
|
||||
<el-button type="primary" @click="trigger(2, '学生A')" v-tap:trigger="[2,'学生A']">疑惑</el-button>
|
||||
</div>
|
||||
<!-- 温度计-模式 -->
|
||||
<div v-if="props.type == 2" class="c-anim">
|
||||
<div class="item like" :style="`height:${wtData.like*5}px;`"></div>
|
||||
<div class="item doubt" :style="`height:${wtData.doubt*5}px;`"></div>
|
||||
</div>
|
||||
<!-- (默认)弹幕-模式 -->
|
||||
<div v-else ref="warpRef" class="c-warp">
|
||||
<template v-for="(item, index) in iconCache.list">
|
||||
<slot>
|
||||
<el-icon v-if="props.def"><Star /></el-icon>
|
||||
<div v-else class="item">
|
||||
<svg class="icon" aria-hidden="true">
|
||||
<use :xlink:href="`#icon-`+item.icon"></use>
|
||||
</svg>
|
||||
<!-- 学生姓名 -->
|
||||
<div class="tip" v-if="item.name">
|
||||
<span :title="item.name">{{item.name}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</slot>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<script setup>
|
||||
// 功能说明:动画-点赞
|
||||
import { nextTick, ref } from 'vue'
|
||||
import { ref, nextTick, useSlots, reactive } from 'vue'
|
||||
import {Star} from '@element-plus/icons-vue'
|
||||
const warpRef = ref(null)
|
||||
const props = defineProps({ test: Boolean })
|
||||
const sum = ref(0)
|
||||
// === 方法 ===
|
||||
const trigger = () => {
|
||||
sum.value++
|
||||
nextTick(() => {
|
||||
const el = warpRef.value.lastElementChild // 获取最后一个新加的元素
|
||||
animInit(el)
|
||||
})
|
||||
const slots = useSlots() // 获取插槽
|
||||
const isSlot = !!Object.keys(slots).length // 是否使用了插槽
|
||||
const props = defineProps({
|
||||
test: Boolean, // 是否开启-测试按钮
|
||||
def: Boolean, // 是否使用默认图标
|
||||
type: String, // 模式 1-弹幕 2-温度计
|
||||
tback: Number, // 模式:温度计-退回速度
|
||||
tsleep: Number, // 模式:温度计-执行退回间隔
|
||||
})
|
||||
let iconCache = reactive({list:[]}) // 图标缓存
|
||||
let wtData = reactive({ // 温度计模式-计数
|
||||
like: 0, doubt: 0,
|
||||
timeout: {like: null, doubt: null}, // 定时器-单次
|
||||
interval: {like: null, doubt: null}, // 定时器-循环
|
||||
})
|
||||
|
||||
// === 触发 type 1: 点赞 2: 疑惑 ===
|
||||
const trigger = async (type, name) => {
|
||||
if (typeof type == 'string') { name = type; type = 1 } // 兼容
|
||||
if (props.type == 2) { // 温度计-模式
|
||||
weatherglassModel(type)
|
||||
} else { // 默认-弹幕模式
|
||||
iconCache.list.push({
|
||||
name,
|
||||
icon: isSlot||props.def ? '' : getRandomIcon(type) // 图标
|
||||
})
|
||||
nextTick(() => {
|
||||
const el = warpRef.value.lastElementChild // 获取最后一个新加的元素
|
||||
const tipEl = el.querySelector('.tip') // 获取提示元素
|
||||
// console.log(el)
|
||||
animInit(el, tipEl, type)
|
||||
})
|
||||
}
|
||||
}
|
||||
// 初始化动画
|
||||
const animInit = (el) => {
|
||||
const animInit = (el, tipEl, type) => {
|
||||
const { height, width } = el.getBoundingClientRect()
|
||||
const sumH = warpRef.value.clientHeight
|
||||
const sumW = warpRef.value.clientWidth
|
||||
|
@ -32,15 +77,25 @@ const animInit = (el) => {
|
|||
let opacity = 0 // 透明度
|
||||
let scale = 0 // 缩放
|
||||
let transform = '' // 旋转 缩放 偏移等操作
|
||||
let transform2 = '' // 旋转 缩放 偏移等操作-恢复
|
||||
let right = getRandom(5, maxw, false, true) // 随机-右距离
|
||||
let isPlus = getRandomBool()?'':'-' // 随机-方向
|
||||
let isPlus2 = isPlus ? '' : '-' // 随机-方向-恢复
|
||||
let rotate = getRandom(0, 60, false, true) // 随机-旋转
|
||||
let scaleMax = getRandom(0, 1, true, true)+1 // 随机-缩放倍数
|
||||
let scaleMax = getRandom(0.5, 1.5, true, true)+1 // 随机-缩放倍数
|
||||
setStatic(el,'position','absolute') // 设置-定位
|
||||
setStatic(el, 'right', right, 'px') // 设置-右距离
|
||||
// 特殊处理
|
||||
if (type === 1) { // 疑惑
|
||||
rotate = getRandom(0, 15, false, true) // 随机-旋转
|
||||
scaleMax = getRandom(2.5, 3, true, true) // 随机-缩放倍数
|
||||
}
|
||||
// console.log('zdg: ', right, isPlus, rotate, scaleMax, maxw)
|
||||
|
||||
const amFn = () => { // opacity: 0.5;
|
||||
// if (bottom == 130) return
|
||||
// 到顶了- 移除元素
|
||||
if (bottom > maxH) {el.remove();return}
|
||||
if (bottom > maxH) {el.remove();resetIconCache();return}
|
||||
// 透明度: 进入-慢慢出现
|
||||
if (bottom < 101 && opacity < 1) opacity = toNumber(opacity + 0.01)
|
||||
else if (bottom > maxH - 100 && opacity > 0) opacity = toNumber(opacity - 0.01)
|
||||
|
@ -49,18 +104,69 @@ const animInit = (el) => {
|
|||
// 缩放:退出-慢慢缩小
|
||||
else if (bottom > maxH - (scaleMax/0.1) && scale > 0) scale = toNumber(scale - 0.1)
|
||||
bottom++
|
||||
// console.log('zdg: ', scale)
|
||||
// console.log('zdg: ', scale) rotate(${isPlus2}${rotate}deg)
|
||||
// 设置样式
|
||||
transform = `rotate(${isPlus}${rotate}deg) scale(${scale})`
|
||||
setStatic(el, 'bottom', bottom, 'px')
|
||||
setStatic(el, 'opacity', opacity)
|
||||
setStatic(el, 'transform', transform)
|
||||
if (!!tipEl && type) {
|
||||
transform2 = `rotate(${isPlus2}${rotate}deg) scale(${toNumber(1/scale)})`
|
||||
setStatic(tipEl, 'transform', transform2)
|
||||
}
|
||||
requestAnimationFrame(amFn)
|
||||
}
|
||||
amFn() // 初次执行
|
||||
}
|
||||
// 温度计-模式触发 1: 点赞 2: 疑惑
|
||||
const weatherglassModel = async(type) => {
|
||||
const field = type == 2 ? 'doubt' : 'like'
|
||||
wtData[field]++
|
||||
autoReduce(type)
|
||||
}
|
||||
// 温度计-自动恢复初始
|
||||
const autoReduce = type => {
|
||||
const field = type == 2 ? 'doubt' : 'like'
|
||||
const reduceFn = () => { // 该定时器: 会一直执行间隔1s
|
||||
wtData.interval[field] = setInterval(() => {
|
||||
wtData[field]--
|
||||
// 停止-定时器
|
||||
if (wtData[field] <= 0) {
|
||||
clearInterval(wtData.interval[field])
|
||||
wtData[field] = 0
|
||||
}
|
||||
}, (props.tback||100))
|
||||
}
|
||||
if (!!wtData.timeout[field]) clearInterval(wtData.timeout[field]) // 清除定时器:上一次
|
||||
if (!!wtData.interval[field]) clearInterval(wtData.interval[field]) // 清除定时器:上一次
|
||||
wtData.timeout[field] = setTimeout(() => {
|
||||
reduceFn()
|
||||
}, (props.tsleep||20) * 1000)
|
||||
}
|
||||
// 设置-静态样式
|
||||
const setStatic = (el, type, val, end) => el.style[type] = val + (end || '')
|
||||
// 重置缓存列表
|
||||
const resetIconCache = () => {
|
||||
const len = warpRef.value?.children?.length||0
|
||||
if (!len && iconCache.list.length) iconCache.list = []
|
||||
}
|
||||
// 随机图案样式-默认
|
||||
const getRandomIcon = (type) => {
|
||||
let iconArr = []
|
||||
switch (type) {
|
||||
case 2: // 阿里icon-疑惑
|
||||
iconArr = ['yiwen', 'a-yiwen', 'yihuo', 'yiwen-01']
|
||||
break
|
||||
default:
|
||||
iconArr = [ // 阿里icon-点赞
|
||||
'zan10', 'zanping', 'zan9', 'dianzan-red', 'zan8', 'zan11', 'zan7', 'MBEfenggeduosetubiao-xihuan',
|
||||
'zan6', 'zan-yizan', 'zan5', 'yizan', 'zan4', 'zan3', 'zan2', 'zan1', 'zan'
|
||||
]
|
||||
break
|
||||
}
|
||||
const ind = getRandom(0, iconArr.length-1)
|
||||
return iconArr[ind]||''
|
||||
}
|
||||
// 随机数 isFloat:是否小数 isMax:是否包含最大值
|
||||
const getRandom = (min, max, isFloat, isMax, pos=2) => {
|
||||
const maxVal = isMax ? max - min + 1 : max - min
|
||||
|
@ -71,11 +177,30 @@ const getRandom = (min, max, isFloat, isMax, pos=2) => {
|
|||
const getRandomBool = () => Math.random() > 0.5
|
||||
// 转换数字-(小数精度丢失)
|
||||
const toNumber = (v, pos = 2) => Number(v.toFixed(pos))
|
||||
// 延时
|
||||
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
|
||||
// 自定义-局部指令
|
||||
const vTap = {
|
||||
mounted(el, binding) {
|
||||
const instance = binding.instance
|
||||
const fn = binding.arg
|
||||
const args = binding.value||[]
|
||||
if (!fn) return
|
||||
let cleId = null
|
||||
el.addEventListener('mousedown', () => {
|
||||
cleId = setInterval(() => {instance[fn](...args)}, 10);
|
||||
})
|
||||
el.addEventListener('mouseup', () => {
|
||||
!!cleId && clearInterval(cleId)
|
||||
})
|
||||
}
|
||||
}
|
||||
// 暴露方法
|
||||
defineExpose({ trigger })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 弹幕-模式
|
||||
.c-warp {
|
||||
position: fixed;
|
||||
right: 0;
|
||||
|
@ -83,5 +208,66 @@ defineExpose({ trigger })
|
|||
width: 30%;
|
||||
height: 50%;
|
||||
pointer-events: none;
|
||||
.item{
|
||||
display: inline-block;
|
||||
.tip{
|
||||
position: absolute;
|
||||
padding: 3px 6px;
|
||||
border-radius: 4px;
|
||||
background: linear-gradient(90deg, #9fe597, #cce581);
|
||||
font-size: 12px;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
width: 65px;
|
||||
transform-origin: right top;
|
||||
span{
|
||||
display: inline-block;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
/* text-overflow: ellipsis; */
|
||||
white-space: nowrap;
|
||||
cursor: default;
|
||||
}
|
||||
&::before{
|
||||
content: " ";
|
||||
position: absolute;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
z-index: -1;
|
||||
box-sizing: border-box;
|
||||
background: linear-gradient(45deg, #b2e68d, #bce689);
|
||||
bottom: -3px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%) rotate(45deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 温度计-模式
|
||||
.c-anim {
|
||||
position: fixed;
|
||||
// height: 90vh;
|
||||
// border: 1px solid;
|
||||
inset: auto auto 3em 1em;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: flex-end;
|
||||
.item{
|
||||
flex: 1;
|
||||
border-radius: 3px;
|
||||
min-width: 15px;
|
||||
// height: 500px;
|
||||
&.like{
|
||||
background-image: linear-gradient(to top, #fef0f0, #f56c6c);
|
||||
// animation: striped-flow 5s linear infinite;
|
||||
}
|
||||
&.doubt{
|
||||
background-image: linear-gradient(to top, #fdf6ec, #e6a23c);
|
||||
}
|
||||
}
|
||||
}
|
||||
@keyframes striped-flow {
|
||||
0%{background-position: 0 500px;}
|
||||
100%{background-position: 0 0;}
|
||||
}
|
||||
</style>
|
|
@ -7,7 +7,7 @@
|
|||
<side-vue v-ignore @ignore-mounted="sideMouse" @change="sideChange"></side-vue>
|
||||
|
||||
<!-- 点赞组件 -->
|
||||
<upvote-vue ref="upvoteRef"></upvote-vue>
|
||||
<upvote-vue ref="upvoteRef" type="2"></upvote-vue>
|
||||
|
||||
<!-- im-chat 聊天组件 -->
|
||||
<im-chat ref="imChatRef" @change="chatChange" />
|
||||
|
@ -67,7 +67,8 @@ const classObj = reactive({ // 课程相关
|
|||
data: {} // 课程信息
|
||||
})
|
||||
const msgIds = [] // 消息id
|
||||
const btnList = [ // 工具栏按钮列表
|
||||
const electron = window.electron // electron
|
||||
const btnList = [ // 工具栏按钮列表
|
||||
{ label: '选择', value: 'select', icon: 'icon-mouse' },
|
||||
{ label: '画笔', value: 'brush', icon: 'icon-huabi' },
|
||||
{ label: '板擦', value: 'erase', icon: 'icon-xiangpica' },
|
||||
|
@ -78,10 +79,10 @@ const btnList = [ // 工具栏按钮列表
|
|||
]
|
||||
// === 页面加载完毕 ===
|
||||
onMounted(async() => {
|
||||
getClassInfo() // 获取课堂详情 ex3
|
||||
if (!electron) return // 浏览器端
|
||||
getClassInfo() // 获取课堂详情 ex3
|
||||
setTimeout(() => {
|
||||
// classManageApi.startClass(classObj.id) // 开始上课-临时
|
||||
resetStatus() // 开启重置状态-监听
|
||||
resetStatus() // 开启重置状态-监听
|
||||
}, 200);
|
||||
})
|
||||
|
||||
|
@ -91,10 +92,10 @@ const getClassInfo = async () => {
|
|||
const { data } = await classManageApi.getClassInfo(classObj.id)
|
||||
classObj.data = data
|
||||
// 群id
|
||||
let timGroupId = data?.ex3 && data?.ex3 != 'undefined' ? data.ex3: ''
|
||||
console.log('timGroupId:', timGroupId)
|
||||
let timGroupId = data?.ex3 || ''
|
||||
console.log('获取群ID:', timGroupId)
|
||||
const chat = await imChatRef.value?.initImChat(timGroupId) // 初始化im-chat
|
||||
if (!timGroupId) timGroupId = chat.timGroupId
|
||||
if (!timGroupId) timGroupId = chat?.timGroupId
|
||||
classManageApi.startClass(classObj.id, timGroupId) // 开始上课
|
||||
}
|
||||
// 切换tab-change
|
||||
|
@ -127,12 +128,13 @@ const chatChange = (type, data, ...args) => {
|
|||
const msgId = (args||[])[0].message_msg_id
|
||||
const { msgKey:head, msgcontent:msg, senduserid:sendId, msgType } = data
|
||||
switch(head) {
|
||||
case MsgEnum.HEADS.MSG_0001:
|
||||
case MsgEnum.HEADS.MSG_0001: // 点赞
|
||||
case MsgEnum.HEADS.MSG_0002: // 疑惑
|
||||
// console.log('点赞:', data)
|
||||
if(msgIds.includes(msgId)) return
|
||||
upvoteRef.value.trigger()
|
||||
if (msgIds.length >= 100) msgIds.shift() // 删除第一个
|
||||
msgIds.push(msgId) // 添加到数组
|
||||
if(msgIds.includes(msgId)) return // 忽略重复-点赞消息
|
||||
upvoteRef.value.trigger(head, data.name) // 触发点赞|疑惑
|
||||
if (msgIds.length >= 100) msgIds.shift() // 删除第一个
|
||||
msgIds.push(msgId) // 添加到数组
|
||||
break
|
||||
default:
|
||||
console.log('未知消息:', data)
|
||||
|
@ -147,6 +149,7 @@ const setIgnore = (bool) => {ipcMsgSend('tool-sphere:set:ignore', bool)}
|
|||
// 重置状态: 鼠标|画板
|
||||
const resetStatus = () => {
|
||||
if (toolStore.isToolWin) return // 已经打开过-忽略
|
||||
ipcMain?.removeHandler('tool-sphere:reset') // 避免已绑定,先移除在绑定
|
||||
ipcMain?.handle?.('tool-sphere:reset', () => {
|
||||
setTimeout(() => {
|
||||
boardVueRef.value.handleMode(tabActive.value)
|
||||
|
|
Loading…
Reference in New Issue