课堂点名

This commit is contained in:
zdg 2025-01-08 16:48:31 +08:00
parent c2a3ffb0a0
commit dbaf861bef
6 changed files with 107 additions and 10 deletions

View File

@ -0,0 +1,3 @@
<svg style="width: 1em;height: 1em;vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6511">
<path d="M512 34.133333c263.466667 0 477.866667 214.4 477.866667 477.866667S775.466667 989.866667 512 989.866667 34.133333 775.466667 34.133333 512 248.533333 34.133333 512 34.133333M512 0C229.333333 0 0 229.333333 0 512s229.333333 512 512 512 512-229.333333 512-512S794.666667 0 512 0z" fill="#87C1FF" p-id="6512"></path><path d="M505.173333 611.62666667c100.053333 0 181.333333-80.64 181.333334-180.053333 0-99.2-81.28-180.053333-181.333334-180.053334-100.053333 0-181.333333 80.64-181.333333 180.053334s81.28 180.053333 181.333333 180.053333zM579.84 661.54666667h-135.893333c-126.293333 0-229.12 102.4-229.12 228.053333v13.44c0 65.706667 101.12 65.706667 229.12 65.706667h135.893333c122.88 0 229.12 0 229.12-65.706667v-13.44c0-125.653333-102.826667-228.053333-229.12-228.053333z" fill="#87C1FF" p-id="6513"></path>
</svg>

After

Width:  |  Height:  |  Size: 1006 B

View File

@ -47,9 +47,10 @@
<IconListView class="tool-btn" v-tooltip="'演讲者视图'" @click="changeViewMode('presenter')" />
<IconOffScreenOne class="tool-btn" v-tooltip="'退出全屏'" v-if="fullscreenState" @click="manualExitFullscreen()" />
<IconFullScreenOne class="tool-btn" v-tooltip="'进入全屏'" v-else @click="enterFullscreen()" />
<Hands class="tool-btn" v-if="classcourse" v-tooltip="'课堂点名'" @click="ToolHandle('named')" />
<Share class="tool-btn" v-if="classcourse" v-tooltip="'分享'" @click="ShareCode()" />
<IconPower class="tool-btn" v-if="!classcourse" v-tooltip="'结束放映'" @click="exitScreening()" />
<IconPower class="tool-btn" v-else v-tooltip="'结束课堂'" @click="exitCourse()" size="30" fill="#d0021b" strokeLinecap="butt" />
<Share class="tool-btn" v-if="classcourse" v-tooltip="'分享'" @click="ShareCode()" />
</div>
<div :class="['tools-icon',{opacity:iconHide}]" @click.stop="toolTrigger('icon')">
<circle-double-down v-if="rightToolsVisible" theme="outline" size="30" fill="#409EFF"/>
@ -76,8 +77,8 @@ import WritingBoardTool from './WritingBoardTool.vue'
import CountdownTimer from './CountdownTimer.vue'
import emitter from '@/utils/mitt';
import Chat from '../../api/chat' //
import { CircleDoubleDown, CircleDoubleUp, Share } from '@icon-park/vue-next' // icon-park
import { ShareCode } from '@/utils/ppt' // ppt
import { CircleDoubleDown, CircleDoubleUp, Share, Hands } from '@icon-park/vue-next' // icon-park
import { ShareCode, ToolHandle } from '@/utils/ppt' // ppt
const props = defineProps<{
changeViewMode: (mode: 'base' | 'presenter') => void

View File

@ -10,7 +10,10 @@
<IconOffScreenOne class="tool-icon" v-else />
<span>{{ fullscreenState ? '退出全屏' : '全屏' }}</span>
</div>
<div class="tool-btn" @click="ShareCode()"><Share class="tool-icon" /><span>分享</span></div>
<template v-if="classcourse">
<div class="tool-btn" @click="ToolHandle('named')"><Hands class="tool-icon" /><span>课堂点名</span></div>
<div class="tool-btn" @click="ShareCode()"><Share class="tool-icon" /><span>分享</span></div>
</template>
<Divider class="divider" />
<div class="tool-btn" v-if="!classcourse" @click="exitScreening()"><IconPower class="tool-icon" /><span>结束放映</span></div>
<div class="tool-btn" v-else @click="exitCourse()" size="30" fill="#d0021b" strokeLinecap="butt"><IconPower class="tool-icon" /><span>结束课堂</span></div>
@ -79,7 +82,7 @@
</template>
<script lang="ts" setup>
import { Share } from '@icon-park/vue-next' // icon-park
import { Share, Hands } from '@icon-park/vue-next' // icon-park
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
import { storeToRefs } from 'pinia'
import { useSlidesStore, useClasscourseStore } from '../../store'
@ -99,7 +102,7 @@ import CountdownTimer from './CountdownTimer.vue'
import Divider from '../../components/Divider.vue'
import emitter from '@/utils/mitt';
import Chat from '../../api/chat' //
import { ShareCode } from '@/utils/ppt' // ppt
import { ShareCode, ToolHandle } from '@/utils/ppt' // ppt
const props = defineProps<{
changeViewMode: (mode: 'base' | 'presenter') => void

View File

@ -4,8 +4,7 @@
<PresenterView :changeViewMode="changeViewMode" v-else-if="viewMode === 'presenter'" />
<!-- 点赞组件 -->
<upvote-vue ref="upvoteRef" type="2"></upvote-vue>
<!-- <div style="z-index: 999;position: absolute;top:10px">
</div> -->
<!-- 推图上屏弹窗 -->
<el-dialog
v-model="dialogVisible"
@ -15,7 +14,7 @@
:show-close="false"
>
<grid-pic ref="gridPicRef" style="height:100%;" @clear="clearchidrenPic"></grid-pic>
</el-dialog>
</el-dialog>
</div>
</template>

View File

@ -114,4 +114,16 @@ export function getShareCode(id) {
data: { id }
})
}
/**
* 课堂点名
* @param {*} timgroupid 群id
* @returns
*/
export function rollCall(timgroupid) {
return request({
url: '/education/classcourse/roll/call',
method: 'post',
data: { timgroupid }
})
}

View File

@ -1,5 +1,5 @@
/**
* ppt 转换为图片
* ppt 相关方法
*/
import { h, render, getCurrentInstance } from 'vue'
import { toPng, toJpeg } from 'html-to-image' // 引入html-to-image库
@ -8,6 +8,7 @@ import ThumbnailSlide from '@/AixPPTist/src/views/components/ThumbnailSlide/inde
import { useSlidesStore } from '@/AixPPTist/src/store'
import * as ElementPlus from 'element-plus'
import { sessionStore } from '@/utils/store' // electron-store 状态管理
import { getStaticUrl } from '@/utils/tool' // 工具类
import * as Http_Classcourse from '@/api/teaching/classcourse' // api接口
// 延时
@ -128,4 +129,82 @@ export const ShareCode = async(code, cb) => {
} else done()
}
}).catch(() => {})
}
/**
* 提示框
* @param {*} msg 内容
* @param {*} title 标题
* @param {*} option 配置
* @param {*} cb 关闭前回调 ({ h, instance, action, done }, done)
* @returns
*/
export const Alert = async (msg, title, option, cb) => {
try {
if (typeof msg == 'function') msg = await msg(h)
return await ElementPlus.ElMessageBox.alert(msg, title, {
confirmButtonText: '确认',
cancelButtonText: '关闭',
showCancelButton: true,
beforeClose: (action, instance, done) => {
if (action == 'confirm') { // 确认
if (!!cb) { // 回调
cb({ h, instance, action, done }, done) && done()
} else { // 默认确认
done()
}
} else done()
},
...option,
})
} catch { }
}
/**
* 课堂工具栏-钩子
*/
export const ToolType = {
/** 分享码 */
SHARE_CODE: 'shareCode',
/** 课堂点名 */
NAMED: 'named',
}
export const ToolHandle = async(type, data, cb) => {
const classcourse = sessionStore.get('curr.classcourse') // 课堂信息
switch (type) {
case ToolType.SHARE_CODE:
return ShareCode(data, cb)
case ToolType.NAMED: {
if (!classcourse) return ElementPlus.ElMessage.warning('没有课堂信息!')
const avatar = getStaticUrl('/icon/avatar.svg')
const timgroupid = classcourse.timgroupid
if (!timgroupid) return ElementPlus.ElMessage.warning('没有课堂群信息!')
// 课堂点名
const res = await Http_Classcourse.rollCall(timgroupid)
if (!(res && res.code == 200 && res.data)) return ElementPlus.ElMessage.warning('点名失败!')
const userList = res?.data || []
const refresh = () => { ToolHandle(ToolType.NAMED); return true }
Alert(h => {
const attr_0 = {style:{display:'flex',gap:'10px', cursor:'pointer'}}
const attr_1 = { style:{display:'inline-flex',alignItems:'center',gap:'10px',padding:'5px 10px'}}
const attr_2 = { src: avatar, style: { width: '50px', height: '50px' }}
const attr_3 = { style: { fontSize: '20px', fontWeight: 'bold', color: '#409EFF' }}
const attr_4 = { style: { fontSize: '12px' }}
const userList_H = userList.map(o => {
attr_1.title = o.name
attr_4.style.color = o.online ? '#67C23A' : '#F56C6C'
return h('div', attr_1, [
h('img', attr_2),
h('div', [
h('p', attr_3, o.name),
h('span', attr_4, o.online?'在线':'离线')
])
])
})
return h('div', attr_0, userList_H)
}, '课堂点名', { confirmButtonText: '刷新' }, refresh)
break;
}
default:
break
}
}