Compare commits
18 Commits
46adf4c058
...
7ae8547d41
Author | SHA1 | Date |
---|---|---|
baigl | 7ae8547d41 | |
zhengdegang | c5c28b4bf5 | |
zdg | 67d7395c47 | |
zdg | f615efbd88 | |
zdg | 741e7336f3 | |
朱浩 | a67f801356 | |
朱浩 | 1c89217fbf | |
朱浩 | 3a20f453c6 | |
朱浩 | dfa5c7d99b | |
lyc | e144fbe36a | |
lyc | b279d36c89 | |
lyc | 8013b1c2cc | |
baigl | 610aac6985 | |
朱浩 | 502cf13168 | |
朱浩 | a4fa5be295 | |
zhangxuelin | 0fa3c84f5e | |
zhangxuelin | 490536654a | |
zhangxuelin | 2efb870a16 |
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "aix-win",
|
||||
"version": "1.2.2",
|
||||
"version": "1.2.3",
|
||||
"description": "An Electron application with Vue",
|
||||
"main": "./out/main/index.js",
|
||||
"author": "example.com",
|
||||
|
@ -49,6 +49,7 @@
|
|||
"pinia": "^2.1.7",
|
||||
"pinia-plugin-persistedstate": "^3.2.1",
|
||||
"spark-md5": "^3.0.2",
|
||||
"vue-qr": "^4.0.9",
|
||||
"vue-router": "^4.4.0",
|
||||
"xgplayer": "^3.0.19",
|
||||
"xlsx": "^0.18.5"
|
||||
|
|
|
@ -224,7 +224,7 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
|||
formData.append(key, uploadData[key])
|
||||
}
|
||||
}
|
||||
formData.append('fileFlag', '教案')
|
||||
formData.append('fileFlag', '课件')
|
||||
uploadFileByFS({
|
||||
url: uploadUrl,
|
||||
path,
|
||||
|
|
|
@ -68,7 +68,7 @@ function createLoginWindow() {
|
|||
function createMainWindow() {
|
||||
mainWindow = new BrowserWindow({
|
||||
width: 1200,
|
||||
minWidth: 1200,
|
||||
minWidth: 1350,
|
||||
height: 700,
|
||||
show: false,
|
||||
frame: false, // 无边框
|
||||
|
@ -133,7 +133,7 @@ async function createLinkWin(data) {
|
|||
contextIsolation: true
|
||||
}
|
||||
})
|
||||
linkWin[data.key].type = 'link' // 唯一标识
|
||||
linkWin[data.key].type = 'link'+data.key // 唯一标识
|
||||
|
||||
let cookieDetails = { ...data.cookieData }
|
||||
await linkWin[data.key].webContents.session.cookies
|
||||
|
@ -142,9 +142,9 @@ async function createLinkWin(data) {
|
|||
.catch((error) => {})
|
||||
data.fullPath = data.fullPath.replaceAll('//', '/')
|
||||
if (data.fullPath.indexOf('?') !== -1) {
|
||||
data.fullPath += '&urlSource=smarttalk'
|
||||
data.fullPath += '&urlSource=smarttalk&t' + Date.now()
|
||||
}else {
|
||||
data.fullPath += '?urlSource=smarttalk'
|
||||
data.fullPath += '?urlSource=smarttalk&t' + Date.now()
|
||||
}
|
||||
linkWin[data.key].loadURL(data.fullPath)
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
|
@ -0,0 +1,89 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询classcourse列表
|
||||
export function listClasscourse(query) {
|
||||
return request({
|
||||
url: '/education/classcourse/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询classcourse详细
|
||||
export function getClasscourse(id) {
|
||||
return request({
|
||||
url: '/education/classcourse/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增classcourse
|
||||
export function addClasscourse(data) {
|
||||
return request({
|
||||
url: '/education/classcourse',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 新增classcourse
|
||||
export function addClasscourseReturnId(data) {
|
||||
return request({
|
||||
url: '/education/classcourse/saveReturnId',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改classcourse
|
||||
export function updateClasscourse(data) {
|
||||
return request({
|
||||
url: '/education/classcourse',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除classcourse
|
||||
export function delClasscourse(id) {
|
||||
return request({
|
||||
url: '/education/classcourse/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 删除classcourse
|
||||
export function delClasscourseWithData(id) {
|
||||
return request({
|
||||
url: '/education/classcourse/removeData/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// classcourse开始上课
|
||||
export function startCourseTeaching(id) {
|
||||
return request({
|
||||
url: '/education/classcourse/startCourseTeaching/'+id,
|
||||
method: 'post',
|
||||
})
|
||||
}
|
||||
|
||||
// 老师学生发送新的消息
|
||||
export function sendCourseTeachingMsg(data) {
|
||||
return request({
|
||||
url: '/education/classcourse/sendCourseTeachingMsg',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 老师学生获取新的交互消息
|
||||
export function getCourseTeachingMsg(id) {
|
||||
return request({
|
||||
url: '/education/classcourse/getCourseTeachingMsg/'+id,
|
||||
method: 'post',
|
||||
})
|
||||
}
|
||||
|
|
@ -104,11 +104,16 @@ const getSubjectContent = async () => {
|
|||
pageSize: 10000
|
||||
}
|
||||
|
||||
let data;
|
||||
const { rows } = await listEvaluation(params)
|
||||
localStorage.setItem('evaluationList', JSON.stringify(rows))
|
||||
evaluationList.value = rows
|
||||
data = rows
|
||||
|
||||
if(localStorage.getItem('evaluationList')){
|
||||
evaluationList.value = JSON.parse(localStorage.getItem('evaluationList'))
|
||||
}
|
||||
else{
|
||||
const { rows } = await listEvaluation(params)
|
||||
localStorage.setItem('evaluationList', JSON.stringify(rows))
|
||||
evaluationList.value = rows
|
||||
}
|
||||
|
||||
treeLoading.value = false
|
||||
|
||||
//获取教材版本
|
||||
|
@ -263,12 +268,16 @@ const transData = (data) => {
|
|||
|
||||
//获取教材
|
||||
const getSubject = async () => {
|
||||
if(localStorage.getItem('subjectList')){
|
||||
subjectList.value = JSON.parse(localStorage.getItem('subjectList'))
|
||||
}
|
||||
else{
|
||||
const { rows } = await listEvaluation({ itemkey: "version", edusubject, edustage, pageSize: 10000,orderby: 'orderidx asc', })
|
||||
|
||||
const { rows } = await listEvaluation({ itemkey: "version", edusubject, edustage, pageSize: 10000,orderby: 'orderidx asc', })
|
||||
|
||||
// subjectList.value = rows.filter(item => item.edustage == edustage && item.edusubject == edusubject)
|
||||
subjectList.value = rows
|
||||
localStorage.setItem('subjectList', JSON.stringify(subjectList.value))
|
||||
// subjectList.value = rows.filter(item => item.edustage == edustage && item.edusubject == edusubject)
|
||||
subjectList.value = rows
|
||||
localStorage.setItem('subjectList', JSON.stringify(subjectList.value))
|
||||
}
|
||||
|
||||
// 默认第一个
|
||||
if(!subjectList.value.length) return
|
||||
|
|
|
@ -0,0 +1,209 @@
|
|||
<template>
|
||||
<!-- 表单-组件(自定义) -->
|
||||
<slot>
|
||||
<el-row v-bind="rows||{}">
|
||||
<!-- 其他内容-start -->
|
||||
<slot name="start"></slot>
|
||||
<el-form :model="form" ref="form" @submit.native.prevent
|
||||
v-bind="option||{}"
|
||||
:status-icon="option.isIcon" :inline-message="option.inlineMsg"
|
||||
:label-width="option.labelW" :label-position="option.labelP" :label-suffix="option.labelS">
|
||||
<!-- 内容区 -->
|
||||
<template v-for="(item, index) in itemFields">
|
||||
<slot :name="'cols_'+item.prop" :row="item" :index="index" :prop="item.prop">
|
||||
<el-col :span="colsFn(item,'span')" :offset="colsFn(item,'offset')" :push="colsFn(item,'push')" :pull="colsFn(item,'pull')"
|
||||
:xs="colsFn(item,'xs')" :sm="colsFn(item,'sm')" :md="colsFn(item,'md')" :lg="colsFn(item,'lg')" :xl="colsFn(item,'xl')"
|
||||
:tag="colsFn(item,'tag')" :key="index" :style="item.style">
|
||||
<!-- slot可自定义-元素 默认input -->
|
||||
<slot :name="item.prop" :row="item" :index="index" :prop="item.prop" :form="form">
|
||||
<el-form-item :label="item.label" :prop="item.prop" :label-width="item.labelW"
|
||||
:required="item.required" :rules="item.rules" :error="item.error"
|
||||
:show-message="item.showMsg" :inline-message="item.inlineMsg" :size="item.size">
|
||||
<!-- slot可自定义-item内部 单个 -->
|
||||
<slot :name="'item_'+item.prop" :row="item" :index="index" :value="form[item.prop]" :prop="item.prop" :form="form">
|
||||
<!-- slot可自定义-item内部 所有 -->
|
||||
<slot name="input" :row="item" :index="index" :value="form[item.prop]" :prop="item.prop" :form="form">
|
||||
<el-input v-model="form[item.prop]" v-bind="item.inputOpt||{}"
|
||||
@keyup.enter.native="handle(item, $event)" v-on="item.on||{}">
|
||||
<!-- slot自定义-输入框头部内容 单个 -->
|
||||
<template #prefix v-if="slotKeys.includes(`prefix_${item.prop}`)"><slot :name="'prefix_'+item.prop"></slot></template>
|
||||
<!-- slot自定义-输入框尾部内容 单个 -->
|
||||
<template #suffix v-if="slotKeys.includes(`suffix_${item.prop}`)"><slot :name="'suffix_'+item.prop"></slot></template>
|
||||
<!-- slot自定义-输入框前置内容 单个 -->
|
||||
<template #prepend v-if="slotKeys.includes(`prepend_${item.prop}`)"><slot :name="'prepend_'+item.prop"></slot></template>
|
||||
<!-- slot自定义-输入框后置内容 单个 -->
|
||||
<template #append v-if="slotKeys.includes(`append_${item.prop}`)"><slot :name="'append_'+item.prop"></slot></template>
|
||||
|
||||
<!-- slot自定义-输入框头部内容 所有 -->
|
||||
<template #prefix v-if="slotKeys.includes(`prefix`)"><slot :name="'prefix_'+item.prop"></slot></template>
|
||||
<!-- slot自定义-输入框尾部内容 所有 -->
|
||||
<template #suffix v-if="slotKeys.includes(`suffix`)"><slot :name="'suffix_'+item.prop"></slot></template>
|
||||
<!-- slot自定义-输入框前置内容 所有 -->
|
||||
<template #prepend v-if="slotKeys.includes(`prepend`)"><slot :name="'prepend_'+item.prop"></slot></template>
|
||||
<!-- slot自定义-输入框后置内容 所有 -->
|
||||
<template #append v-if="slotKeys.includes(`append`)"><slot :name="'append_'+item.prop"></slot></template>
|
||||
</el-input>
|
||||
</slot>
|
||||
</slot>
|
||||
<!-- slot自定义-标签文本的内容 单个 -->
|
||||
<template #label v-if="slotKeys.includes(`label_${item.prop}`)">
|
||||
<slot :name="'label_'+item.prop" :row="item" :index="index" :prop="item.prop"></slot>
|
||||
</template>
|
||||
<!-- slot自定义-标签文本的内容 所有 -->
|
||||
<template #label v-if="slotKeys.includes(`label`)">
|
||||
<slot name="label" :row="item" :index="index" :prop="item.prop"></slot>
|
||||
</template>
|
||||
|
||||
<!-- slot自定义-自定义表单校验信息的显示方式 单个 -->
|
||||
<template #error="{error}" v-if="slotKeys.includes(`error_${item.prop}`)">
|
||||
<slot :name="'error_'+item.prop" :row="item" :index="index" :prop="item.prop" :error="error"></slot>
|
||||
</template>
|
||||
<!-- slot自定义-自定义表单校验信息的显示方式 所有 -->
|
||||
<template #error="{error}" v-if="slotKeys.includes(`error`)">
|
||||
<slot name="error" :row="item" :index="index" :prop="item.prop" :error="error"></slot>
|
||||
</template>
|
||||
|
||||
</el-form-item>
|
||||
</slot>
|
||||
</el-col>
|
||||
</slot>
|
||||
</template>
|
||||
<!-- 其他内容 -->
|
||||
<slot name="add"></slot>
|
||||
<!-- 提交 -->
|
||||
<slot name="submit" :formRef="$refs.form">
|
||||
<div class="subBtn" v-if="btnDef" :style="btnStyle">
|
||||
<el-button type="primary" size="small" @click="confirm" :loading="btnLoad">{{btnText}}</el-button>
|
||||
</div>
|
||||
</slot>
|
||||
</el-form>
|
||||
<!-- 其他内容-end -->
|
||||
<slot name="end"></slot>
|
||||
</el-row>
|
||||
</slot>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'cForm',
|
||||
props: {
|
||||
form: { // 数据 form
|
||||
type: Object,
|
||||
default: _ => { return {} }
|
||||
},
|
||||
option: { // 配置
|
||||
type: Object,
|
||||
default: _ => {
|
||||
return { labelW: '80px' }
|
||||
}
|
||||
},
|
||||
itemOption: { // item配置
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
rows: { // 行 layout布局
|
||||
type: Object,
|
||||
default: _ => { return {} }
|
||||
},
|
||||
cols: { // 列 layout布局
|
||||
type: Object,
|
||||
default: _ => { return {} }
|
||||
},
|
||||
// onEnter: Function, // 默认回车
|
||||
onEnter: {
|
||||
type: Function,
|
||||
default: () => {}
|
||||
},
|
||||
btnText: { // 文本
|
||||
type: String,
|
||||
default: '确 定'
|
||||
},
|
||||
btnDef: Boolean, // 默认提交-按钮
|
||||
btnStyle: String, // 按钮样式css
|
||||
btnLoad: Boolean, // 加载load
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
slotKeys: [] // 外部自定义插槽
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
itemFields() {
|
||||
return this.itemOption
|
||||
.filter(o => o.show !== false)
|
||||
.map(o => {
|
||||
for (const key in o) {
|
||||
const inputOpt = {placeholder:'请输入'}
|
||||
if (key.startsWith('i')) {
|
||||
const newKey = key.substring(1)
|
||||
inputOpt[newKey] = o[key]
|
||||
delete o[key]
|
||||
}
|
||||
o.inputOpt = inputOpt
|
||||
return o
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
window.test = this
|
||||
this.slotKeys = Object.keys(this.$slots)
|
||||
},
|
||||
methods: {
|
||||
// 字段--cols属性
|
||||
colsFn(row, attr) {
|
||||
const cols = row.cols || this.cols
|
||||
return cols[attr]
|
||||
},
|
||||
// input -- 回车事件
|
||||
handle(row, e) {
|
||||
const onEnter = row.onEnter || this.onEnter
|
||||
if (row.prop) onEnter(row, e)
|
||||
},
|
||||
// 确定--提交
|
||||
confirm() {
|
||||
const formRefs = this.$refs.form
|
||||
this.$emit('confirm', formRefs)
|
||||
},
|
||||
// 重置
|
||||
resetFields() {
|
||||
this.$refs.form.resetFields()
|
||||
},
|
||||
// 清除
|
||||
clearValidate(props) {
|
||||
this.$refs.form.clearValidate(props)
|
||||
},
|
||||
// 检验-字段
|
||||
validateField(props, callback) {
|
||||
this.$refs.form.validateField(props, callback)
|
||||
},
|
||||
// 整个表单验证
|
||||
validate(callback) {
|
||||
return this.$refs.form.validate(callback)
|
||||
}
|
||||
},
|
||||
// filters: {
|
||||
// // 是否清除input内容-按钮
|
||||
// clearable_f(val) {
|
||||
// return val == null ? true : val
|
||||
// }
|
||||
// }
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.subBtn{
|
||||
float: left;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
.el-form {
|
||||
width: 100%;
|
||||
}
|
||||
.el-form--inline > .el-col {
|
||||
width: auto;
|
||||
display: inline-block;
|
||||
float: unset;
|
||||
}
|
||||
.el-form-item .el-input{
|
||||
vertical-align: bottom;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,64 @@
|
|||
|
||||
/**
|
||||
* 使用-批量导入--方式
|
||||
*/
|
||||
|
||||
// 导入 import.meta.glob 用于获取所有符合要求的 .vue 文件
|
||||
const files = import.meta.glob('./!(index).vue', { eager: true });
|
||||
|
||||
export default {
|
||||
install(Vue, options) {
|
||||
Object.entries(files).forEach(([path, file]) => {
|
||||
const fileName = path.split('/').pop().replace(/\.\w+$/, '')
|
||||
// fileName == 'cDialog' && initDialog(Vue, file) // 弹窗--组件化
|
||||
Vue.component(fileName, file.default)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 弹窗--函数化
|
||||
function initDialog(Vue, dialog) {
|
||||
// 全局绑定
|
||||
Vue.prototype.$cDialog = (props) => {
|
||||
// props.dialog = Object.assign({ isOpen: true }, props.dialog) // 默认配置 propsData: option
|
||||
props.dialog.isOpen == null && (props.dialog.isOpen = true) // 默认打开
|
||||
props.isRemove == null && (props.isRemove = true) // 默认关闭后移除
|
||||
const Constructor = Vue.extend(dialog)
|
||||
const Instance = new Constructor({ propsData: props })
|
||||
props.slots && (Instance.$slots = props.slots) // 插槽内容
|
||||
props.scopedSlots && (Instance.$scopedSlots = props.scopedSlots) // 作用域插槽内容
|
||||
props.content && (Instance.$slots.default = props.content) // 插槽内容
|
||||
document.body.appendChild(Instance.$mount().$el)
|
||||
return Instance.showBox().then(v => {
|
||||
props.callback && props.callback(v)
|
||||
return Promise.resolve(v)
|
||||
}).catch(v => {
|
||||
props.callback && props.callback(v)
|
||||
// 移除弹窗
|
||||
props.isRemove && document.body.removeChild(Instance.$mount().$el)
|
||||
return Promise.reject(v)
|
||||
})
|
||||
}
|
||||
// 全局绑定2
|
||||
Vue.prototype.$cDialog2 = (props) => {
|
||||
// props.dialog = Object.assign({ isOpen: true }, props.dialog) // 默认配置 propsData: option
|
||||
props.dialog.isOpen == null && (props.dialog.isOpen = true) // 默认打开
|
||||
props.isRemove == null && (props.isRemove = true) // 默认关闭后移除
|
||||
const Constructor = Vue.extend(dialog)
|
||||
const Instance = new Constructor({ propsData: props })
|
||||
props.slots && (Instance.$slots = props.slots) // 插槽内容
|
||||
props.scopedSlots && (Instance.$scopedSlots = props.scopedSlots) // 作用域插槽内容
|
||||
props.content && (Instance.$slots.default = props.content) // 插槽内容
|
||||
document.body.appendChild(Instance.$mount().$el)
|
||||
Instance.showBox().then(v => {
|
||||
props.callback && props.callback(v)
|
||||
return Promise.resolve(v)
|
||||
}).catch(v => {
|
||||
props.callback && props.callback(v)
|
||||
// 移除弹窗
|
||||
props.isRemove && document.body.removeChild(Instance.$mount().$el)
|
||||
return Promise.reject(v)
|
||||
})
|
||||
return Instance
|
||||
}
|
||||
}
|
|
@ -34,7 +34,7 @@ const getFileTypeIcon = () => {
|
|||
gif: 'icon-gif',
|
||||
txt: 'icon-txt',
|
||||
rar: 'icon-rar',
|
||||
|
||||
apt: 'icon-lunwen'
|
||||
}
|
||||
if (iconObj[name]) {
|
||||
return '#' + iconObj[name]
|
||||
|
@ -47,4 +47,4 @@ const getFileTypeIcon = () => {
|
|||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style lang="scss" scoped></style>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
</div>
|
||||
</div> -->
|
||||
<transition mode="out-in" name="fade-transform">
|
||||
<div v-show="$route != null" style="height: 100%; flex: 1">
|
||||
<div v-show="$route != null" style="height: 100%; flex: 1;width: 100%">
|
||||
<router-view v-slot="{ Component, route }">
|
||||
<keep-alive>
|
||||
<component :is="Component" v-if="route.meta.keepAlive" :key="route.name" />
|
||||
|
|
|
@ -14,6 +14,7 @@ import { store } from '@/store'
|
|||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import log from 'electron-log/renderer' // 渲染进程日志-文件记录
|
||||
import customComponent from '@/components/common' // 自定义组件
|
||||
|
||||
if(process.env.NODE_ENV != 'development') { // 非开发环境,将日志打印到日志文件
|
||||
Object.assign(console, log.functions) // 渲染进程日志-控制台替换
|
||||
|
@ -37,4 +38,6 @@ app.config.globalProperties.$requestGetJYW = (url,config)=>{
|
|||
|
||||
app.use(router)
|
||||
.use(store)
|
||||
.use(ElementPlus, { locale: zhLocale }).mount('#app')
|
||||
.use(ElementPlus, { locale: zhLocale })
|
||||
.use(customComponent) // 自定义组件
|
||||
.mount('#app')
|
|
@ -173,6 +173,7 @@ export class ImChat {
|
|||
return this.timChat.TIMLogout().then(res => {
|
||||
this.setConsole('%cim-chat: logout', '登出成功')
|
||||
this.status.isLogin = false
|
||||
this.status.isConnect = false
|
||||
this.timChat.TIMUninit() // 反初始化
|
||||
return res
|
||||
}).catch(error => {
|
||||
|
|
|
@ -0,0 +1,312 @@
|
|||
|
||||
/**
|
||||
* @description 公共工具类
|
||||
* @author zdg
|
||||
* @date 2024-4-26
|
||||
*/
|
||||
|
||||
// ============= 文件工具--相关 ===================
|
||||
/**
|
||||
* 获取上传文件
|
||||
*/
|
||||
export function getFiles() {
|
||||
const cb = resolve => {
|
||||
const fileDom = document.createElement('input')
|
||||
fileDom.type = 'file'
|
||||
fileDom.onchange = e => {
|
||||
resolve(e.target.files)
|
||||
return fileDom.remove()
|
||||
}
|
||||
fileDom.click()
|
||||
}
|
||||
return new Promise(cb)
|
||||
}
|
||||
|
||||
// ============= 数学公式--相关 ===================
|
||||
/**
|
||||
* @description 计算两点直线距离 (获取直径)
|
||||
* (欧几里得距离公式): [ \text{distance} = \sqrt{(x2 - x1)^2 + (y2 - y1)^2} ]
|
||||
* @param {*} x1
|
||||
* @param {*} y1
|
||||
* @param {*} x2
|
||||
* @param {*} y2
|
||||
*/
|
||||
export function getDistance(x1,y1,x2,y2) {
|
||||
return Math.sqrt(Math.pow((x2 - x1), 2) + Math.pow((y2 - y1), 2))
|
||||
}
|
||||
// 获取半径
|
||||
export function getRadius(x1,y1,x2,y2) { return getDistance(x1,y1,x2,y2) / 2 }
|
||||
|
||||
/**
|
||||
* 计算某个值在总数中所占的百分比。
|
||||
*
|
||||
* 此函数用于根据给定的值和总数,计算该值占总数的百分比。它还支持指定百分比的小数位数。
|
||||
* 如果计算结果小于0,则返回0;如果大于100,则返回100,以确保百分比的合理范围。
|
||||
*
|
||||
* @param {number} v - 待计算的值。
|
||||
* @param {number} total - 总数。
|
||||
* @param {number} [step=2] - 百分比的小数位数,默认为2。
|
||||
* @returns {number} - 返回计算后的百分比,保证在0到100之间。
|
||||
*/
|
||||
export function getPercent(v, total, step=2) {
|
||||
!v && (v = 0)
|
||||
!total && (total = 1)
|
||||
// 计算百分比,保留指定的小数位,并转换为数字类型
|
||||
let res = (v / total * 100).toFixed(step)-0
|
||||
|
||||
// 确保百分比在0到100之间
|
||||
return res < 0 ? 0 : res > 100 ? 100 : res
|
||||
}
|
||||
|
||||
// ============= 格式化--相关 ===================
|
||||
|
||||
/**
|
||||
* @description 手机号隐藏中间几位
|
||||
* @param {*} phone 手机号
|
||||
* @param {*} start 前面保留几位 默认 3位
|
||||
* @param {*} end 后面保留几位 默认 3位
|
||||
* @param {*} rstr 替换字符 默认 ****
|
||||
* @returns
|
||||
*/
|
||||
export function phoneHideFormat(phone, start = 3, end = 4, rstr = '****') {
|
||||
// const reg = /^(\d{3})\d*(\d{4})$/
|
||||
if (!phone) return ''
|
||||
const reg = new RegExp(`(\\d\{${start}\})\\d*(\\d\{${end}\})`)
|
||||
return phone.replace(reg, `$1${rstr}$2`)
|
||||
}
|
||||
|
||||
// ============= 习题工具--相关 ===================
|
||||
/**
|
||||
* @description 将字符串转换为数组
|
||||
* @param {*} str
|
||||
* @returns
|
||||
*/
|
||||
export function quizStrToList(str = '') {
|
||||
if (!str) return []
|
||||
let resList = []
|
||||
if (isJson(str, true)) resList = JSON.parse(str) // 数组对象
|
||||
else if (str.includes('#&')) resList = str.split('#&') // 字符串数组 #&
|
||||
else if (str.includes(',')) resList = str.split(',') // 字符串数组 ,
|
||||
else resList = [str]
|
||||
return resList
|
||||
}
|
||||
|
||||
// ============= 常用工具--相关 ===================
|
||||
|
||||
export function isJson(str, isArray = false) {
|
||||
if(typeof str == 'string'){
|
||||
try {
|
||||
const res = JSON.parse(str)
|
||||
let isBool = typeof res == 'object' && res
|
||||
if(isBool && isArray) isBool = Array.isArray(res)
|
||||
return isBool
|
||||
} catch (error) {}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
//获取临时唯一ID
|
||||
export const generateUniqueID = ()=> {
|
||||
const date = new Date();
|
||||
const timestamp = date.getTime().toString(36); // 使用36进制转换时间戳
|
||||
const random = Math.random().toString(36).substring(2, 9); // 获取随机数的一部分并转换为36进制
|
||||
return timestamp + random;
|
||||
}
|
||||
|
||||
// 清理参数中的undefined、null
|
||||
export const removePropertyOf = function(obj){
|
||||
Object.keys(obj).forEach(item=>{
|
||||
if(obj[item] === undefined || obj[item] === null) delete obj[item]
|
||||
})
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除children 为空 -- tree
|
||||
*/
|
||||
export function removeTree(list) {
|
||||
var this_ = this
|
||||
for (var i in list) {
|
||||
if (list[i].children.length == 0) {
|
||||
list[i].children = undefined
|
||||
} else {
|
||||
this_.removeTree(list[i].children)
|
||||
}
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
// ============= 校验工具--相关 ===================
|
||||
|
||||
// url校验
|
||||
export const validateUrl = (url) => {
|
||||
const regex = /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/;
|
||||
if (!regex.test(url.trim())) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// ============= 时间工具--相关 ===================
|
||||
|
||||
/**
|
||||
* @description 时间 秒 转化 时分秒
|
||||
* @param {*} seconds
|
||||
* @returns
|
||||
*/
|
||||
export function formatTime(seconds) {
|
||||
seconds = parseInt(seconds) // 转换整数
|
||||
const h = (Math.floor(seconds / 3600)+'').padStart(2,'0')
|
||||
const m = (Math.floor((seconds % 3600) / 60)+'').padStart(2,'0')
|
||||
const s = ((seconds % 60)+'').padStart(2,'0')
|
||||
return `${h}:${m}:${s}`
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 时间格式化
|
||||
* @param {*} time
|
||||
* @param {*} fmt
|
||||
* @returns
|
||||
*/
|
||||
export function formatDate(time, fmt = 'yyyy-MM-dd') {
|
||||
let date
|
||||
if (time) {
|
||||
if (typeof time === 'object') {
|
||||
date = time
|
||||
} else {
|
||||
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
|
||||
time = parseInt(time)
|
||||
}
|
||||
if ((typeof time === 'number') && (time.toString().length === 10)) {
|
||||
time = time * 1000
|
||||
}
|
||||
date = new Date(time)
|
||||
}
|
||||
} else {
|
||||
date = new Date()
|
||||
}
|
||||
if (/(y+)/.test(fmt)) {
|
||||
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
|
||||
}
|
||||
const o = {
|
||||
'M+': date.getMonth() + 1,
|
||||
'd+': date.getDate(),
|
||||
'h+': date.getHours(),
|
||||
'm+': date.getMinutes(),
|
||||
's+': date.getSeconds(),
|
||||
'a': date.getDay()
|
||||
}
|
||||
for (const k in o) {
|
||||
if (new RegExp(`(${k})`).test(fmt)) {
|
||||
if (k === 'a') {
|
||||
const str = ['日', '一', '二', '三', '四', '五', '六'][o[k]]
|
||||
fmt = fmt.replace(RegExp.$1, str)
|
||||
continue
|
||||
}
|
||||
const str = o[k] + ''
|
||||
// fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : padLeftZero(str))
|
||||
fmt = fmt.replace(RegExp.$1, str.padStart(2, '0'))
|
||||
}
|
||||
}
|
||||
return fmt
|
||||
}
|
||||
/**
|
||||
* 快速获取日期
|
||||
* num: 1 今日 2 昨日 3 本周 4 上周 5 本月
|
||||
* bool: true 有时分秒 false | null 不要时分秒
|
||||
*/
|
||||
export function getDateStr(num, bool) {
|
||||
let now = new Date() // 当前日期
|
||||
let nowDayOfWeek = now.getDay() // 今天本周的第几天
|
||||
let nowDay = now.getDate() // 当前日
|
||||
let nowMonth = now.getMonth() // 当前月
|
||||
let nowYear = now.getYear() // 当前年
|
||||
nowYear += (nowYear < 2000) ? 1900 : 0 //
|
||||
let monthStartDate = new Date(nowYear, nowMonth, 1)
|
||||
let monthEndDate = new Date(nowYear, nowMonth + 1, 1)
|
||||
let days = (monthEndDate - monthStartDate) / (1000 * 60 * 60 * 24)
|
||||
|
||||
let fmt = 'yyyy-MM-dd'
|
||||
let startTime = ''
|
||||
let endTime = ''
|
||||
|
||||
if (num == 1) { // 今日
|
||||
startTime = formatDate(now, fmt)
|
||||
endTime = startTime
|
||||
}
|
||||
if (num == 2) { // 昨日
|
||||
now.setDate(nowDay - 1)
|
||||
startTime = formatDate(now, fmt)
|
||||
endTime = startTime
|
||||
}
|
||||
if (num == 3) { // 本周
|
||||
startTime = formatDate(new Date(nowYear, nowMonth, nowDay - nowDayOfWeek), fmt)
|
||||
endTime = formatDate(new Date(nowYear, nowMonth, nowDay + (6 - nowDayOfWeek)), fmt)
|
||||
}
|
||||
if (num == 4) { // 上周
|
||||
startTime = formatDate(new Date(nowYear, nowMonth, nowDay - nowDayOfWeek - 7), fmt)
|
||||
endTime = formatDate(new Date(nowYear, nowMonth, nowDay - nowDayOfWeek - 1), fmt)
|
||||
}
|
||||
if (num == 5) { // 本月
|
||||
startTime = formatDate(new Date(nowYear, nowMonth, 1), fmt)
|
||||
endTime = formatDate(new Date(nowYear, nowMonth, days), fmt)
|
||||
}
|
||||
if (num == 6) { // 本年
|
||||
startTime = formatDate(new Date(nowYear, 0, 1), fmt)
|
||||
endTime = formatDate(new Date(nowYear, 11, 31), fmt)
|
||||
}
|
||||
if (bool) {
|
||||
startTime += ' 00:00:00'
|
||||
endTime += ' 23:59:59'
|
||||
}
|
||||
return [startTime, endTime]
|
||||
}
|
||||
/**
|
||||
* 获取 昨天 今天 明天 一周前 一月前 1-5
|
||||
*/
|
||||
export function getDateStr1(num, fmt = 'yyyy-MM-dd hh:mm:ss') {
|
||||
const now = new Date() // 当前日期
|
||||
const curr = Date.now() // 当前时间戳
|
||||
if (num == 1) return formatDate(new Date(curr-(24*60*60*1000)),fmt) // 昨天
|
||||
else if (num == 2) return formatDate(now,fmt) // 今天
|
||||
else if (num == 3) return formatDate(new Date(curr+(24*60*60*1000)),fmt) // 明天
|
||||
else if (num == 4) return formatDate(new Date(curr-(7*24*60*60*1000)),fmt) // 一周前
|
||||
else if (num == 5) return formatDate(new Date(curr-(30*24*60*60*1000)),fmt) // 一月前
|
||||
return ''
|
||||
}
|
||||
/**
|
||||
* 获取当前 0:0:0:0 时间
|
||||
* @param {*} [fmt] 格式 'yyyy-MM-dd hh:mm:ss'
|
||||
*/
|
||||
export function getDateNow(fmt) {
|
||||
const date = new Date()
|
||||
date.setHours(0, 0, 0, 0)
|
||||
if (fmt) return formatDate(date, fmt)
|
||||
return date
|
||||
}
|
||||
/** 默认加上-时分秒 */
|
||||
export function toTimeStr(arr = ['','']) {
|
||||
return [`${arr[0]} 00:00:00`, `${arr[1]} 23:59:59`]
|
||||
}
|
||||
|
||||
/**
|
||||
* 秒转时分
|
||||
*/
|
||||
export function timeToStr(time,str = '时分秒', isPad = false) {
|
||||
let s = parseInt(time)
|
||||
let h = 0, m = 0 // 初始化时|分
|
||||
if (s >= 60) {
|
||||
// 如果秒数大于60,将秒数转换成整数
|
||||
m = parseInt(s / 60) // 获取分钟,除以60取整数,得到整数分钟
|
||||
s = parseInt(s % 60) // 获取秒数,秒数取佘,得到整数秒数
|
||||
if (m >= 60) { // 如果分钟大于60,将分钟转换成小时
|
||||
h = parseInt(m / 60) // 获取小时,获取分钟除以60,得到整数小时
|
||||
m = parseInt(m % 60) // 获取小时后取佘的分,获取分钟除以60取佘的分
|
||||
}
|
||||
}
|
||||
const toStr = v => v.toString().padStart(2, '0') // 转换字符
|
||||
const arr = str.split('')
|
||||
if (isPad) return `${h?toStr(h)+arr[0]:''}${m?toStr(m)+arr[1]:''}${toStr(s)}${arr[2]||''}`
|
||||
return `${h?h+arr[0]:''}${m?m+arr[1]:''}${s?s+arr[2]||'':''}`
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
import useUserStore from '@/store/modules/user'
|
||||
const baseConfig = () => {
|
||||
const userStore = useUserStore()
|
||||
export const baseConfig = (token) => {
|
||||
const userStore = token ? {} : useUserStore()
|
||||
return {
|
||||
// Electron 设置cookie
|
||||
url: import.meta.env.VITE_APP_BUILD_BASE_PATH,
|
||||
|
@ -8,7 +8,7 @@ const baseConfig = () => {
|
|||
//cookie 名称 这里为 token
|
||||
name: 'Admin-Token',
|
||||
//cookie 值
|
||||
value: userStore.token,
|
||||
value: token ? '' : userStore.token,
|
||||
// 域名
|
||||
domain: import.meta.env.VITE_APP_DOMAIN
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@ const Remote = isNode?require('@electron/remote'):{}
|
|||
const { ipcRenderer } = isNode?require('electron'):window.electron || {}
|
||||
const API = isNode?window.api:{} // preload-api
|
||||
import { useToolState } from '@/store/modules/tool' // 获取store状态
|
||||
// const Store = isNode?require('electron-store'):null // 持久化存储
|
||||
import store from './store'
|
||||
import { baseConfig } from './linkConfig' // 外部连接-配置
|
||||
// 常用变量
|
||||
const BaseUrl = isNode?process.env['ELECTRON_RENDERER_URL']+'/#':''
|
||||
const isDev = isNode?process.env.NODE_ENV !== 'production':''
|
||||
|
@ -297,6 +297,23 @@ const eventHandles = (type, win) => {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 外部跳转-web网页
|
||||
* @param {*} path
|
||||
* @param {*} params
|
||||
*/
|
||||
export const toLinkWeb = (path) => {
|
||||
const config = baseConfig()
|
||||
console.log(config)
|
||||
const fullPath = config.url + path
|
||||
// 通知主进程
|
||||
ipcRenderer.send('openWindow', {
|
||||
key: `win-${Date.now()}`,
|
||||
fullPath: fullPath,
|
||||
cookieData: { ...config }
|
||||
})
|
||||
}
|
||||
|
||||
// const taskHandles = () => {
|
||||
// // 设置任务栏上下文菜单
|
||||
// const contextMenu = new Remote.Menu()
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
destory-on-close
|
||||
:before-close="onBeforeClose"
|
||||
>
|
||||
<template #title>
|
||||
<template #header>
|
||||
<div style="font-size: 18px; display: flex; flex-wrap: nowrap">
|
||||
<div style="flex: 1">
|
||||
{{ classWorkAnalysis.title }}答题情况
|
||||
|
|
|
@ -0,0 +1,369 @@
|
|||
<template>
|
||||
<el-dialog v-model="visible" width="75%" :close-on-click-modal="false"
|
||||
@close="handleClose">
|
||||
<template #header><b>准备开始上课</b></template>
|
||||
<div class="class-all">
|
||||
<el-row>
|
||||
<el-col :span="10">
|
||||
<c-form v-bind="classForm">
|
||||
<template #item_classid="{prop, form}">
|
||||
<el-select v-model="form[prop]" placeholder="请选择班级">
|
||||
<el-option v-for="item in listData.classList" :value="item.id"
|
||||
:label="`${item.caption} (${item.classstudentcount}人)`" />
|
||||
</el-select>
|
||||
</template>
|
||||
<template #item_student>
|
||||
<el-scrollbar max-height="30em">
|
||||
<template v-for="(item, index) in listData.activeStudentList">
|
||||
<el-tag style="margin:0 7px 7px 0;cursor:default;">{{ item.name }}</el-tag>
|
||||
</template>
|
||||
</el-scrollbar>
|
||||
</template>
|
||||
</c-form>
|
||||
</el-col>
|
||||
<el-col :span="14">
|
||||
<c-form v-bind="teacherForm">
|
||||
<!-- 上课 -->
|
||||
<template #item_classcourseid="{prop,form}">
|
||||
<el-radio-group v-model="form[prop]">
|
||||
<el-radio :value="0">开始新课</el-radio>
|
||||
<template v-for="(item,index) in listData.classcourseList">
|
||||
<template v-if="dt.isCreate&&!index">
|
||||
<el-radio :value="item.id">{{ item.opendate }} <span style="color: silver">({{ item.teachername }})</span></el-radio>
|
||||
</template>
|
||||
<template v-else-if="dt.isHistory&&(dt.isCreate&&index||!dt.isCreate)">
|
||||
<el-radio :value="item.id">{{ item.opendate }} <span style="color: silver">({{ item.teachername }})</span></el-radio>
|
||||
</template>
|
||||
</template>
|
||||
<el-button class="absolute top-1 right-0" size="small" type="primary" round
|
||||
:plain="!dt.isHistory" @click="getClasscourseList('toggle')">历史记录</el-button>
|
||||
</el-radio-group>
|
||||
</template>
|
||||
<!-- 老师扫码 -->
|
||||
<template #item_qrUrl="{value}">
|
||||
<div :title="value" v-if="!!value">
|
||||
<vue-qr :text="value" :size="200" :margin="10" colorDark="green" colorLight="white" logoSrc="/img/logo.png" :logoScale="0.2" :dotScale="0.7"></vue-qr>
|
||||
</div>
|
||||
<el-button type="warning" :loading="dt.loadingDel" @click="removeClasscourse()">删除记录</el-button>
|
||||
</template>
|
||||
<!-- 手机登录 -->
|
||||
<template #item_mobile>
|
||||
<div>
|
||||
<div>开始新的课堂,需要点击先创建课堂,才能显示手机二维码</div>
|
||||
<el-button type="warning" :loading="dt.loading" @click="createClasscourse">创建课堂</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<!-- 故障备用 -->
|
||||
<template #item_backup>
|
||||
<div>
|
||||
<div>如果手机扫码后进入课堂,但本页面没自动跳转,请点击下面按钮</div>
|
||||
<el-button type="primary" plain @click="classTeachingStart">开始上课</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</c-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!-- im-chat 聊天组件 -->
|
||||
<im-chat ref="imChatRef" v-if="visible" @change="chatChange" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
// 功能说明:课程开始
|
||||
import { onMounted, reactive, ref, watchEffect, watch, nextTick } from 'vue' // vue
|
||||
import { ElMessage, ElMessageBox } from 'element-plus' // ui框架: 消息提示
|
||||
import vueQr from 'vue-qr/src/packages/vue-qr.vue' // 插件: 二维码
|
||||
import imChat from '@/views/tool/components/imChat.vue' // im-chat-子组件
|
||||
import MsgEnum from '@/plugins/imChat/msgEnum' // 消息头-相关定义(nuem)
|
||||
import * as commUtil from '@/utils/comm' // 工具类-通用
|
||||
import { toLinkWeb } from '@/utils/tool'
|
||||
|
||||
import * as Http_ClassManage from '@/api/classManage' // api接口
|
||||
import * as Http_Classcourse from '@/api/teaching/classcourse' // api接口
|
||||
import * as Http_Entpcoursefile from '@/api/education/entpcoursefile' // api接口
|
||||
import useUserStore from "@/store/modules/user" // 状态管理:user
|
||||
|
||||
const baseUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH
|
||||
const userStore = useUserStore()
|
||||
const visible = ref(false) // 是否打开窗口
|
||||
const myClassActive = ref({}) // 我的课件:准备上课的APT课件
|
||||
const imChatRef = ref(null) // im-chat ref
|
||||
const classForm = reactive({ // 班级(左侧):表单数据 表单配置
|
||||
form: {}, itemOption: [], option: {}
|
||||
})
|
||||
const teacherForm = reactive({ // 老师(右侧):表单数据 表单配置
|
||||
form: {}, itemOption: []
|
||||
})
|
||||
const listData = reactive({ // 列表数据
|
||||
classList: [], // 班级列表
|
||||
activeStudentList: [], // 学生列表-选择
|
||||
classcourseList: [], // 课程列表-历史记录
|
||||
})
|
||||
const dt = reactive({ // 其他数据
|
||||
isCreate: false, // 是否创建
|
||||
isHistory: false, // 是否显示-历史记录
|
||||
loading: false, // 加载-loading
|
||||
loadingDel: false, // 删除-loading
|
||||
atCourse: {}, // 当前课程
|
||||
})
|
||||
let chat = null // im-chat 对象
|
||||
|
||||
// 加载完,钩子
|
||||
onMounted(() => {
|
||||
initData() // 初始化-数据
|
||||
})
|
||||
/**
|
||||
* @description 暴露方法-打开对话框
|
||||
* @param row 课件对象
|
||||
*/
|
||||
const open = async (id) => {
|
||||
visible.value = true
|
||||
// 获取apt详情
|
||||
if (id) await getAptInfo(id)
|
||||
// 模拟数据
|
||||
// myClassActive.value = {
|
||||
// "createBy": null,
|
||||
// "createTime": null,
|
||||
// "updateBy": null,
|
||||
// "updateTime": null,
|
||||
// "remark": null,
|
||||
// "id": 14740,
|
||||
// "idarray": null,
|
||||
// "jsonarray": null,
|
||||
// "entpid": 255,
|
||||
// "parentid": 14741,
|
||||
// "linkids": "",
|
||||
// "linklist": "",
|
||||
// "entpcourseid": 7300,
|
||||
// "entpcourseidarray": null,
|
||||
// "evalid": 39952,
|
||||
// "evaltitle": " 质点 参考系",
|
||||
// "coursetitle": " 质点 参考系",
|
||||
// "classid": 0,
|
||||
// "ppttype": "file",
|
||||
// "title": " 质点 参考系",
|
||||
// "fileidx": 0,
|
||||
// "fileurl": "",
|
||||
// "pathfile": null,
|
||||
// "filetype": "ppt",
|
||||
// "filesize": null,
|
||||
// "datacontent": "",
|
||||
// "filekey": "",
|
||||
// "filetag": "",
|
||||
// "dflag": 0,
|
||||
// "status": "",
|
||||
// "edituserid": 2781,
|
||||
// "editusername": "张雪林",
|
||||
// "edituserheadimgurl": "/profile/avatar/2024/08/12/blob_20240812152930A001.jpeg",
|
||||
// "edituserentpname": "AIx数字平台内测中心",
|
||||
// "editstudentid": null,
|
||||
// "editstudentname": null,
|
||||
// "timestamp": "2024-09-10 15:07:20",
|
||||
// "token": null,
|
||||
// "base64Code": null,
|
||||
// "orderby": null,
|
||||
// "childcount": 4,
|
||||
// "commentlikecount": 0,
|
||||
// "commenttextcount": 0,
|
||||
// "commentusecount": 0,
|
||||
// "commentvisitcount": 90,
|
||||
// "unixstamp": null,
|
||||
// "classworkcount": 0,
|
||||
// "classworklist": "",
|
||||
// "authjson": "",
|
||||
// "defaultslide": null
|
||||
// }
|
||||
// 获取班级列表
|
||||
getClassList()
|
||||
|
||||
// 初始化im-chat
|
||||
nextTick(async() => {
|
||||
chat = await imChatRef.value?.initImChat()
|
||||
})
|
||||
}
|
||||
// 关闭弹窗
|
||||
const handleClose = async () => {
|
||||
await chat?.logout()
|
||||
chat = null
|
||||
}
|
||||
// 初始化-数据
|
||||
const initData = () => {
|
||||
// 班级-表单配置
|
||||
classForm.option = { labelW: 40 }
|
||||
classForm.itemOption = [
|
||||
{ label: '班级', prop: 'classid' },
|
||||
{ label: '学生', prop: 'student' },
|
||||
]
|
||||
// 老师-表单提交
|
||||
teacherForm.form = { classcourseid: 0 }
|
||||
teacherForm.itemOption = [
|
||||
{ label: '上课', prop: 'classcourseid' },
|
||||
{ label: '老师扫码', prop: 'qrUrl', show: false },
|
||||
{ label: '手机登录', prop: 'mobile', show: false },
|
||||
{ label: '故障备用', prop: 'backup', show: false },
|
||||
]
|
||||
}
|
||||
// 获取课件APT
|
||||
const getAptInfo = async (id) => {
|
||||
const res = await Http_Entpcoursefile.getEntpcoursefile(id)
|
||||
if (res.code == 200) {
|
||||
myClassActive.value = res.data
|
||||
}
|
||||
}
|
||||
// 获取当前账号-班级
|
||||
const getClassList = async () => {
|
||||
const res = await Http_ClassManage.listClassmain({
|
||||
classuserid: userStore.id, pageSize: 100, status: 'open'
|
||||
})
|
||||
if (res.code == 200) {
|
||||
listData.classList = (res.rows || []).map(o => {
|
||||
if(!!o.classstudentlist) { // 学生列表转为数组
|
||||
o.classstudentlist = JSON.parse('[' + o.classstudentlist + ']')
|
||||
}
|
||||
return o
|
||||
});
|
||||
// 默认选中第一项
|
||||
if (listData.classList.length > 0) {
|
||||
classForm.form.classid = listData.classList[0].id
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// 获取开课列表 - 历史记录
|
||||
const getClasscourseList = async type => {
|
||||
if (type == 'toggle') { // 切换是否显示数据
|
||||
dt.isHistory = !dt.isHistory
|
||||
if (!dt.isHistory || listData.classcourseList.length) return // 不显示或者有数据时-不再请求
|
||||
}
|
||||
const {classid} = classForm.form
|
||||
const {entpcourseid} = myClassActive.value
|
||||
if (!classid || !entpcourseid) return
|
||||
const params = {classid, entpcourseid, entpcoursefileid: 0}
|
||||
const res = await Http_Classcourse.listClasscourse(params)
|
||||
if (res.code == 200) {
|
||||
// zdg: 排序id大的在前(最新的)
|
||||
const list = (res.rows || []).sort((a, b) => b.id - a.id)
|
||||
listData.classcourseList = list
|
||||
// 默认选中第一个
|
||||
if (type == 'update' && list.length) {
|
||||
dt.isCreate = true // 显示-新创建记录
|
||||
teacherForm.form.classcourseid = list[0].id
|
||||
}
|
||||
}
|
||||
}
|
||||
// 创建课程
|
||||
const createClasscourse = async () => {
|
||||
dt.loading = true
|
||||
const { classid } = classForm.form
|
||||
const { entpcourseid, evalid, id, coursetitle } = myClassActive.value // 课件对象
|
||||
const curDate = commUtil.getDateNow('yyyy-MM-dd')
|
||||
const params = {
|
||||
id: 0, coursetype: '', courseverid: 0, coursedesc: '', status: '',
|
||||
teacherid: userStore.id, entpcoursefileid: id, classid,
|
||||
entpcourseid, evalid, coursetitle,
|
||||
plandate: curDate, opendate: curDate
|
||||
}
|
||||
await Http_Classcourse.addClasscourseReturnId(params)
|
||||
dt.loading = false
|
||||
getClasscourseList('update') // 更新列表
|
||||
ElMessage.success('创建课程-成功')
|
||||
|
||||
}
|
||||
// 删除课程
|
||||
const removeClasscourse = async () => {
|
||||
const { classcourseid:id } = teacherForm.form
|
||||
const ind = listData.classcourseList.findIndex(o => o.id == id)
|
||||
if(ind < 0) return ElMessage.warning('删除课堂记录-失败')
|
||||
await ElMessageBox.confirm('请确认是否删除课堂记录?')
|
||||
dt.loadingDel = true
|
||||
const res = await Http_Classcourse.delClasscourse(id)
|
||||
dt.loadingDel = false
|
||||
if (res.code == 200) {
|
||||
const list = listData.classcourseList
|
||||
list.splice(ind, 1) // 删除-id的课堂记录
|
||||
// 重新赋值选中的课堂记录,默认是下一条记录
|
||||
if (list.length==0) teacherForm.classcourseid = 0
|
||||
else {
|
||||
const newInd = ind < list.length ? ind : ind-1
|
||||
teacherForm.form.classcourseid = list[newInd].id
|
||||
}
|
||||
ElMessage.success('删除成功')
|
||||
}
|
||||
}
|
||||
// 开始上课
|
||||
const classTeachingStart = async () => {
|
||||
const { classcourseid:id } = teacherForm.form
|
||||
if (id) { // 开始上课
|
||||
const url = `/teaching/classteaching?classcourseid=${id}&actor=classTeachingOnPublicScreen`
|
||||
toLinkWeb(url) // 跳转web-公屏
|
||||
visible.value = false // 关闭弹窗
|
||||
handleClose() // 关闭im-chat
|
||||
}
|
||||
}
|
||||
// 获取二维码地址
|
||||
const getQrUrl = () => {
|
||||
const { classcourseid:id } = teacherForm.form
|
||||
const { userName } = userStore.user
|
||||
if (!id||!userName) return
|
||||
const qrCodeUrl = `wxlogin?username=${userName}&nextaction=classteaching&id=${id}`
|
||||
teacherForm.form.qrUrl = baseUrl + qrCodeUrl
|
||||
}
|
||||
|
||||
// ================== 监听 =======================
|
||||
// im-chat: 聊天事件 {type, data}
|
||||
const chatChange = (type, data, ...args) => {
|
||||
if (type == 'msg') { // im-chat 消息监听
|
||||
console.log('msg:===== ',data, args)
|
||||
// const msgId = (args||[])[0].message_msg_id
|
||||
const { msgKey:head, msgcontent:msg, senduserid:sendId, msgType } = data
|
||||
switch(head) {
|
||||
case MsgEnum.HEADS.MSG_classcourseopen:{ // 开课, 跳转公屏
|
||||
const { classcourseid:id } = teacherForm.form
|
||||
const { classcourseid: imId, status } = data
|
||||
if (imId == id && status == 'open') {
|
||||
classTeachingStart() // 开始跳转
|
||||
}
|
||||
break}
|
||||
default:
|
||||
console.log('未知消息:', data)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 监听-班级id
|
||||
watch(() => classForm.form.classid, (val)=> {
|
||||
// 获取选中课程
|
||||
dt.atCourse = listData.classList.find(o => o.id === val) || {}
|
||||
// 获取选中课程-学生列表
|
||||
listData.activeStudentList = dt.atCourse?.classstudentlist || []
|
||||
// 清空课程列表
|
||||
listData.classcourseList = []
|
||||
// 如果当前显示历史, 就从新获取
|
||||
if (dt.isHistory) getClasscourseList()
|
||||
})
|
||||
// 监听-课程id
|
||||
watch(() => teacherForm.form.classcourseid, (val) => {
|
||||
const bool = !!val
|
||||
// 获取选中课程-生成二维码地址
|
||||
bool && getQrUrl()
|
||||
// 监听课程id,是否显示功能
|
||||
teacherForm.itemOption.forEach(o => {
|
||||
// 有课程id,触发
|
||||
if (['qrUrl','backup'].includes(o.prop)) o.show = bool
|
||||
// 课程id为空,触发
|
||||
if (['mobile'].includes(o.prop)) o.show = !bool
|
||||
})
|
||||
})
|
||||
// 暴露方法
|
||||
defineExpose({
|
||||
open
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.class-all{
|
||||
text-align: left;
|
||||
}
|
||||
</style>
|
|
@ -10,7 +10,7 @@
|
|||
<el-scrollbar height="500px">
|
||||
<ul>
|
||||
<!--作业-->
|
||||
<li class="flex class-item home-list" v-for="item in homeworkList" :key="item.id" @click="onClickItem(item)">
|
||||
<li class="flex class-item home-list" v-for="item in homeworkList" :key="item.id" @click="onClickItem(item)">
|
||||
<div class="class-left flex">
|
||||
<div class="class-name flex">
|
||||
<span class="name">{{ item.uniquekey }}</span>
|
||||
|
@ -24,6 +24,7 @@
|
|||
<div>已交</div>
|
||||
</div>
|
||||
</li>
|
||||
<el-empty v-if="!homeworkList.length" description="暂无数据" />
|
||||
</ul>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
|
@ -49,7 +50,7 @@ const itemDialogRef = ref(null)
|
|||
const getClass = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await getSelfReserv()
|
||||
const res = await getSelfReserv()
|
||||
let list = res.data || []
|
||||
list.sort((a, b) => { if (a.status == '上课中') return -1; else return 0 })
|
||||
classList.value = list.filter(item => item.status !== '已结束')
|
||||
|
@ -62,9 +63,9 @@ const getHomework = async () => {
|
|||
loading.value = true
|
||||
const { edustage, edusubject } = user
|
||||
try {
|
||||
const { rows } = await homeworklist({ edituserid: user.userId, edustage, edusubject, deaddate: getTomorrow(), status: '1' ,orderby: 'uniquekey DESC', pageSize: 500 })
|
||||
const { rows } = await homeworklist({ edituserid: user.userId, edustage, edusubject, deaddate: getTomorrow(), status: '1', orderby: 'uniquekey DESC', pageSize: 500 })
|
||||
// 只展示进行中的
|
||||
homeworkList.value = rows.filter(item => item.deaddate && item.uniquekey&& getCurrentTime('YYYY-MM-DD HH:mm') < item.deaddate )
|
||||
homeworkList.value = rows.filter(item => item.deaddate && item.uniquekey && getCurrentTime('YYYY-MM-DD HH:mm') < item.deaddate)
|
||||
homeworkList.value.forEach((item) => {
|
||||
item.workdatacount = JSON.parse('[' + item.classworkdatastudentids + ']').length
|
||||
// 如果是习题训练任务,则检查一共有多少道
|
||||
|
@ -86,7 +87,7 @@ const onClickItem = (item) => {
|
|||
itemDialogRef.value.openDialog(item)
|
||||
}
|
||||
// 批阅关闭
|
||||
const closeDialog = () => {
|
||||
const closeDialog = () => {
|
||||
console.log('关闭弹窗,查询一下作业数据,更新界面')
|
||||
getHomework()
|
||||
}
|
||||
|
@ -114,7 +115,8 @@ onMounted(() => {
|
|||
font-weight: bold;
|
||||
margin-bottom: 10px;
|
||||
align-items: center;
|
||||
.title{
|
||||
|
||||
.title {
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
|
@ -185,8 +187,7 @@ onMounted(() => {
|
|||
}
|
||||
|
||||
.class-grade {
|
||||
padding-top: 3px
|
||||
}
|
||||
padding-top: 3px }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,23 +19,23 @@
|
|||
ref="ruleFormRef"
|
||||
>
|
||||
<el-form-item label="姓名" prop="name" v-if="type==1 && activeIndex==1">
|
||||
<el-input v-model="ruleForm.name" />
|
||||
<el-input v-model="ruleForm.name" placeholder="请输入姓名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="身份证号" prop="idNumber" v-if="type==1 && activeIndex==1">
|
||||
<el-input v-model="ruleForm.idNumber" />
|
||||
<el-input v-model="ruleForm.idNumber" placeholder="请输入身份证号码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="phoneNumber" v-if="activeIndex==1">
|
||||
<el-input v-model="ruleForm.phoneNumber" />
|
||||
<el-input v-model="ruleForm.phoneNumber" placeholder="请输入手机号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="验证码" prop="Code" v-if="activeIndex==1">
|
||||
<el-input style="width:60%" v-model="ruleForm.Code" :disabled="true" />
|
||||
<el-button type="primary" style="margin-left:10px" @click="sendcaptchaImg">发送验证码</el-button>
|
||||
<el-input style="width:60%" v-model="ruleForm.Code" :disabled="true" placeholder="请输入验证码" />
|
||||
<el-button type="primary" style="margin-left:10px" @click="sendcaptchaImg">发送验证码</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="设置密码" prop="password" v-if="activeIndex==1">
|
||||
<el-input v-model="ruleForm.password" type="password" />
|
||||
<el-input v-model="ruleForm.password" type="password" placeholder="6-30位,至少包含数字和字母,允许特殊符号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="确认密码" prop="confirmPassword" v-if="activeIndex==1">
|
||||
<el-input v-model="ruleForm.confirmPassword" type="password" />
|
||||
<el-input v-model="ruleForm.confirmPassword" type="password" placeholder="请确认密码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所属地区" prop="address" v-if="activeIndex==2">
|
||||
<el-cascader
|
||||
|
@ -54,7 +54,7 @@
|
|||
:data="gradeTree"
|
||||
multiple
|
||||
:render-after-expand="false"
|
||||
style="width: 100%"
|
||||
style="width: 100%;-webkit-app-region: no-drag;"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="学科" prop="discipline" v-if="activeIndex==2">
|
||||
|
@ -235,6 +235,20 @@ const OpenModel = v =>{
|
|||
}
|
||||
// 关闭弹窗
|
||||
const handleClose = () => {
|
||||
var restValue={
|
||||
name: '',
|
||||
idNumber:'',
|
||||
phoneNumber: '',
|
||||
Code:'',
|
||||
password:'',
|
||||
confirmPassword:'',
|
||||
class:[],
|
||||
discipline:[],
|
||||
school:[],
|
||||
}
|
||||
Object.assign(ruleForm, restValue);
|
||||
schoolSubject.value=[]
|
||||
gradeTree.value=[]
|
||||
if (ruleFormRef.value) ruleFormRef.value.resetFields()
|
||||
removeToken();
|
||||
activeIndex.value=1
|
||||
|
@ -337,6 +351,8 @@ const submitForm = async (formEl) => {
|
|||
discipline:[],
|
||||
school:[],
|
||||
}
|
||||
schoolSubject.value=[]
|
||||
gradeTree.value=[]
|
||||
Object.assign(ruleForm, restValue);
|
||||
activeIndex.value=1
|
||||
dialogVisible.value=false
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
</el-form-item>
|
||||
<div class="flex mb-4" style="display: flex;justify-content: center;color: #ccc;cursor: pointer;">
|
||||
<a class="hover:text-sky-500" style="margin-right: 10px;" @click="RegisterModel(1)">注册账号</a>
|
||||
<!-- | -->
|
||||
|
|
||||
<a class="hover:text-sky-500" style="margin-left: 10px;" @click="RegisterModel(2)">忘记密码</a>
|
||||
</div>
|
||||
</el-form>
|
||||
|
|
|
@ -0,0 +1,323 @@
|
|||
<template>
|
||||
<div class="prepare-body-main-item">
|
||||
<div class="prepare-body-main-item-icon">
|
||||
<slot name="default"></slot>
|
||||
<FileImage :size="50" :file-name="item.fileShowName" @click="openFileWin(item)" />
|
||||
</div>
|
||||
<div class="prepare-body-main-item-info" @click="openFileWin(item)">
|
||||
<div class="prepare-item-info-title" :title="item.fileShowName">
|
||||
<div
|
||||
style="
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
width: 200px;
|
||||
"
|
||||
>
|
||||
{{ item.fileShowName.substring(0, item.fileShowName.lastIndexOf('.')) }}
|
||||
<el-tag type="danger" effect="dark">{{item.fileShowName.substring(item.fileShowName.lastIndexOf('.')+1)}}</el-tag>
|
||||
<template v-if="item.fileTag">
|
||||
<el-tag v-for="(item1, index1) in item.fileTag.split(',')" :key="index1" type="success" effect="dark" style="margin-left: 5px">{{item1}}</el-tag>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<div class="prepare-item-info-message">
|
||||
<div v-if="item.fileFlag ==='课件'" style="width: 60px">
|
||||
<el-icon
|
||||
v-loading="item.async === 'on'"
|
||||
style="background-color: green; border-radius: 20px; color: white; top: 2px"
|
||||
>
|
||||
<Check v-if="item.async === true" />
|
||||
<UploadFilled v-if="!item.async" />
|
||||
</el-icon>
|
||||
{{ item.async === true ? '已同步' : '' }}
|
||||
{{ !item.async ? '待同步' : '' }}
|
||||
{{ item.async === 'on' ? '同步中' : '' }}
|
||||
</div>
|
||||
<template v-if="item.fileFlag ==='课件'">|</template>
|
||||
<div style="width: 70px">访问 100</div>
|
||||
|
|
||||
<div style="width: 70px">引用 50</div>
|
||||
|
|
||||
<div
|
||||
style="
|
||||
flex: 1;
|
||||
text-align: left;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
width: 200px;
|
||||
">点赞 20</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="prepare-body-main-item-btn">
|
||||
<el-button type="primary" @click="clickStartClass(item)">上课</el-button>
|
||||
</div>
|
||||
<div class="prepare-body-main-item-tool">
|
||||
<el-popover
|
||||
:ref="'popover_' + index"
|
||||
placement="left-start"
|
||||
:hide-after="100"
|
||||
popper-class="prepare-popper"
|
||||
trigger="click"
|
||||
>
|
||||
<template #default>
|
||||
<div style="width: 100%">
|
||||
<div class="item-popover" @click="closePopver(index)">
|
||||
<div v-if="userInfo.userId === Number(item.createUserId)" class="item-popover-item">
|
||||
<el-button text @click="editTalk(item, index)">
|
||||
<i class="iconfont icon-bianji"></i>
|
||||
<span>标签</span>
|
||||
</el-button>
|
||||
</div>
|
||||
<div v-if="userInfo.userId === Number(item.createUserId)" class="item-popover-item">
|
||||
<el-button text @click="deleteTalk(item)">
|
||||
<i class="iconfont icon-shanchu"></i>
|
||||
<span>删除</span>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #reference>
|
||||
<span class="iconfont icon-shenglvehao" style="cursor: pointer" @click.stop></span>
|
||||
</template>
|
||||
</el-popover>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { Check, UploadFilled, Switch } from '@element-plus/icons-vue'
|
||||
</script>
|
||||
<script>
|
||||
import FileImage from '@/components/file-image/index.vue'
|
||||
import { asyncLocalFile } from '@/utils/talkFile'
|
||||
import { toTimeText } from '@/utils/date'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { deleteSmarttalk, updateSmarttalk, getPrepareById } from '@/api/file'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import outLink from '@/utils/linkConfig'
|
||||
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
export default {
|
||||
name: 'FileListItem',
|
||||
components: { FileImage },
|
||||
props: {
|
||||
item: {
|
||||
type: Object,
|
||||
default: function () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
index: {
|
||||
type: Number,
|
||||
default: function () {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
},
|
||||
emits: { 'on-start-class': null, 'on-delete': null, 'on-set': null, 'on-delhomework': null,'on-filearg': null },
|
||||
data() {
|
||||
return {
|
||||
listenList: [],
|
||||
userInfo:{}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.userInfo = useUserStore().user
|
||||
},
|
||||
methods: {
|
||||
clickStartClass(item) {
|
||||
this.$emit('on-start-class', item)
|
||||
},
|
||||
editTalk(item) {
|
||||
ElMessageBox.prompt('请输入新的标签', '添加标签', {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
inputValue: "",
|
||||
inputPattern: /^[a-zA-Z0-9\u4e00-\u9fa5]{1,5}$/,
|
||||
inputErrorMessage: '请输入最多五个字的标签,不能携带标点符号'
|
||||
})
|
||||
.then(({ value }) => {
|
||||
let fileTagList = []
|
||||
if (!item.fileTag) {
|
||||
item.fileTag="";
|
||||
fileTagList = [];
|
||||
}else {
|
||||
fileTagList = item.fileTag.split(',');
|
||||
}
|
||||
fileTagList.push(value);
|
||||
item.fileTagList = fileTagList;
|
||||
item.fileTag = fileTagList.join(",")
|
||||
updateSmarttalk({ id: item.id, fileTag: item.fileTag, fileShowName: item.fileShowName }).then((res) => {
|
||||
if (res.data === true) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: `添加成功!`
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
downloadFile(item) {
|
||||
ipcRenderer.send('save-as', item.fileFullPath, item.fileShowName)
|
||||
},
|
||||
deleteTalk(item) {
|
||||
deleteSmarttalk(item.id).then((res) => {
|
||||
if (res.data === true) {
|
||||
this.$emit('on-delete', item)
|
||||
}
|
||||
})
|
||||
},
|
||||
closePopver(index) {
|
||||
this.$refs['popover_' + index].hide()
|
||||
},
|
||||
formatFileSize(fileSize) {
|
||||
if (fileSize < 1024) {
|
||||
return fileSize + 'B'
|
||||
} else if (fileSize < 1024 * 1024) {
|
||||
let temp = fileSize / 1024
|
||||
temp = temp.toFixed(2)
|
||||
return temp + 'KB'
|
||||
} else if (fileSize < 1024 * 1024 * 1024) {
|
||||
let temp = fileSize / (1024 * 1024)
|
||||
temp = temp.toFixed(2)
|
||||
return temp + 'MB'
|
||||
} else {
|
||||
let temp = fileSize / (1024 * 1024 * 1024)
|
||||
temp = temp.toFixed(2)
|
||||
return temp + 'GB'
|
||||
}
|
||||
},
|
||||
openFileWin(items) {
|
||||
if (items.fileFlag === 'apt') {
|
||||
console.log(items);
|
||||
const path="/teaching/aptindex?id="+items.fileId
|
||||
let configObj = outLink().getBaseData()
|
||||
let fullPath = configObj.fullPath + path
|
||||
fullPath = fullPath.replaceAll('//', '/')
|
||||
// 通知主进程
|
||||
ipcRenderer.send('openWindow', {
|
||||
key: path,
|
||||
fullPath: fullPath,
|
||||
cookieData: { ...configObj.data }
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!items||!items.fileSuffix) return;
|
||||
getPrepareById(items.id).then((item) => {
|
||||
Object.assign(items, item)
|
||||
asyncLocalFile(items).then(() => {
|
||||
ipcRenderer.send('open-path-app', item.fileNewName)
|
||||
if (this.listenList.indexOf(item.fileNewName) === -1) {
|
||||
this.listenList.push(item.fileNewName)
|
||||
let cookie = localStorage.getItem('Admin-Token')
|
||||
ipcRenderer.send('listen-file-change', {
|
||||
id: item.id,
|
||||
fileNewName: item.fileNewName,
|
||||
md5: item.fileMd5,
|
||||
cookie,
|
||||
fileType: item.fileType
|
||||
})
|
||||
ipcRenderer.on('listen-file-change-on' + item.fileNewName, () => {
|
||||
items.async = 'on'
|
||||
})
|
||||
ipcRenderer.on('listen-file-change-success' + item.fileNewName, (e, { data, md5 }) => {
|
||||
items.fileSize = data.fileSize
|
||||
items.md5 = md5
|
||||
items.async = true
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
//布置
|
||||
setHomeWork(item) {
|
||||
// this.$emit('on-set', item)
|
||||
},
|
||||
// 删除作业
|
||||
deleteHomework(item){
|
||||
this.$emit('on-delhomework', item)
|
||||
},
|
||||
// 文件资源打开web AIX 布置作业
|
||||
openFileLink(item){
|
||||
let unitId = item.levelSecondId ? item.levelSecondId : item.levelFirstId
|
||||
// key 对应的 linkConfig.js 外部链接配置
|
||||
let key = 'filehomework'
|
||||
let configObj = outLink()[key]
|
||||
// 通知主进程
|
||||
ipcRenderer.send('openWindow', {
|
||||
key,
|
||||
fullPath: configObj.fullPath + `&fileShowName=${item.fileShowName}&fileFullPath=${item.fileFullPath}&unitId=${unitId}`,
|
||||
cookieData: { ...configObj.data }
|
||||
})
|
||||
|
||||
this.$emit('on-filearg', item)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.prepare-item-info-message {
|
||||
.circular {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style scoped lang="scss">
|
||||
.prepare-body-main-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid rgba(131, 131, 127, 0.17);
|
||||
padding: 10px 0;
|
||||
|
||||
&:hover {
|
||||
background-color: rgba(144, 147, 153, 0.2);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.prepare-body-main-item-icon {
|
||||
width: 80px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.icon-zuoye {
|
||||
font-size: 40px;
|
||||
color: #707070;
|
||||
}
|
||||
}
|
||||
|
||||
.prepare-body-main-item-tool {
|
||||
font-size: 18px !important;
|
||||
font-weight: bold;
|
||||
width: 40px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.prepare-body-main-item-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
|
||||
.prepare-item-info-title {
|
||||
text-align: left;
|
||||
font-size: 16px;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.prepare-item-info-message {
|
||||
font-size: 12px;
|
||||
line-height: 23px;
|
||||
color: #909399;
|
||||
display: flex;
|
||||
|
||||
.circular {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -2,7 +2,7 @@
|
|||
<el-dialog
|
||||
v-model="centerDialogVisible"
|
||||
class="reserv-dialog"
|
||||
title="预约课程"
|
||||
title="上课"
|
||||
destroy-on-close
|
||||
:before-close="closeDialog"
|
||||
width="600"
|
||||
|
@ -74,7 +74,7 @@
|
|||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="centerDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="submitForm"> 提交 </el-button>
|
||||
<el-button type="primary" @click="submitForm"> 上课 </el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
@ -105,7 +105,7 @@ const userStore = useUserStore().user
|
|||
const centerDialogVisible = ref(false)
|
||||
const form = reactive({
|
||||
name: '',
|
||||
type: '常规课',
|
||||
type: '互动课',
|
||||
day: '',
|
||||
time: [],
|
||||
resource: [],
|
||||
|
@ -126,12 +126,6 @@ const ruleForm = reactive({
|
|||
resource: [{ required: true, message: '请选择授课对象', trigger: 'change' }]
|
||||
})
|
||||
const locationOptions = [
|
||||
{
|
||||
label: '常规课',
|
||||
value: '常规课',
|
||||
disabled: false,
|
||||
message: '现场公屏授课,学生无需长时间打开平板上。'
|
||||
},
|
||||
{
|
||||
label: '互动课',
|
||||
value: '互动课',
|
||||
|
@ -288,13 +282,13 @@ const addClassReserv = (formData) => {
|
|||
ex2: props.currentNode.id
|
||||
}
|
||||
addSmartClassReserv(param).then((res) => {
|
||||
if (res.data === true) {
|
||||
if (res.msg) {
|
||||
closeDialog()
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '预约成功!'
|
||||
})
|
||||
emit('addSuccess')
|
||||
emit('addSuccess',res.msg)
|
||||
} else {
|
||||
ElMessage({
|
||||
type: 'error',
|
||||
|
|
|
@ -1,8 +1,38 @@
|
|||
<template>
|
||||
<div v-loading="isLoading" class="page-resource flex">
|
||||
<ChooseTextbook @change-book="nodeClick" @node-click="nodeClick" />
|
||||
<div class="page-center-wrap">
|
||||
<el-tabs v-model="activeAptTab" style="height: 100%;">
|
||||
<el-tab-pane label="教学课件" name="教学课件" class="prepare-center-jxkj">
|
||||
<div class="prepare-center-header">
|
||||
<div class="center-create-btn" style="background-color: rgb(64,158,255)" @click="createAptFile">
|
||||
<div class="create-btn-title"><el-icon><Plus /></el-icon><label>创建APT</label></div>
|
||||
<div class="create-btn-info">智能交互课件</div>
|
||||
</div>
|
||||
<div class="center-create-btn" style="background-color: rgb(112,182,3)" @click="createFile">
|
||||
<div class="create-btn-title"><el-icon><Plus /></el-icon><label>创建PPT</label></div>
|
||||
<div class="create-btn-info">传统课件</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="prepare-center-body">
|
||||
<kj-list-item
|
||||
v-for="(item, index) in currentKJFileList"
|
||||
:key="index"
|
||||
:item="item"
|
||||
:index="index"
|
||||
@on-delete="deleteTalk"
|
||||
@on-start-class="startClass"
|
||||
>
|
||||
</kj-list-item>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="教学实录" name="教学实录" class="prepare-center-jxsl">
|
||||
<class-reserv></class-reserv>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
<div class="page-right">
|
||||
<div class="header-top flex">
|
||||
<!-- <div class="header-top flex">
|
||||
<div class="textbook-img" @click="navtoPdf">
|
||||
<el-image style="width: 80px; height: 110px" :src="curBookImg" />
|
||||
<el-progress
|
||||
|
@ -32,85 +62,82 @@
|
|||
<label>{{ curClassReserv.startTime }}-{{ curClassReserv.endTime }}</label>
|
||||
</el-button>
|
||||
<div class="top-zoom-style"></div>
|
||||
</div>
|
||||
<div class="prepare-body-header">
|
||||
<div>
|
||||
<label style="font-size: 15px">共{{ currentFileList.length }}个文件</label>
|
||||
<el-popover placement="top-start" :width="250" trigger="hover">
|
||||
<template #default>
|
||||
</div>-->
|
||||
<div style="padding: 0 20px;height: 100%;">
|
||||
<el-tabs v-model="activeTab" class="prepare-tabs" >
|
||||
<el-tab-pane label="素材" name="素材">
|
||||
<div class="prepare-body-header">
|
||||
<div>
|
||||
<el-button
|
||||
v-if="lastAsyncAllTime"
|
||||
type="success"
|
||||
size="small"
|
||||
:icon="Check"
|
||||
circle
|
||||
/>
|
||||
{{ lastAsyncAllTime ? toTimeText(lastAsyncAllTime) + '同步成功' : '' }}
|
||||
<label style="font-size: 15px">共{{ currentFileList.length }}个文件</label>
|
||||
<el-popover placement="top-start" :width="250" trigger="hover">
|
||||
<template #default>
|
||||
<div>
|
||||
<el-button
|
||||
v-if="lastAsyncAllTime"
|
||||
type="success"
|
||||
size="small"
|
||||
:icon="Check"
|
||||
circle
|
||||
/>
|
||||
{{ lastAsyncAllTime ? toTimeText(lastAsyncAllTime) + '同步成功' : '' }}
|
||||
</div>
|
||||
</template>
|
||||
<template #reference>
|
||||
<el-button size="small" text @click="asyncAllFile">
|
||||
<el-icon v-loading="asyncAllFileVisiable">
|
||||
<Refresh />
|
||||
</el-icon>
|
||||
{{ asyncAllFileVisiable ? '同步中' : '云同步' }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-popover>
|
||||
<el-button size="small" @click="isDialogOpen = true">上传资料</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<template #reference>
|
||||
<el-button size="small" text @click="asyncAllFile">
|
||||
<el-icon v-loading="asyncAllFileVisiable">
|
||||
<Refresh />
|
||||
</el-icon>
|
||||
{{ asyncAllFileVisiable ? '同步中' : '云同步' }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-popover>
|
||||
</div>
|
||||
<div style="display: flex">
|
||||
<el-button @click="handleOutLink('feedback')">作业反馈</el-button>
|
||||
<el-button @click="handleOutLink('homeWork')">布置作业</el-button>
|
||||
<el-button @click="isDialogOpen = true">上传资料</el-button>
|
||||
<el-dropdown trigger="click" style="margin-left: 12px">
|
||||
<el-button type="primary">
|
||||
新建课件<el-icon class="el-icon--right"><arrow-down /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item style="padding: 0">
|
||||
<el-button type="default" style="" @click="createFile">PPT课件</el-button>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item style="padding: 0">
|
||||
<el-button type="default" style="" @click="createAptFile">APT课件</el-button>
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
<el-checkbox-group
|
||||
v-model="checkFileList"
|
||||
class="prepare-body-main"
|
||||
:style="{ 'margin-bottom': checkFileList.length > 0 ? '40px' : '0' }"
|
||||
>
|
||||
<file-list-item
|
||||
v-for="(item, index) in currentSCFileList"
|
||||
:key="index"
|
||||
:item="item"
|
||||
:index="index"
|
||||
@on-move="onMoveSingleFile"
|
||||
@on-delete="deleteTalk"
|
||||
@on-set="openSet"
|
||||
@on-delhomework="delhomework"
|
||||
@on-filearg="isOpenHomework = true"
|
||||
>
|
||||
<el-checkbox v-if="!item.uniquekey" label="" :value="item" />
|
||||
</file-list-item>
|
||||
</el-checkbox-group>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="作业" name="作业">
|
||||
<div class="prepare-body-header">
|
||||
<div>
|
||||
<label style="font-size: 15px">共{{ currentWorkList.length }}个作业</label>
|
||||
<el-button size="small" @click="handleOutLink('feedback')">作业反馈</el-button>
|
||||
<el-button size="small" @click="handleOutLink('homeWork')">布置作业</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="prepare-work-wrap">
|
||||
<file-list-item
|
||||
v-for="(item, index) in currentWorkList"
|
||||
:key="index"
|
||||
:item="item"
|
||||
:index="index"
|
||||
@on-move="onMoveSingleFile"
|
||||
@on-delete="deleteTalk"
|
||||
@on-set="openSet"
|
||||
@on-delhomework="delhomework"
|
||||
>
|
||||
</file-list-item>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
<el-checkbox-group
|
||||
v-model="checkFileList"
|
||||
class="prepare-body-main"
|
||||
:style="{ 'margin-bottom': checkFileList.length > 0 ? '40px' : '0' }"
|
||||
>
|
||||
<file-list-item
|
||||
v-for="(item, index) in currentFileList"
|
||||
:key="index"
|
||||
:item="item"
|
||||
:index="index"
|
||||
@on-move="onMoveSingleFile"
|
||||
@on-delete="deleteTalk"
|
||||
@on-set="openSet"
|
||||
@on-delhomework="delhomework"
|
||||
@on-filearg="isOpenHomework = true"
|
||||
>
|
||||
<el-checkbox v-if="!item.uniquekey" label="" :value="item" />
|
||||
</file-list-item>
|
||||
<file-list-item
|
||||
v-for="(item, index) in currentWorkList"
|
||||
:key="index"
|
||||
:item="item"
|
||||
:index="index"
|
||||
@on-move="onMoveSingleFile"
|
||||
@on-delete="deleteTalk"
|
||||
@on-set="openSet"
|
||||
@on-delhomework="delhomework"
|
||||
>
|
||||
<el-checkbox v-if="!item.uniquekey" label="" :value="item" />
|
||||
</file-list-item>
|
||||
</el-checkbox-group>
|
||||
<file-oper-batch
|
||||
v-show="checkFileList.length > 0"
|
||||
:indeterminate="checkFileList.length > 0 && checkFileList.length < currentFileList.length"
|
||||
|
@ -132,10 +159,11 @@
|
|||
:book-id="uploadData.textbookId"
|
||||
@add-success="initReserv"
|
||||
></reserv>
|
||||
<!-- <button @click="ipcMsgSend('tool-sphere:close')">测试</button> -->
|
||||
<!-- 上课配置 -->
|
||||
<class-start ref="calssRef"/>
|
||||
</template>
|
||||
<script setup>
|
||||
import { Check } from '@element-plus/icons-vue'
|
||||
import { Check,Plus } from '@element-plus/icons-vue'
|
||||
import Reserv from '@/views/prepare/container/reserv.vue'
|
||||
import { ArrowDown } from '@element-plus/icons-vue'
|
||||
</script>
|
||||
|
@ -149,6 +177,7 @@ import useUserStore from '@/store/modules/user'
|
|||
import { useToolState } from '@/store/modules/tool'
|
||||
import MoveFile from '@/components/move-file/index.vue'
|
||||
import FileListItem from '@/views/prepare/container/file-list-item.vue'
|
||||
import KjListItem from '@/views/prepare/container/kj-list-item.vue'
|
||||
import { getSmarttalkPage, moveSmarttalk, creatAPT } from '@/api/file'
|
||||
import { toTimeText } from '@/utils/date'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
@ -159,10 +188,11 @@ import outLink from '@/utils/linkConfig'
|
|||
import { createWindow, sessionStore } from '@/utils/tool'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import { delClasswork, listEntpcourse } from '@/api/teaching/classwork'
|
||||
import { getSelfReserv } from '@/api/classManage'
|
||||
import { getClassInfo, getSelfReserv } from '@/api/classManage'
|
||||
import { useGetHomework } from '@/hooks/useGetHomework'
|
||||
import { addEntpcoursefileReturnId } from '@/api/education/entpcoursefile'
|
||||
|
||||
import ClassReserv from '@/views/classManage/classReserv.vue'
|
||||
import classStart from '@/views/desktop/container/class-start.vue' // 预备上课
|
||||
const toolStore = useToolState()
|
||||
|
||||
const fs = require('fs')
|
||||
|
@ -175,9 +205,12 @@ export default {
|
|||
Refresh,
|
||||
uploadDialog,
|
||||
FileListItem,
|
||||
KjListItem,
|
||||
FileOperBatch,
|
||||
MoveFile,
|
||||
SetHomework
|
||||
SetHomework,
|
||||
ClassReserv,
|
||||
classStart
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -196,6 +229,8 @@ export default {
|
|||
curClassReserv: {},
|
||||
downloadNum: 0,
|
||||
lastAsyncAllTime: '',
|
||||
activeTab: "素材",
|
||||
activeAptTab: "教学课件",
|
||||
uploadData: {
|
||||
textbookId: null,
|
||||
levelFirstId: 39103,
|
||||
|
@ -219,6 +254,12 @@ export default {
|
|||
return (
|
||||
this.checkFileList.length > 0 && this.checkFileList.length === this.currentFileList.length
|
||||
)
|
||||
},
|
||||
currentKJFileList() {
|
||||
return this.currentFileList.filter((item) => item.fileFlag === 'apt' || item.fileFlag === '课件')
|
||||
},
|
||||
currentSCFileList() {
|
||||
return this.currentFileList.filter((item) => item.fileFlag !== 'apt' && item.fileFlag !== '课件')
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -230,13 +271,13 @@ export default {
|
|||
this.callback(param)
|
||||
})
|
||||
this.lastAsyncAllTime = localStorage.getItem('lastAsyncAllTime')
|
||||
this.initReserv()
|
||||
// this.initReserv()
|
||||
},
|
||||
mounted() {
|
||||
this.$watch(
|
||||
() => toolStore.isToolWin,
|
||||
(newD, oldD) => {
|
||||
setTimeout(this.initReserv, 500)
|
||||
// setTimeout(this.initReserv, 500)
|
||||
}
|
||||
)
|
||||
// electron 当前窗口
|
||||
|
@ -256,16 +297,21 @@ export default {
|
|||
// }
|
||||
// },
|
||||
methods: {
|
||||
initReserv() {
|
||||
getSelfReserv().then((res) => {
|
||||
let list = res.data.filter((item) => {
|
||||
return item.status !== '已结束'
|
||||
})
|
||||
if (list.length > 0) {
|
||||
this.curClassReserv = list[list.length - 1]
|
||||
} else {
|
||||
this.curClassReserv = {}
|
||||
}
|
||||
startClass(item) {
|
||||
console.log(item)
|
||||
if(item.fileFlag === '课件') {
|
||||
this.openReserv()
|
||||
}
|
||||
if(item.fileFlag === 'apt') {
|
||||
//TODO 打开apt
|
||||
const { fileId: aptId } = item
|
||||
this.$refs.calssRef.open(aptId)
|
||||
}
|
||||
},
|
||||
initReserv(id) {
|
||||
getClassInfo(id).then((res) => {
|
||||
this.curClassReserv = res.data
|
||||
this.openLesson(res.data.id);
|
||||
})
|
||||
},
|
||||
getBookPathFromServer() {
|
||||
|
@ -312,7 +358,7 @@ export default {
|
|||
},
|
||||
createAptFile() {
|
||||
listEntpcourse({
|
||||
evalid: this.uploadData.levelSecondId,
|
||||
evalid: this.currentNode.id,
|
||||
edituserid: this.userStore.userId,
|
||||
pageSize: 500
|
||||
}).then((response) => {
|
||||
|
@ -596,7 +642,7 @@ export default {
|
|||
})
|
||||
},
|
||||
// 上课-工具类悬浮
|
||||
async openLesson() {
|
||||
async openLesson(id) {
|
||||
// await startClass(this.curClassReserv.id)
|
||||
createWindow('tool-sphere', {
|
||||
url:
|
||||
|
@ -605,7 +651,7 @@ export default {
|
|||
'&label=' +
|
||||
this.currentNode.label +
|
||||
'&reservId=' +
|
||||
this.curClassReserv.id
|
||||
id
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -643,20 +689,78 @@ export default {
|
|||
user-select: none;
|
||||
padding-top: 10px;
|
||||
height: 100%;
|
||||
|
||||
:deep(.el-tabs__nav) {
|
||||
.el-tabs__item{
|
||||
font-weight: bold;
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
.page-center-wrap{
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
padding: 0 10px;
|
||||
.prepare-center-jxkj{
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.prepare-center-header{
|
||||
display: flex;
|
||||
cursor: pointer;
|
||||
.center-create-btn{
|
||||
cursor: pointer;
|
||||
margin: 5px;
|
||||
flex: 1;
|
||||
height: 60px;
|
||||
border-radius: 5px;
|
||||
.create-btn-title{
|
||||
font-weight: 900;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 15px;
|
||||
color: #ffffff;
|
||||
height: 15px;
|
||||
margin-top: 15px;
|
||||
label{
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
.create-btn-info{
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
color: #ffffff;
|
||||
margin-top: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.prepare-center-body{
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
}
|
||||
}
|
||||
.prepare-center-jxsl{
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.page-right {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
margin-left: 20px;
|
||||
min-width: 375px;
|
||||
width: 375px;
|
||||
height: 100%;
|
||||
background: #ffffff;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 0px 20px 0px rgba(99, 99, 99, 0.06);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.prepare-tabs{
|
||||
height: 100%;
|
||||
:deep(.el-tab-pane) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
.header-top {
|
||||
height: 150px;
|
||||
align-items: center;
|
||||
|
@ -742,20 +846,24 @@ export default {
|
|||
}
|
||||
|
||||
.prepare-body-header {
|
||||
height: 60px;
|
||||
//height: 60px;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
padding: 0 20px;
|
||||
//padding: 0 20px;
|
||||
}
|
||||
.prepare-work-wrap{
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.prepare-body-main {
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
overflow: auto;
|
||||
padding: 0 30px;
|
||||
//padding: 0 30px;
|
||||
line-height: normal;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,6 +135,8 @@ function submit() {
|
|||
userStore.login({username:props.user.userName,password:props.user.plainpwd}).then(() => {
|
||||
userStore.getInfo().then(res => {
|
||||
if(res.code === 200){
|
||||
localStorage.removeItem('subjectList')
|
||||
localStorage.removeItem('evaluationList')
|
||||
ElMessage.success('修改成功')
|
||||
}else{
|
||||
ElMessage.error(response.msg)
|
||||
|
|
|
@ -8,7 +8,7 @@ import { ipcMsgSend, ipcHandle, ipcMain, ipcMsgInvoke } from '@/utils/tool' //
|
|||
const userStore = useUserStore()
|
||||
const emits = defineEmits(['change'])
|
||||
const props = defineProps({
|
||||
isGroup: { type: Boolean, default: false }, // 是否创建群
|
||||
group: { type: Boolean, default: false }, // 是否创建群
|
||||
})
|
||||
const imChatObj = reactive({imChat:null})
|
||||
onMounted(() => {
|
||||
|
@ -16,7 +16,7 @@ onMounted(() => {
|
|||
})
|
||||
// 初始化 im-chat
|
||||
const initImChat = async (timGroupId) => {
|
||||
// console.log('im-chat', userStore.user.timuserid)
|
||||
// console.log('im-chat', userStore.user.timuserid, props)
|
||||
try {
|
||||
const { timuserid, deptId, userId } = userStore.user
|
||||
// 获取腾讯云签名
|
||||
|
@ -26,7 +26,6 @@ const initImChat = async (timGroupId) => {
|
|||
// 群名称
|
||||
const groupName = `${deptId}-classteaching-${userId}`
|
||||
// 注册im-chat
|
||||
// await ipcMsgInvoke('im-chat:init', sdkAppId)
|
||||
imChatObj.imChat = new ImChat(sdkAppId, sign, timuserid)
|
||||
// 初始化 im-chat
|
||||
await imChatObj.imChat.init()
|
||||
|
@ -37,11 +36,12 @@ const initImChat = async (timGroupId) => {
|
|||
})
|
||||
// 登录 im-chat(为了不漏消息,需要在登录之前-监听)
|
||||
await imChatObj.imChat.login()
|
||||
// console.log('im-chat-login-success', userStore.user)
|
||||
// 创建群
|
||||
if (!timGroupId||props.isGroup) { // 创建群
|
||||
await createGroup(groupName)
|
||||
} else { // 已有群-设置群id
|
||||
if (timGroupId) { // 已有群-设置群id
|
||||
imChatObj.imChat.timGroupId = timGroupId
|
||||
} else {
|
||||
if (props.group) await createGroup(groupName) // 创建群
|
||||
}
|
||||
return imChatObj.imChat
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<upvote-vue ref="upvoteRef" type="2"></upvote-vue>
|
||||
|
||||
<!-- im-chat 聊天组件 -->
|
||||
<im-chat ref="imChatRef" @change="chatChange" />
|
||||
<im-chat ref="imChatRef" @change="chatChange" isGroup />
|
||||
|
||||
<!-- 底部工具栏 -->
|
||||
<div class="tool-bottom-all" @mouseenter="mouseChange(0)" @mouseleave="mouseChange(1)">
|
||||
|
|
Loading…
Reference in New Issue