Merge pull request 'lyc-dev' (#29) from lyc-dev into main

This commit is contained in:
lyc 2024-07-17 15:19:19 +08:00
commit 17fca86860
10 changed files with 85 additions and 31 deletions

View File

@ -8,8 +8,8 @@ File({ app, shell, BrowserWindow, ipcMain })
function createWindow() { function createWindow() {
// Create the browser window. // Create the browser window.
const mainWindow = new BrowserWindow({ const mainWindow = new BrowserWindow({
width: 1050, width: 888,
height: 650, height: 520,
show: false, show: false,
frame: false, frame: false,
autoHideMenuBar: true, autoHideMenuBar: true,

View File

@ -8,7 +8,6 @@
import { ref } from 'vue' import { ref } from 'vue'
const size = ref('default') const size = ref('default')
// const size = computed(() => store.state.app.elementSize)
</script> </script>
<style> <style>

View File

@ -7,4 +7,13 @@ export const listEvaluation = (params)=> {
method: 'get', method: 'get',
params params
}) })
} }
export const addFileToPrepare = (params) => {
return request({
url: '/smarttalk/file/addFileToPrepare',
method: 'post',
params
})
}

View File

@ -14,6 +14,9 @@
import Header from './components/Header.vue' import Header from './components/Header.vue'
import AppMain from './components/AppMain.vue' import AppMain from './components/AppMain.vue'
import Uploader from './components/Uploader.vue' import Uploader from './components/Uploader.vue'
const { ipcRenderer } = window.electron || {}
ipcRenderer.send('set-winsize', { x: 1200, y: 700 })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -12,7 +12,7 @@ export const constantRoutes = [
{ {
path: '/', path: '/',
component: Layout, component: Layout,
redirect: '/resource', redirect: '/login',
children: [ children: [
{ {
path: '/resource', path: '/resource',

View File

@ -43,10 +43,10 @@ import { encrypt, decrypt } from '@/utils/jsencrypt'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import leftBg2 from '@/assets/images/login/left-bg2.png' import leftBg2 from '@/assets/images/login/left-bg2.png'
const { ipcRenderer } = window.electron || {}
const formRef = ref() const formRef = ref()
const userStore = useUserStore() const userStore = useUserStore()
const router = useRouter() const router = useRouter()
const { ipcRenderer } = window.electron || {}
const isMaxSize = ref(false) const isMaxSize = ref(false)
const btnLoading = ref(false) const btnLoading = ref(false)
// //
@ -61,6 +61,8 @@ const rules = reactive({
password: [{ required: true, trigger: 'blur', message: '请输入您的密码' }] password: [{ required: true, trigger: 'blur', message: '请输入您的密码' }]
}) })
ipcRenderer.send('set-winsize', { x: 888, y: 520 })
// //
const submitForm = async (formEl) => { const submitForm = async (formEl) => {
if (!formEl) return if (!formEl) return
@ -101,7 +103,6 @@ const getCookie = () => {
} }
onMounted(()=>{ onMounted(()=>{
// ipcRenderer.send('set-winsize',{x:888,y: 520})
getCookie() getCookie()
}) })
// //

View File

@ -5,12 +5,12 @@
<ul> <ul>
<li class="list-item" v-for="item in sourceStore.result.list" :key="item.id"> <li class="list-item" v-for="item in sourceStore.result.list" :key="item.id">
<div class="item-left flex"> <div class="item-left flex">
<FileImage :fileName="item.fileName" :size="50" /> <FileImage :fileName="item.fileShowName" :size="50" />
<div class="flex item-left-content"> <div class="flex item-left-content">
<div class="name flex">{{ item.fileShowName }}</div> <div class="name flex">{{ item.fileShowName }}</div>
<div class="item-tags flex"> <div class="item-tags flex">
<el-tag type="info" class="mr-10">{{ item.fileFlag }}</el-tag> <el-tag type="info" class="mr-10">{{ item.fileFlag }}</el-tag>
<el-tag type="info" class="mr-10">{{ getFileSuffix(item.fileName) }}</el-tag> <el-tag type="info" class="mr-10">{{ getFileSuffix(item.fileShowName) }}</el-tag>
<span class="gray-text mr-10">{{ item.uploadTime }}上传</span> <span class="gray-text mr-10">{{ item.uploadTime }}上传</span>
<!-- <span class="line mr-10"></span> <!-- <span class="line mr-10"></span>
<span class="gray-text mr-10">下载3次</span> --> <span class="gray-text mr-10">下载3次</span> -->
@ -37,15 +37,11 @@
<i class="iconfont icon-xiazai"></i> <i class="iconfont icon-xiazai"></i>
<span>下载</span> <span>下载</span>
</div> </div>
<div class="item-popover-item" @click="moveFile(item)">
<i class="iconfont icon-xiazai"></i>
<span>移动至</span>
</div>
</div> </div>
</template> </template>
</el-popover> </el-popover>
<el-button size="small" plain round type="primary" @click="addLesson(item)">
<el-button size="small" plain round type="primary">
<i class="iconfont icon-jiahao"></i> <i class="iconfont icon-jiahao"></i>
备课</el-button> 备课</el-button>
</div> </div>
@ -58,15 +54,16 @@
:page-sizes="[10, 20, 30, 50]" background layout="total, sizes, prev, pager, next, jumper" :page-sizes="[10, 20, 30, 50]" background layout="total, sizes, prev, pager, next, jumper"
:total="sourceStore.result.total" @size-change="handleSizeChange" @current-change="handleCurrentChange" /> :total="sourceStore.result.total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
</div> </div>
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref } from 'vue' import { toRaw } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import FileImage from '@/components/file-image/index.vue' import FileImage from '@/components/file-image/index.vue'
import { deleteSmarttalk, updateSmarttalk } from '@/api/file' import { deleteSmarttalk, updateSmarttalk } from '@/api/file'
import { addFileToPrepare } from '@/api/subject'
import { getFileSuffix } from '@/utils/ruoyi' import { getFileSuffix } from '@/utils/ruoyi'
import useResoureStore from '../store' import useResoureStore from '../store'
@ -114,11 +111,40 @@ const delRow = (item) => {
} }
} }
// //
const moveFile = (item) => { const addLesson = ({ id }) => {
moveDialogVisible.value = true let data = {
id,
fileRoot: '资源',
...(toRaw(sourceStore.nodeData)),
}
//
for (let key in data) {
if (!data[key]) {
delete data[key]
}
}
try {
sourceStore.loading = true
addFileToPrepare(data).then(() => {
ElMessage.success('操作成功')
})
}
finally {
sourceStore.loading = false
}
// ElMessageBox.confirm('', '', {
// confirmButtonText: '',
// cancelButtonText: '',
// type: 'warning'
// }).then(() => {
// ElMessage.success('')
// }).catch(() => { })
} }
</script> </script>
<style> <style>

View File

@ -13,8 +13,8 @@
</el-row> </el-row>
<el-row class="resoure-btns"> <el-row class="resoure-btns">
<el-col :span="24" class="query-row flex"> <el-col :span="24" class="query-row flex">
<div class="flex row-left"> <el-select v-model="sourceStore.query.fileSuffix" <div class="flex row-left"> <el-select v-model="sourceStore.query.fileSuffix" @change="sourceStore.changeSuffix"
style="width: 100px"> style="width: 110px">
<el-option v-for="item in sourceStore.resourceFormatList" :key="item.value" :label="item.label" <el-option v-for="item in sourceStore.resourceFormatList" :key="item.value" :label="item.label"
:value="item.value" /> :value="item.value" />
</el-select> </el-select>

View File

@ -16,7 +16,6 @@
</div> </div>
<!-- 上传弹窗 --> <!-- 上传弹窗 -->
<uploadDialog v-model="isDialogOpen" @submitFile="submitFile" /> <uploadDialog v-model="isDialogOpen" @submitFile="submitFile" />
<!-- <MoveFile v-model="isDialogOpen" @onSubmit="onSubmit" /> -->
</template> </template>
<script setup> <script setup>
@ -26,7 +25,6 @@ import ChooseTextbook from '@/components/choose-textbook/index.vue'
import ResoureSearch from './container/resoure-search.vue' import ResoureSearch from './container/resoure-search.vue'
import ResoureList from './container/resoure-list.vue' import ResoureList from './container/resoure-list.vue'
import uploadDialog from '@/components/upload-dialog/index.vue' import uploadDialog from '@/components/upload-dialog/index.vue'
import MoveFile from '@/components/move-file/index.vue'
import uploaderState from '@/store/modules/uploader' import uploaderState from '@/store/modules/uploader'
const sourceStore = useResoureStore() const sourceStore = useResoureStore()
@ -55,24 +53,29 @@ const nodeClick = (data) => {
// //
const getData = (data) => { const getData = (data) => {
const { textBook, node } = data const { textBook, node } = data
let textBookId = textBook.curBookId let textbookId = textBook.curBookId
let levelFirstId = node.id let levelFirstId = node.id
let levelSecondId = node.parentNode ? node.parentNode.id : '' let levelSecondId = node.parentNode ? node.parentNode.id : ''
sourceStore.query = { sourceStore.query = {
textBookId, textbookId,
levelFirstId, levelFirstId,
levelSecondId, levelSecondId,
...sourceStore.query ...sourceStore.query
} }
sourceStore.nodeData = {
textbookId,
levelFirstId,
levelSecondId,
}
sourceStore.handleQuery() sourceStore.handleQuery()
} }
// //
const submitFile = (data) => { const submitFile = (data) => {
let fileList = toRaw(data) let fileList = toRaw(data)
const { textBookId, levelFirstId, levelSecondId, fileSource, fileRoot } = sourceStore.query const { textbookId, levelFirstId, levelSecondId, fileSource, fileRoot } = sourceStore.query
// //
let fileData = { textBookId, levelFirstId, levelSecondId, fileSource, fileRoot } let fileData = { textbookId, levelFirstId, levelSecondId, fileSource, fileRoot }
fileList.forEach(item => { fileList.forEach(item => {
fileData.fileShowName = item.fileData.fileShowName fileData.fileShowName = item.fileData.fileShowName
fileData.fileFlag = item.fileData.fileFlag fileData.fileFlag = item.fileData.fileFlag

View File

@ -15,7 +15,7 @@ const resourceTypeList = [
const resourceFormatList = [ const resourceFormatList = [
{ {
label: '资源格式', label: '资源格式',
value: '' value: -1
}, },
...resourceFormat ...resourceFormat
] ]
@ -42,11 +42,16 @@ export default defineStore('resource', {
searchKey: '', searchKey: '',
// 新建资源 // 新建资源
isCreate: false, isCreate: false,
//节点数据
nodeData:{},
loading: false, loading: false,
//查询条件 //查询条件
query: { query: {
fileSource: '平台', fileSource: '平台',
fileSuffix: '', //资源格式 mp3 ppt ...
fileSuffix: -1,
// 资源类型 课件 素材 教案
fileFlag: '', fileFlag: '',
fileRoot: '资源', fileRoot: '资源',
orderByColumn: 'uploadTime', orderByColumn: 'uploadTime',
@ -62,7 +67,11 @@ export default defineStore('resource', {
handleQuery() { handleQuery() {
try { try {
this.loading = true this.loading = true
getSmarttalkPage(this.query).then((res) => { let data = {...this.query}
if(data.fileSuffix == -1){
data.fileSuffix = ''
}
getSmarttalkPage(data).then((res) => {
this.result.total = res.total this.result.total = res.total
this.result.list = res.rows this.result.list = res.rows
}) })
@ -77,6 +86,10 @@ export default defineStore('resource', {
changeType(val) { changeType(val) {
this.query.fileFlag = val this.query.fileFlag = val
this.handleQuery() this.handleQuery()
},
changeSuffix(val){
this.query.fileSuffix = val
this.handleQuery()
} }
} }
}) })