Compare commits
12 Commits
99ee438fd7
...
be222a2ba6
Author | SHA1 | Date |
---|---|---|
yangws | be222a2ba6 | |
lyc | b922219602 | |
lyc | 386c4e09c6 | |
zhengdegang | b738ade9a4 | |
zdg | 6f6d56b37b | |
zdg | c1f81a8e5c | |
lyc | d003ecf8ce | |
lyc | 146784bf26 | |
yangws | 88e63f376c | |
lyc | 2279bbb904 | |
lyc | b0d969546a | |
lyc | 8ec96996c6 |
|
@ -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": {
|
||||
|
|
|
@ -150,7 +150,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>
|
||||
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
<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>
|
||||
<!-- <i class="iconfont icon-xiangyou"></i>-->
|
||||
</div>
|
||||
<!-- 学科学段选择-->
|
||||
<template #dropdown>
|
||||
<div style="width: 300px;padding: 20px">
|
||||
<ThirdIndex @getVertion="getVertion"></ThirdIndex>
|
||||
|
@ -29,10 +30,12 @@ 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 titleName = ref('')
|
||||
//树结构的数据
|
||||
const treeData = ref([])
|
||||
// 默认展开的节点
|
||||
|
@ -158,16 +161,12 @@ const handleNodeClick = (data,node) => {
|
|||
}
|
||||
//缓存
|
||||
onMounted(() => {
|
||||
const info = localStorage.getItem('selectBookInfo')
|
||||
if(info){
|
||||
const {gradeName,subjectName} = JSON.parse(info)
|
||||
titleName.value = `${gradeName}-${subjectName}`
|
||||
}
|
||||
titleName.value = `${useStore.user.edustage}-${useStore.user.edusubject}`
|
||||
treeLoading.value = true
|
||||
})
|
||||
//监听数据变化
|
||||
watch(() => useThird,() => {
|
||||
titleName.value = `${useThird.gradeName}-${useThird.subjectName}`
|
||||
titleName.value = `${useStore.user.edustage}-${useStore.user.edusubject}`
|
||||
},{deep:true})
|
||||
|
||||
const defaultProps = {
|
||||
|
|
|
@ -14,10 +14,12 @@ 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(useThird.activeGrade || gradeList[0].value)
|
||||
const active = ref(1)
|
||||
//用来获取所有学科
|
||||
const subjectList = ref([])
|
||||
//用来获取学科的id
|
||||
|
@ -27,9 +29,17 @@ const handleClick = (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]
|
||||
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])
|
||||
}
|
||||
|
@ -44,21 +54,14 @@ const getTagId = (item) => {
|
|||
if(res.code === 200){
|
||||
emit('getVertion',res.data)
|
||||
useThird.getSelectBookInfo({...item,activeGrade:active.value,gradeName:gradeList[currentIndex].label})
|
||||
localStorage.setItem('selectBookInfo',JSON.stringify({...item,activeGrade:active.value,gradeName:gradeList[currentIndex].label}))
|
||||
}
|
||||
})
|
||||
}
|
||||
onMounted(() => {
|
||||
const currentIndex = gradeList.findIndex(item => item.label === useStore.user.edustage)
|
||||
//首次渲染获取
|
||||
handleClick(active.value)
|
||||
//查看是否缓存数据
|
||||
const info = localStorage.getItem('selectBookInfo')
|
||||
if(info){
|
||||
const {activeGrade,subjectId,subjectName} = JSON.parse(info)
|
||||
active.value = activeGrade
|
||||
//获取一次列表接口
|
||||
getTagId({subjectId:subjectId,subjectName:subjectName})
|
||||
}
|
||||
getSubject(gradeList[currentIndex].value)
|
||||
active.value = gradeList[currentIndex].value
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<template>
|
||||
<template v-for="item in subjectList" :key="item.subjectId">
|
||||
<el-tag
|
||||
type="primary"
|
||||
:type="useStore.user.edusubject === item.subjectName && useStore.user.edustage === item.gradeName ? 'primary' : 'info'"
|
||||
effect="dark"
|
||||
round
|
||||
style="cursor: pointer;margin-right: 5px;margin-top: 5px;"
|
||||
@click="clickTag(item)"
|
||||
class="tagItem"
|
||||
:style="useStore.user.edusubject === item.subjectName && useStore.user.edustage === item.gradeName ? {'cursor': 'pointer'} : {'cursor': 'no-Drop'}"
|
||||
>
|
||||
{{ item.subjectName }}
|
||||
</el-tag>
|
||||
|
@ -13,6 +13,8 @@
|
|||
</template>
|
||||
|
||||
<script setup name="selectSubject">
|
||||
import useUserStore from "@/store/modules/user";
|
||||
const useStore = useUserStore()
|
||||
const props = defineProps({
|
||||
subjectList: {
|
||||
type: Array,
|
||||
|
@ -20,11 +22,14 @@ const props = defineProps({
|
|||
}
|
||||
})
|
||||
const emit = defineEmits(['clickTag'])
|
||||
const clickTag = (item) => {
|
||||
emit('clickTag',item)
|
||||
}
|
||||
// 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>
|
|
@ -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>
|
|
@ -169,12 +169,12 @@ 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
|
||||
})
|
||||
}
|
||||
|
|
|
@ -88,6 +88,10 @@ export const gradeList = [
|
|||
]
|
||||
//课件类别
|
||||
export const coursewareTypeList = [
|
||||
{
|
||||
label:'全部',
|
||||
value:''
|
||||
},
|
||||
{
|
||||
label:'课件',
|
||||
value:3
|
||||
|
|
|
@ -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,10 +486,6 @@ export default {
|
|||
this.isLoading = false
|
||||
})
|
||||
},
|
||||
closeHomework() {
|
||||
this.setDialog = false
|
||||
},
|
||||
|
||||
// 打开PDF-课件
|
||||
async navtoPdf() {
|
||||
// if (toolStore.isPdfWin) return this.$message.error('您当前已打开课本,请勿重复操作')
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import {watch,ref} from 'vue'
|
||||
import {watch,ref,onMounted} from 'vue'
|
||||
import useResoureStore from '../store'
|
||||
import {coursewareTypeList} from '@/utils/resourceDict'
|
||||
const isThird = ref(false)
|
||||
|
@ -71,6 +71,9 @@ 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
|
||||
|
|
|
@ -69,7 +69,7 @@ export default defineStore('resource', {
|
|||
bookId:0,
|
||||
stage:0,
|
||||
subjectId:0,
|
||||
type:3,
|
||||
type:'',
|
||||
title:''
|
||||
},
|
||||
result: {
|
||||
|
|
|
@ -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,13 +73,12 @@
|
|||
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, ipcMsgInvoke } 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'
|
||||
|
@ -97,11 +96,9 @@ const dataList = ref([])
|
|||
const setDialog = ref(false)
|
||||
// 资源数据
|
||||
const resourceList = ref([])
|
||||
|
||||
//
|
||||
//当前点击的数据
|
||||
const curRow = ref('')
|
||||
|
||||
|
||||
const sendHomework = (row) => {
|
||||
curRow.value = row
|
||||
setTimeout(() => {
|
||||
|
@ -112,12 +109,13 @@ const sendHomework = (row) => {
|
|||
//
|
||||
const closeHomework = async() => {
|
||||
ipcMsgSend('tool-sphere:set:ignore', true)
|
||||
// 发送im消息-推送作业(app|平板)
|
||||
await ipcMsgInvoke('im-chat:msg', curRow.value.id, MsgEnum.HEADS.MSG_0016)
|
||||
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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
<template>
|
||||
<div v-if="props.test">
|
||||
<el-button type="primary" @click="trigger">点赞</el-button>
|
||||
<el-button type="primary" @click="trigger(1, '学生A')">疑惑</el-button>
|
||||
<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 ref="warpRef" class="c-warp">
|
||||
<!-- 温度计-模式 -->
|
||||
<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>
|
||||
|
@ -19,29 +25,46 @@
|
|||
</slot>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<script setup>
|
||||
// 功能说明:动画-点赞
|
||||
import { ref, nextTick, useSlots, reactive } from 'vue'
|
||||
import {Star} from '@element-plus/icons-vue'
|
||||
const warpRef = ref(null)
|
||||
const props = defineProps({ test: Boolean, def: Boolean })
|
||||
const slots = useSlots() // 获取插槽
|
||||
let iconCache = reactive({list:[]}) // 图标缓存
|
||||
const isSlot = !!Object.keys(slots).length // 是否使用了插槽
|
||||
// === 触发 type 1 疑惑 def 点赞 ===
|
||||
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 } // 兼容
|
||||
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)
|
||||
})
|
||||
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, tipEl, type) => {
|
||||
|
@ -95,7 +118,31 @@ const animInit = (el, tipEl, type) => {
|
|||
}
|
||||
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 || '')
|
||||
// 重置缓存列表
|
||||
|
@ -107,7 +154,7 @@ const resetIconCache = () => {
|
|||
const getRandomIcon = (type) => {
|
||||
let iconArr = []
|
||||
switch (type) {
|
||||
case 1: // 阿里icon-疑惑
|
||||
case 2: // 阿里icon-疑惑
|
||||
iconArr = ['yiwen', 'a-yiwen', 'yihuo', 'yiwen-01']
|
||||
break
|
||||
default:
|
||||
|
@ -132,11 +179,28 @@ 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;
|
||||
|
@ -179,4 +243,31 @@ defineExpose({ trigger })
|
|||
}
|
||||
}
|
||||
}
|
||||
// 温度计-模式
|
||||
.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,9 +79,10 @@ const btnList = [ // 工具栏按钮列表
|
|||
]
|
||||
// === 页面加载完毕 ===
|
||||
onMounted(async() => {
|
||||
getClassInfo() // 获取课堂详情 ex3
|
||||
if (!electron) return // 浏览器端
|
||||
getClassInfo() // 获取课堂详情 ex3
|
||||
setTimeout(() => {
|
||||
resetStatus() // 开启重置状态-监听
|
||||
resetStatus() // 开启重置状态-监听
|
||||
}, 200);
|
||||
})
|
||||
|
||||
|
@ -130,7 +132,7 @@ const chatChange = (type, data, ...args) => {
|
|||
case MsgEnum.HEADS.MSG_0002: // 疑惑
|
||||
// console.log('点赞:', data)
|
||||
if(msgIds.includes(msgId)) return // 忽略重复-点赞消息
|
||||
upvoteRef.value.trigger(data.name) // 触发点赞|疑惑
|
||||
upvoteRef.value.trigger(head, data.name) // 触发点赞|疑惑
|
||||
if (msgIds.length >= 100) msgIds.shift() // 删除第一个
|
||||
msgIds.push(msgId) // 添加到数组
|
||||
break
|
||||
|
|
Loading…
Reference in New Issue