Merge pull request 'zhuhao_dev' (#270) from zhuhao_dev into main

Reviewed-on: #270
This commit is contained in:
朱浩 2024-09-25 15:28:33 +08:00
commit 49f87a4709
6 changed files with 64 additions and 36 deletions

View File

@ -17,7 +17,7 @@
"build:test": "electron-vite build --mode test && electron-builder --win --config ./electron-builder.yml", "build:test": "electron-vite build --mode test && electron-builder --win --config ./electron-builder.yml",
"build:prod": "electron-vite build --mode production && electron-builder --win --config ./electron-builder-prod.yml", "build:prod": "electron-vite build --mode production && electron-builder --win --config ./electron-builder-prod.yml",
"build:lt": "electron-vite build --mode lt && electron-builder --win --config ./electron-builder-lt.yml", "build:lt": "electron-vite build --mode lt && electron-builder --win --config ./electron-builder-lt.yml",
"build:mac": "npm run build && electron-builder --mac", "build:mac": "electron-vite build --mode production && electron-builder --mac --config ./electron-builder-prod.yml",
"build:linux": "npm run build && electron-builder --linux" "build:linux": "npm run build && electron-builder --linux"
}, },
"dependencies": { "dependencies": {

View File

@ -6,6 +6,7 @@
<script setup> <script setup>
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { getAppInstallUrl } from '@/utils/tool'
const props = defineProps({ const props = defineProps({
url: { url: {
type: String, type: String,
@ -16,7 +17,7 @@ const props = defineProps({
/**pdf文件地址 */ /**pdf文件地址 */
const pdfUrl = ref(''); const pdfUrl = ref('');
/**pdfjs文件地址 */ /**pdfjs文件地址 */
const fileUrl = '/pdfjs-dist/web/viewer.html?file='; const fileUrl = getAppInstallUrl('pdfjs-dist/web/viewer.html', 'user', '\\out\\renderer', true) + "?file=" //
onMounted(() => { onMounted(() => {
/** 将传入的pdf地址进行编码防止中文识别错误 */ /** 将传入的pdf地址进行编码防止中文识别错误 */
pdfUrl.value = fileUrl + encodeURIComponent(props.url) pdfUrl.value = fileUrl + encodeURIComponent(props.url)

View File

@ -49,6 +49,18 @@ export const getStaticUrl = (url = '', type = 'app', exitPath = '', isFile = fal
} }
} }
} }
export const getAppInstallUrl = (url = '', type = 'app', exitPath = '', isFile = false) => {
if (isDev) return url
else { // 生产环境获取-url
switch(type) {
case 'app': return path.join(__dirname, url) // 应用目录
case 'user': return (isFile?'file://':'')+path.join(Remote.app.getAppPath(),exitPath, url) // 用户目录
// case 'user': return (isFile?'file://':'')+path.join(Remote.app.getPath('userData'),exitPath, url) // 用户目录
default: return ''
}
}
}
/** /**
* @description 消息发送-nodejs 消息发送 * @description 消息发送-nodejs 消息发送
* @form src/main/tool.js 来源 * @form src/main/tool.js 来源
@ -137,7 +149,7 @@ export const createWindow = async (type, data) => {
winPdf.focus(); winPdf.focus();
// toolState.isPdfWin=true // toolState.isPdfWin=true
} }
return return
} }
const option = data.option||{} const option = data.option||{}
@ -272,7 +284,7 @@ const eventHandles = (type, win) => {
winPdf=null winPdf=null
win&&win.destroy() win&&win.destroy()
}) })
// 监听窗口的激活事件 // 监听窗口的激活事件
win.on('focus', async () => { win.on('focus', async () => {
console.log('激活窗口') console.log('激活窗口')
@ -299,8 +311,8 @@ const eventHandles = (type, win) => {
/** /**
* @description 外部跳转-web网页 * @description 外部跳转-web网页
* @param {*} path * @param {*} path
* @param {*} params * @param {*} params
*/ */
export const toLinkWeb = (path) => { export const toLinkWeb = (path) => {
const config = baseConfig() const config = baseConfig()

View File

@ -1,14 +1,14 @@
<template> <template>
<el-dialog v-model="visible" width="75%" :close-on-click-modal="false" <el-dialog v-model="visible" width="35%" :close-on-click-modal="false"
@close="handleClose"> @close="handleClose">
<template #header><b>准备开始上课</b></template> <template #header><div style="width: 100%;text-align: left"><b>开始上课APT</b></div></template>
<div class="class-all"> <div class="class-all">
<el-row> <el-row>
<el-col :span="10"> <!-- <el-col :span="10">
<c-form v-bind="classForm"> <c-form v-bind="classForm">
<template #item_classid="{prop, form}"> <template #item_classid="{prop, form}">
<el-select v-model="form[prop]" placeholder="请选择班级"> <el-select v-model="form[prop]" placeholder="请选择班级">
<el-option v-for="item in listData.classList" :value="item.id" <el-option v-for="item in listData.classList" :value="item.id"
:label="`${item.caption} (${item.classstudentcount}人)`" /> :label="`${item.caption} (${item.classstudentcount}人)`" />
</el-select> </el-select>
</template> </template>
@ -20,8 +20,16 @@
</el-scrollbar> </el-scrollbar>
</template> </template>
</c-form> </c-form>
</el-col> </el-col>-->
<el-col :span="14"> <el-col :span="24">
<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>
</c-form>
<c-form v-bind="teacherForm"> <c-form v-bind="teacherForm">
<!-- 上课 --> <!-- 上课 -->
<template #item_classcourseid="{prop,form}"> <template #item_classcourseid="{prop,form}">
@ -44,7 +52,7 @@
<div :title="value" v-if="!!value"> <div :title="value" v-if="!!value">
<vue-qr :text="value" :size="200" :margin="10" colorDark="green" colorLight="white" :logoSrc="getStaticUrl('/img/logo.png')" :logoScale="0.2" :dotScale="0.7"></vue-qr> <vue-qr :text="value" :size="200" :margin="10" colorDark="green" colorLight="white" :logoSrc="getStaticUrl('/img/logo.png')" :logoScale="0.2" :dotScale="0.7"></vue-qr>
</div> </div>
<el-button type="warning" :loading="dt.loadingDel" @click="removeClasscourse()">删除记录</el-button> <!-- <el-button type="warning" :loading="dt.loadingDel" @click="removeClasscourse()">删除记录</el-button>-->
</template> </template>
<!-- 手机登录 --> <!-- 手机登录 -->
<template #item_mobile> <template #item_mobile>
@ -90,7 +98,6 @@ const visible = ref(false) // 是否打开窗口
const myClassActive = ref({}) // APT const myClassActive = ref({}) // APT
const imChatRef = ref(null) // im-chat ref const imChatRef = ref(null) // im-chat ref
const emit = defineEmits(['close']) const emit = defineEmits(['close'])
const classForm = reactive({ // () const classForm = reactive({ // ()
form: {}, itemOption: [], option: {} form: {}, itemOption: [], option: {}
}) })
@ -132,7 +139,7 @@ const open = async (id) => {
nextTick(async() => { nextTick(async() => {
chat = await imChatRef.value?.initImChat() chat = await imChatRef.value?.initImChat()
}) })
} }
} }
// //
const handleClose = async () => { const handleClose = async () => {
@ -144,15 +151,16 @@ const handleClose = async () => {
// - // -
const initData = () => { const initData = () => {
// - // -
classForm.option = { labelW: 40 } classForm.option = { labelW: 80 }
classForm.itemOption = [ classForm.itemOption = [
{ label: '班级', prop: 'classid' }, { label: '班级', prop: 'classid' },
{ label: '学生', prop: 'student' }, // { label: '', prop: 'student' },
] ]
// - // -
teacherForm.form = { classcourseid: 0 } teacherForm.form = { classcourseid: 0 }
teacherForm.itemOption = [ teacherForm.itemOption = [
{ label: '上课', prop: 'classcourseid' }, // { label: '', prop: 'classid' },
// { label: '', prop: 'classcourseid' },
{ label: '老师扫码', prop: 'qrUrl', show: false }, { label: '老师扫码', prop: 'qrUrl', show: false },
{ label: '手机登录', prop: 'mobile', show: false }, { label: '手机登录', prop: 'mobile', show: false },
{ label: '故障备用', prop: 'backup', show: false }, { label: '故障备用', prop: 'backup', show: false },
@ -187,10 +195,10 @@ const getClassList = async () => {
return o return o
}); });
// //
if (listData.classList.length > 0) { /*if (listData.classList.length > 0) {
classForm.form.classid = listData.classList[0].id classForm.form.classid = listData.classList[0].id
} }*/
} }
} }
// - // -
@ -217,8 +225,12 @@ const getClasscourseList = async type => {
} }
// //
const createClasscourse = async () => { const createClasscourse = async () => {
dt.loading = true
const { classid } = classForm.form const { classid } = classForm.form
if (!classid) {
ElMessage.warning('请选择班级')
return
}
dt.loading = true
const { entpcourseid, evalid, id, coursetitle } = myClassActive.value // const { entpcourseid, evalid, id, coursetitle } = myClassActive.value //
const curDate = commUtil.getDateNow('yyyy-MM-dd') const curDate = commUtil.getDateNow('yyyy-MM-dd')
const params = { const params = {
@ -329,4 +341,4 @@ defineExpose({
.class-all{ .class-all{
text-align: left; text-align: left;
} }
</style> </style>

View File

@ -2,10 +2,10 @@
<el-dialog <el-dialog
v-model="centerDialogVisible" v-model="centerDialogVisible"
class="reserv-dialog" class="reserv-dialog"
title="上课" title="开始上课PPT"
destroy-on-close destroy-on-close
:before-close="closeDialog" :before-close="closeDialog"
width="600" width="35%"
style="text-align: left" style="text-align: left"
> >
<el-form <el-form
@ -15,7 +15,7 @@
label-width="auto" label-width="auto"
style="max-width: 600px" style="max-width: 600px"
> >
<el-form-item label="课程名称" prop="name"> <!-- <el-form-item label="课程名称" prop="name">
<el-input v-model="form.name" /> <el-input v-model="form.name" />
</el-form-item> </el-form-item>
<el-form-item label="课程类型" prop="type"> <el-form-item label="课程类型" prop="type">
@ -59,17 +59,21 @@
/> />
</el-col> </el-col>
</el-form-item> </el-form-item>
</el-form-item> </el-form-item>-->
<el-form-item label="授课对象" prop="resource"> <el-form-item label-width="80px" label="班级" prop="resource">
<el-checkbox-group v-model="form.resource"> <el-select v-model="form.resource" placeholder="请选择班级">
<el-option v-for="(item, index) in classList" :value="item.id"
:label="`${item.caption} (${item.classstudentcount}人)`" />
</el-select>
<!-- <el-checkbox-group v-model="form.resource">
<el-checkbox v-for="(item, index) in classList" :key="index" name="type" :value="item.id" <el-checkbox v-for="(item, index) in classList" :key="index" name="type" :value="item.id"
>{{ item.caption }}({{ item.classstudentcount }}) >{{ item.caption }}({{ item.classstudentcount }})
</el-checkbox> </el-checkbox>
</el-checkbox-group> </el-checkbox-group>-->
</el-form-item> </el-form-item>
<el-form-item label="教室" prop="classRoom"> <!-- <el-form-item label="教室" prop="classRoom">
<el-input v-model="form.classRoom" /> <el-input v-model="form.classRoom" />
</el-form-item> </el-form-item>-->
</el-form> </el-form>
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
@ -272,7 +276,7 @@ const updateClassReserv = (formData) => {
}) })
} }
const addClassReserv = (formData) => { const addClassReserv = (formData) => {
let ids = formData.resource.join(',') let ids = formData.resource
// //
if(!props.bookId){ if(!props.bookId){
ElMessage.warning('请选择教材') ElMessage.warning('请选择教材')
@ -293,10 +297,10 @@ const addClassReserv = (formData) => {
addSmartClassReserv(param).then((res) => { addSmartClassReserv(param).then((res) => {
if (res.msg) { if (res.msg) {
closeDialog() closeDialog()
ElMessage({ /*ElMessage({
type: 'success', type: 'success',
message: '预约成功!' message: '预约成功!'
}) })*/
emit('addSuccess',res.msg) emit('addSuccess',res.msg)
} else { } else {
ElMessage({ ElMessage({

View File

@ -313,7 +313,6 @@ export default {
this.openReserv() this.openReserv()
} }
if(item.fileFlag === 'apt') { if(item.fileFlag === 'apt') {
//TODO apt - fileId: aptId
this.$refs.calssRef.open(item.fileId) this.$refs.calssRef.open(item.fileId)
} }
// -store // -store