二期:解决新建文件失败问题
This commit is contained in:
parent
9f510187c0
commit
5db876ebfa
|
@ -201,7 +201,8 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
|||
/*创建新的ppt文件*/
|
||||
ipcMain.on('creat-file-default', (e, { name, uploadData, cookie }) => {
|
||||
createFolder('tempFile').then(() => {
|
||||
let path = appTempFilePath + name
|
||||
let path = appTempFilePath + name.replace(/[\\/:*?"<>|]/, '')
|
||||
console.log(path)
|
||||
fs.writeFileSync(path, '', 'utf-8')
|
||||
let fileType = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
|
||||
let formData = new FormData()
|
||||
|
@ -237,7 +238,8 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
|||
|
||||
//下载文件
|
||||
ipcMain.on('download-file-default', (e, { url, fileName }) => {
|
||||
createFolder('selfFile').then(async () => {
|
||||
createFolder('selfFile')
|
||||
.then(async () => {
|
||||
const browserWindow = BrowserWindow.getFocusedWindow()
|
||||
const id = await manager.download({
|
||||
window: browserWindow,
|
||||
|
@ -268,6 +270,9 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
|||
}
|
||||
})
|
||||
})
|
||||
.catch((error) => {
|
||||
e.reply('download-file-default' + fileName, false)
|
||||
})
|
||||
})
|
||||
|
||||
/**另存为...
|
||||
|
|
|
@ -4,20 +4,28 @@
|
|||
class="reserv-dialog"
|
||||
title="预约课程"
|
||||
destroy-on-close
|
||||
:before-close="closeDialog"
|
||||
width="600"
|
||||
style="text-align: left"
|
||||
>
|
||||
<el-form :model="form" label-width="auto" style="max-width: 600px">
|
||||
<el-form-item label="课程名称">
|
||||
<el-form
|
||||
ref="ruleFormDialog"
|
||||
:model="form"
|
||||
:rules="ruleForm"
|
||||
label-width="auto"
|
||||
style="max-width: 600px"
|
||||
>
|
||||
<el-form-item label="课程名称" prop="name">
|
||||
<el-input v-model="form.name" />
|
||||
</el-form-item>
|
||||
<el-form-item label="课程类型" prop="location">
|
||||
<el-form-item label="课程类型" prop="type">
|
||||
<el-segmented v-model="form.type" :block="false" :options="locationOptions" />
|
||||
</el-form-item>
|
||||
<el-form-item label=" " prop="location">
|
||||
<el-form-item label=" ">
|
||||
<div>{{ locationMessage }}</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="上课时间">
|
||||
<el-form-item prop="day">
|
||||
<el-col :span="6">
|
||||
<el-date-picker
|
||||
v-model="form.day"
|
||||
|
@ -29,15 +37,18 @@
|
|||
value-format="YYYY-MM-DD"
|
||||
/>
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
<el-col :span="2" class="text-center">
|
||||
<span class="text-gray-500">-</span>
|
||||
</el-col>
|
||||
<el-form-item prop="time">
|
||||
<el-col :span="11">
|
||||
<el-time-picker
|
||||
v-model="form.time"
|
||||
is-range
|
||||
:editable="false"
|
||||
format="HH:mm"
|
||||
value-format="HH:mm"
|
||||
class="reserv-time-pick"
|
||||
range-separator="-"
|
||||
start-placeholder="开始时间"
|
||||
|
@ -45,19 +56,22 @@
|
|||
/>
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
<el-form-item label="授课对象">
|
||||
<el-radio-group v-model="form.resource">
|
||||
<el-radio v-for="(item, index) in classList" :key="index" :value="item.id">{{item.caption}}({{item.classstudentcount}})人</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="教室">
|
||||
<el-form-item label="授课对象" prop="resource">
|
||||
<el-checkbox-group v-model="form.resource">
|
||||
<el-checkbox v-for="(item, index) in classList" :key="index" name="type" :value="item.id"
|
||||
>{{ item.caption }}({{ item.classstudentcount }})人
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="教室" prop="classRoom">
|
||||
<el-input v-model="form.classRoom" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="centerDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="centerDialogVisible = false"> 提交 </el-button>
|
||||
<el-button type="primary" @click="submitForm"> 提交 </el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
@ -66,17 +80,24 @@
|
|||
import { ref, defineExpose, onMounted, reactive, computed } from 'vue'
|
||||
import { listClassmain } from '@/api/classManage'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
const ruleFormDialog = ref(null)
|
||||
const userStore = useUserStore().user
|
||||
const centerDialogVisible = ref(false)
|
||||
const form = reactive({
|
||||
name: '',
|
||||
type: '常规课',
|
||||
delivery: false,
|
||||
day: '',
|
||||
time: '',
|
||||
resource: '',
|
||||
resource: [],
|
||||
classRoom: ''
|
||||
})
|
||||
const ruleForm = reactive({
|
||||
name: [{ required: true, message: '请输入课程名称', trigger: 'blur' }],
|
||||
day: [{ required: true, message: '请选择上课日期', trigger: 'change' }],
|
||||
time: [{ required: true, message: '请选择上课时间', trigger: 'change' }],
|
||||
classRoom: [{ required: false, message: '请选择上课时间', trigger: 'change' }],
|
||||
resource: [{ required: true, message: '请选择授课对象', trigger: 'change' }]
|
||||
})
|
||||
const locationOptions = [
|
||||
{
|
||||
label: '常规课',
|
||||
|
@ -85,9 +106,9 @@ const locationOptions = [
|
|||
message: '现场公屏授课,学生无需长时间打开平板上。'
|
||||
},
|
||||
{
|
||||
label: '公开课',
|
||||
value: '公开课',
|
||||
disabled: true,
|
||||
label: '互动课',
|
||||
value: '互动课',
|
||||
disabled: false,
|
||||
message: '现场公屏授课,学生需打开平开与老师进行互动,如点赞、互动作业。'
|
||||
},
|
||||
{
|
||||
|
@ -104,6 +125,7 @@ const openDialog = () => {
|
|||
centerDialogVisible.value = true
|
||||
}
|
||||
const closeDialog = () => {
|
||||
ruleFormDialog.value.resetFields()
|
||||
centerDialogVisible.value = false
|
||||
}
|
||||
const classList = ref([])
|
||||
|
@ -114,6 +136,15 @@ onMounted(() => {
|
|||
}
|
||||
)
|
||||
})
|
||||
const submitForm = async () => {
|
||||
const formEl = ruleFormDialog.value
|
||||
if (!formEl) return
|
||||
await formEl.validate((valid) => {
|
||||
if (valid) {
|
||||
centerDialogVisible.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
defineExpose({
|
||||
openDialog,
|
||||
closeDialog
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
<el-button class="btn" @click="handleOutLink('aiModel')">教学大模型</el-button>
|
||||
</div>
|
||||
<el-button type="primary" class="to-class-btn" @click="openLesson">
|
||||
<i class="iconfont icon-lingdang"></i>上课</el-button>
|
||||
<i class="iconfont icon-lingdang"></i>上课</el-button
|
||||
>
|
||||
<div class="top-zoom-style"></div>
|
||||
</div>
|
||||
<div class="prepare-body-header">
|
||||
|
@ -22,7 +23,13 @@
|
|||
<el-popover placement="top-start" :width="250" trigger="hover">
|
||||
<template #default>
|
||||
<div>
|
||||
<el-button v-if="lastAsyncAllTime" type="success" size="small" :icon="Check" circle />
|
||||
<el-button
|
||||
v-if="lastAsyncAllTime"
|
||||
type="success"
|
||||
size="small"
|
||||
:icon="Check"
|
||||
circle
|
||||
/>
|
||||
{{ lastAsyncAllTime ? toTimeText(lastAsyncAllTime) + '同步成功' : '' }}
|
||||
</div>
|
||||
</template>
|
||||
|
@ -40,24 +47,60 @@
|
|||
<el-button @click="handleOutLink('feedback')">作业反馈</el-button>
|
||||
<el-button @click="handleOutLink('homeWork')">布置作业</el-button>
|
||||
<el-button @click="isDialogOpen = true">上传资料</el-button>
|
||||
<el-button type="primary" style="margin-left: 10px" @click="createFile">新建课件</el-button>
|
||||
<el-button type="primary" style="margin-left: 10px" @click="createFile"
|
||||
>新建课件</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<el-checkbox-group v-model="checkFileList" class="prepare-body-main"
|
||||
:style="{ 'margin-bottom': checkFileList.length > 0 ? '40px' : '0' }">
|
||||
<file-list-item v-for="(item, index) in currentFileList" :key="index" :item="item" :index="index"
|
||||
@on-move="onMoveSingleFile" @on-delete="deleteTalk" @on-set="openSet" @on-delhomework="delhomework">
|
||||
<el-checkbox label="" :value="item" v-if="!item.uniquekey" />
|
||||
<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"
|
||||
>
|
||||
<el-checkbox v-if="!item.uniquekey" label="" :value="item" />
|
||||
</file-list-item>
|
||||
<file-list-item
|
||||
v-for="(item, index) in currentWorkList"
|
||||
:key="'work_' + 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"
|
||||
<file-oper-batch
|
||||
v-show="checkFileList.length > 0"
|
||||
:indeterminate="checkFileList.length > 0 && checkFileList.length < currentFileList.length"
|
||||
:choose="checkFileList" :check-all="isCheckAll" @click-delete="clickDelete" @click-move="clickMove"
|
||||
@cancel="checkFileList = []" @click-choose="clickChoose"></file-oper-batch>
|
||||
:choose="checkFileList"
|
||||
:check-all="isCheckAll"
|
||||
@click-delete="clickDelete"
|
||||
@click-move="clickMove"
|
||||
@cancel="checkFileList = []"
|
||||
@click-choose="clickChoose"
|
||||
></file-oper-batch>
|
||||
</div>
|
||||
<MoveFile v-model="isMoveDialogOpen" @on-submit="chooseMoveCata" />
|
||||
<uploadDialog v-model="isDialogOpen" @submit-file="submitFile" />
|
||||
<SetHomework v-model="setDialog" :entpcourseid="entpcourseid" :row="row" @on-close="closeHomework" />
|
||||
<SetHomework
|
||||
v-model="setDialog"
|
||||
:entpcourseid="entpcourseid"
|
||||
:row="row"
|
||||
@on-close="closeHomework"
|
||||
/>
|
||||
</div>
|
||||
<reserv ref="reservDialog"></reserv>
|
||||
</template>
|
||||
|
@ -85,7 +128,7 @@ import outLink from '@/utils/linkConfig'
|
|||
import { createWindow } from '@/utils/tool'
|
||||
import { uniqBy, cloneDeep } from 'lodash'
|
||||
import { delClasswork, addEntpcourse } from '@/api/teaching/classwork'
|
||||
const fs = require('fs');
|
||||
const fs = require('fs')
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
|
||||
export default {
|
||||
|
@ -111,6 +154,7 @@ export default {
|
|||
fileList: [],
|
||||
currentNode: {},
|
||||
currentFileList: [],
|
||||
currentWorkList: [],
|
||||
curBookPath: '',
|
||||
lastAsyncAllTime: '',
|
||||
uploadData: {
|
||||
|
@ -313,7 +357,6 @@ export default {
|
|||
})
|
||||
},
|
||||
async nodeClick(data) {
|
||||
console.log(data)
|
||||
if (this.currentNode.id === data.node.id) return
|
||||
this.curBookImg = data.textBook.curBookImg
|
||||
this.curBookPath = data.textBook.curBookPath
|
||||
|
@ -326,9 +369,9 @@ export default {
|
|||
this.uploadData.textbookId = data.textBook.curBookId
|
||||
this.initHomeWork()
|
||||
await this.asyncAllFile()
|
||||
|
||||
},
|
||||
async initHomeWork() {
|
||||
this.currentWorkList = []
|
||||
if (this.timerId) {
|
||||
clearInterval(this.timerId)
|
||||
}
|
||||
|
@ -337,8 +380,7 @@ export default {
|
|||
let { rows } = await this.getChapterId()
|
||||
if (rows.length > 0) {
|
||||
this.entpcourseid = rows[0].id
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
await this.createEntpcourse()
|
||||
let { rows } = await this.getChapterId()
|
||||
this.entpcourseid = rows[0].id
|
||||
|
@ -350,27 +392,27 @@ export default {
|
|||
},
|
||||
// 创建新的entpcourse
|
||||
createEntpcourse() {
|
||||
var cform = {};
|
||||
cform.entpid = this.userStore.deptId;
|
||||
cform.level = 1;
|
||||
cform.parentid = 0;
|
||||
cform.dictid = 0;
|
||||
cform.evalid = this.currentNode.id;
|
||||
cform.evalparentid = 0;
|
||||
cform.edusubject = this.currentNode.edusubject;
|
||||
cform.edudegree = this.currentNode.edudegree;
|
||||
cform.edustage = this.currentNode.edustage;
|
||||
cform.coursetype = '课标学科';
|
||||
cform.coursetitle = this.currentNode.itemtitle;
|
||||
cform.coursedesc = '';
|
||||
cform.status = '';
|
||||
cform.dflag = 0;
|
||||
cform.edituserid = this.userStore.userId;
|
||||
cform.createblankfile = 'yes';
|
||||
var cform = {}
|
||||
cform.entpid = this.userStore.deptId
|
||||
cform.level = 1
|
||||
cform.parentid = 0
|
||||
cform.dictid = 0
|
||||
cform.evalid = this.currentNode.id
|
||||
cform.evalparentid = 0
|
||||
cform.edusubject = this.currentNode.edusubject
|
||||
cform.edudegree = this.currentNode.edudegree
|
||||
cform.edustage = this.currentNode.edustage
|
||||
cform.coursetype = '课标学科'
|
||||
cform.coursetitle = this.currentNode.itemtitle
|
||||
cform.coursedesc = ''
|
||||
cform.status = ''
|
||||
cform.dflag = 0
|
||||
cform.edituserid = this.userStore.userId
|
||||
cform.createblankfile = 'yes'
|
||||
return addEntpcourse(cform)
|
||||
},
|
||||
openReserv() {
|
||||
// this.$refs['reservDialog'].openDialog()
|
||||
this.$refs['reservDialog'].openDialog()
|
||||
},
|
||||
// 打开外部链接
|
||||
handleOutLink(key) {
|
||||
|
@ -462,9 +504,9 @@ export default {
|
|||
}
|
||||
}
|
||||
// 去重
|
||||
let ary = uniqBy([...this.currentFileList, ...list], 'id')
|
||||
let ary = uniqBy([...list], 'id')
|
||||
// 深度克隆
|
||||
this.currentFileList = cloneDeep(ary)
|
||||
this.currentWorkList = cloneDeep(ary)
|
||||
})
|
||||
},
|
||||
// 打开布置作业窗口
|
||||
|
@ -475,12 +517,14 @@ export default {
|
|||
// 删除作业
|
||||
delhomework(item) {
|
||||
this.isLoading = true
|
||||
delClasswork(item.id).then(async res => {
|
||||
delClasswork(item.id)
|
||||
.then(async (res) => {
|
||||
ElMessage.success('操作成功')
|
||||
this.isLoading = false
|
||||
await this.asyncAllFile()
|
||||
this.getHomeWorkList()
|
||||
}).catch(() => {
|
||||
})
|
||||
.catch(() => {
|
||||
this.isLoading = false
|
||||
})
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue