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() {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 1050,
height: 650,
width: 888,
height: 520,
show: false,
frame: false,
autoHideMenuBar: true,

View File

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

View File

@ -8,3 +8,12 @@ export const listEvaluation = (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 AppMain from './components/AppMain.vue'
import Uploader from './components/Uploader.vue'
const { ipcRenderer } = window.electron || {}
ipcRenderer.send('set-winsize', { x: 1200, y: 700 })
</script>
<style lang="scss" scoped>

View File

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

View File

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

View File

@ -5,12 +5,12 @@
<ul>
<li class="list-item" v-for="item in sourceStore.result.list" :key="item.id">
<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="name flex">{{ item.fileShowName }}</div>
<div class="item-tags flex">
<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="line mr-10"></span>
<span class="gray-text mr-10">下载3次</span> -->
@ -37,15 +37,11 @@
<i class="iconfont icon-xiazai"></i>
<span>下载</span>
</div>
<div class="item-popover-item" @click="moveFile(item)">
<i class="iconfont icon-xiazai"></i>
<span>移动至</span>
</div>
</div>
</template>
</el-popover>
<el-button size="small" plain round type="primary">
<el-button size="small" plain round type="primary" @click="addLesson(item)">
<i class="iconfont icon-jiahao"></i>
备课</el-button>
</div>
@ -63,10 +59,11 @@
</template>
<script setup>
import { ref } from 'vue'
import { toRaw } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import FileImage from '@/components/file-image/index.vue'
import { deleteSmarttalk, updateSmarttalk } from '@/api/file'
import { addFileToPrepare } from '@/api/subject'
import { getFileSuffix } from '@/utils/ruoyi'
import useResoureStore from '../store'
@ -114,11 +111,40 @@ const delRow = (item) => {
}
}
//
const moveFile = (item) => {
moveDialogVisible.value = true
//
const addLesson = ({ id }) => {
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>
<style>

View File

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

View File

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

View File

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