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

Reviewed-on: #122
This commit is contained in:
朱浩 2024-08-13 11:28:27 +08:00
commit 67320f897e
5 changed files with 173 additions and 75 deletions

View File

@ -24,8 +24,8 @@ export default defineConfig({
server: {
proxy: {
'/dev-api': {
// target: 'http://27.128.240.72:7865',
target: 'http://192.168.2.52:7863',
target: 'http://27.128.240.72:7865',
// target: 'http://192.168.2.52:7863',
changeOrigin: true,
rewrite: (p) => p.replace(/^\/dev-api/, '')
}

View File

@ -1,6 +1,6 @@
{
"name": "aix-win",
"version": "1.0.6",
"version": "1.0.7",
"description": "An Electron application with Vue",
"main": "./out/main/index.js",
"author": "example.com",

View File

@ -42,6 +42,11 @@ const updateInit = (win) => {
logger.error('检查更新失败')
})
// 监听下载进度
autoUpdater.on('download-progress', (progressObj) => {
win.webContents.send('update-app-progress', progressObj.percent);
});
// 跟新下载完毕
autoUpdater.on('update-downloaded', () => {
dialog

View File

@ -7,24 +7,47 @@
<img class="welcome-img" :src="leftBg2" />
</div>
<div class="box-item login">
<WindowTools :isHasMax="false" />
<WindowTools :is-has-max="false" />
<div class="login-title">账号登录</div>
<el-form ref="formRef" class="login-form" :model="loginForm" :rules="rules" size="large">
<el-form-item prop="username">
<el-input v-model.trim="loginForm.username" placeholder="请输入用户名" />
</el-form-item>
<el-form-item prop="password" style="margin-bottom: 15px">
<el-input v-model="loginForm.password" autocomplete="on" type="password" placeholder="请输入密码" />
<el-input
v-model="loginForm.password"
autocomplete="on"
type="password"
placeholder="请输入密码"
/>
</el-form-item>
<el-checkbox class="flex mb-5" v-model="loginForm.rememberMe">记住密码</el-checkbox>
<el-checkbox v-model="loginForm.rememberMe" class="flex mb-5">记住密码</el-checkbox>
<el-form-item>
<el-button :loading="btnLoading" class="btn" type="primary" @click="submitForm(formRef)">登录</el-button>
<el-button :loading="btnLoading" class="btn" type="primary" @click="submitForm(formRef)"
>登录</el-button
>
</el-form-item>
</el-form>
</div>
</div>
<el-dialog
v-model="showDownLoading"
width="500"
:show-close="false"
:close-on-click-modal="false"
:close-on-press-escape="false"
align-center
>
<el-progress
:text-inside="true"
:stroke-width="22"
:percentage="downloadProp"
:show-text="false"
status="success"
/>
</el-dialog>
<!--选择学科-->
<SelectSubject v-model="isSubject" :loginData="loginForm" @onSuccess="successEditSubject"/>
<SelectSubject v-model="isSubject" :login-data="loginForm" @on-success="successEditSubject" />
</template>
<script setup>
import { onMounted, reactive, ref } from 'vue'
@ -36,7 +59,8 @@ import WindowTools from '@/components/window-tools/index.vue'
import SelectSubject from '@/components/select-subject/index.vue'
const { session } = require('@electron/remote')
const downloadProp = ref(0)
const showDownLoading = ref(false)
const { ipcRenderer } = window.electron || {}
const formRef = ref()
const userStore = useUserStore()
@ -55,7 +79,11 @@ const rules = reactive({
password: [{ required: true, trigger: 'blur', message: '请输入您的密码' }]
})
let curWinUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH;
let curWinUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH
ipcRenderer.on('update-app-progress', (e, prop) => {
downloadProp.value = prop
showDownLoading.value = prop !== 100
})
//
const submitForm = async (formEl) => {
@ -83,11 +111,9 @@ const submitForm = async (formEl) => {
if (userStore.user.edustage || userStore.user.edusubject) {
ElMessage.success('登录成功')
ipcRenderer && ipcRenderer.send('openMainWindow')
}
else {
} else {
isSubject.value = true
}
} finally {
btnLoading.value = false
}
@ -118,7 +144,7 @@ const getCookieDetail = (name) => {
// cookie
const setCookie = (name, value) => {
// 30
let Days = 30;
let Days = 30
let times = Math.round(Date.now() / 1000) + Days * 24 * 60 * 60
const cookie = {
url: curWinUrl,
@ -129,8 +155,6 @@ const setCookie = (name, value) => {
return session.defaultSession.cookies.set(cookie)
}
onMounted(() => {
localStorage.clear()
getCookie()

View File

@ -5,7 +5,12 @@
<div class="header-top flex">
<div class="textbook-img">
<el-image style="width: 80px; height: 110px" :src="curBookImg" @click="navtoPdf" />
<el-progress v-if="downloadNum>0 && downloadNum < 100" style="position:absolute;left: 0;z-index: 999;" type="circle" :percentage="downloadNum" />
<el-progress
v-if="downloadNum > 0 && downloadNum < 100"
style="position: absolute; left: 0; z-index: 999"
type="circle"
:percentage="downloadNum"
/>
</div>
<div class="top-item">
<el-button class="btn" @click="handleOutLink('standard')">课标研读</el-button>
@ -13,7 +18,12 @@
<el-button class="btn" @click="handleOutLink('gk')">高考研读</el-button>
<el-button class="btn" @click="handleOutLink('aiModel')">教学大模型</el-button>
</div>
<el-button :type="!curClassReserv.id?'info' : 'primary'" :disabled="!curClassReserv.id" class="to-class-btn" @click="openLesson">
<el-button
:type="!curClassReserv.id ? 'info' : 'primary'"
:disabled="!curClassReserv.id"
class="to-class-btn"
@click="openLesson"
>
<label><i class="iconfont icon-lingdang"></i>上课</label>
<label>{{ curClassReserv.classDay }} {{ getWeekday1(curClassReserv.classDay) }}</label>
<label>{{ curClassReserv.startTime }}-{{ curClassReserv.endTime }}</label>
@ -26,7 +36,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>
@ -44,26 +60,67 @@
<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="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" @add-success="initReserv" :current-node="currentNode" :book-id="uploadData.textbookId"></reserv>
<reserv
ref="reservDialog"
:current-node="currentNode"
:book-id="uploadData.textbookId"
@add-success="initReserv"
></reserv>
</template>
<script setup>
import { Check } from '@element-plus/icons-vue'
@ -118,6 +175,7 @@ export default {
fileList: [],
currentNode: {},
currentFileList: [],
currentWorkList: [],
curBookPath: '',
curClassReserv: {},
downloadNum: 0,
@ -165,9 +223,12 @@ export default {
this.initReserv()
},
mounted() {
this.$watch(()=>toolStore.isToolWin,(newD, oldD)=>{
this.$watch(
() => toolStore.isToolWin,
(newD, oldD) => {
setTimeout(this.initReserv, 500)
})
}
)
},
// activated() {
// if (this.uploadData.textbookId !== null) {
@ -360,7 +421,6 @@ export default {
toolStore.curSubjectNode.querySearch = this.uploadData
this.initHomeWork()
await this.asyncAllFile()
},
async initHomeWork() {
if (this.timerId) {
@ -371,8 +431,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
@ -385,23 +444,23 @@ export default {
// entpcourse
createEntpcourse() {
// web AIx
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() {
@ -500,7 +559,7 @@ export default {
//
let ary = uniqBy([...this.currentFileList, ...list], 'id')
//
this.currentFileList = cloneDeep(ary)
this.currentWorkList = cloneDeep(ary)
})
},
getWeekday1(date) {
@ -516,12 +575,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
})
},
@ -542,7 +603,15 @@ export default {
const toolStore = useToolState()
if (toolStore.isToolWin) return this.$message.error('您当前已开始上课,请勿重复操作')
startClass(this.curClassReserv.id)
createWindow('tool-sphere', { url: '/tool/sphere?entpcourseid=' + this.entpcourseid +'&label=' + this.currentNode.label+ "&reservId=" + this.curClassReserv.id })
createWindow('tool-sphere', {
url:
'/tool/sphere?entpcourseid=' +
this.entpcourseid +
'&label=' +
this.currentNode.label +
'&reservId=' +
this.curClassReserv.id
})
}
}
}