From ae4f7d3b49e9b7d52009a59591c0b77bb818ad44 Mon Sep 17 00:00:00 2001 From: zhuhao <979263092@qq.com> Date: Fri, 2 Aug 2024 14:18:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8C=E6=9C=9F=EF=BC=9A=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../prepare/container/file-list-item.vue | 61 ++++++---- .../views/resource/container/resoure-list.vue | 108 ++++++++++++------ src/renderer/src/views/resource/index.vue | 46 ++++---- 3 files changed, 137 insertions(+), 78 deletions(-) diff --git a/src/renderer/src/views/prepare/container/file-list-item.vue b/src/renderer/src/views/prepare/container/file-list-item.vue index 07e3489..353a7e6 100644 --- a/src/renderer/src/views/prepare/container/file-list-item.vue +++ b/src/renderer/src/views/prepare/container/file-list-item.vue @@ -6,36 +6,53 @@
- {{ item.fileShowName }} +
+
+ {{ item.fileShowName }} +
+ + + + + {{ item.async === true ? '已同步' : '' }} + {{ !item.async ? '待同步' : '' }} + {{ item.async === 'on' ? '同步中' : '' }} +
-
{{ formatFileSize(item.fileSize) }}
+
{{ formatFileSize(item.fileSize) }}
-
{{ toTimeText(item.uploadTime, true) }}
+
+ {{ toTimeText(item.uploadTime, true) }} +
- - +
+ +
    -
  • +
  • - +
    -
    {{ item.fileShowName }}
    +
    +
    +
    + {{ item.fileShowName }} +
    +
    {{ item.fileFlag }} {{ getFileSuffix(item.fileShowName) }} @@ -18,10 +36,16 @@
    - + - 备课 + 备课
-
- +
-
@@ -69,17 +102,17 @@ import useUserStore from '@/store/modules/user' import useResoureStore from '../store' const { ipcRenderer } = window.electron || {} -const userstore = useUserStore() +const userstore = useUserStore() const sourceStore = useResoureStore() const userInfo = userstore.user // 分页change -const handleSizeChange = (limit) => { +const handleSizeChange = (limit) => { sourceStore.query.pageSize = limit sourceStore.handleQuery() } -const handleCurrentChange = (page) => { +const handleCurrentChange = (page) => { sourceStore.query.pageNum = page sourceStore.handleQuery() } @@ -108,7 +141,7 @@ const editRow = (item) => { } }) }) - .catch(() => { }) + .catch(() => {}) } // 删除 const delRow = (item) => { @@ -128,7 +161,7 @@ const addLesson = ({ id }) => { let data = { id, fileRoot: '备课', - ...(toRaw(sourceStore.nodeData)), + ...toRaw(sourceStore.nodeData) } // 过滤空值 for (let key in data) { @@ -136,19 +169,18 @@ const addLesson = ({ id }) => { delete data[key] } } - + try { sourceStore.loading = true addFileToPrepare(data).then(() => { ElMessage.success('操作成功') }) - } - finally { + } finally { sourceStore.loading = false } } -// -const handleRow = () =>{ +// +const handleRow = () => { ElMessage.warning('请先加入备课,在备课里面进行预览!') } @@ -181,6 +213,10 @@ const handleRow = () =>{ } .resource-list { + flex: 1; + display: flex; + flex-direction: column; + overflow: auto; .list-item { flex: 1; padding: 10px 20px; @@ -189,10 +225,13 @@ const handleRow = () =>{ justify-content: space-between; align-items: center; cursor: pointer; - + &:hover { + background-color: rgba(144, 147, 153, 0.2); + cursor: pointer; + } .item-left { align-items: center; - + flex: 1; .icon { font-size: 50px; } @@ -200,12 +239,14 @@ const handleRow = () =>{ .item-left-content { margin-left: 10px; flex-direction: column; + flex: 1; + text-align: left; } .name { font-size: 14px; color: #3b3b3b; - margin-bottom: 10px + margin-bottom: 10px; } .line { @@ -226,7 +267,6 @@ const handleRow = () =>{ color: #909399; font-size: 13px; } - } &:last-child { @@ -258,15 +298,13 @@ const handleRow = () =>{ margin-right: 3px; font-weight: bold; } - } - } .pagination-box { - margin-top: 20px; display: flex; justify-content: center; + height: 65px; } } - \ No newline at end of file + diff --git a/src/renderer/src/views/resource/index.vue b/src/renderer/src/views/resource/index.vue index d4565dd..4f66881 100644 --- a/src/renderer/src/views/resource/index.vue +++ b/src/renderer/src/views/resource/index.vue @@ -1,21 +1,28 @@ @@ -40,7 +47,7 @@ onMounted(async () => { // const res = await ipcMsgSend('tool-sphere:create', params) // console.log('消息返回:', res) }) -const testClick = async() => { +const testClick = async () => { const win = await createWindow('tool-sphere', { url: '/tool/sphere' }) console.log('消息返回:', win) } @@ -48,12 +55,11 @@ const testClick = async() => { const getData = (data) => { const { textBook, node } = data let textbookId = textBook.curBookId - let levelSecondId = node.id + let levelSecondId = node.id let levelFirstId - if(node.parentNode){ - levelFirstId = node.parentNode.id - } - else{ + if (node.parentNode) { + levelFirstId = node.parentNode.id + } else { levelFirstId = node.id levelSecondId = '' } @@ -63,7 +69,7 @@ const getData = (data) => { sourceStore.nodeData = { textbookId, levelFirstId, - levelSecondId, + levelSecondId } sourceStore.handleQuery() } @@ -73,7 +79,7 @@ const submitFile = (data) => { let fileList = toRaw(data) const { textbookId, levelFirstId, levelSecondId, fileSource, fileRoot } = sourceStore.query // 给每个文件添加属性 - fileList.forEach(item => { + fileList.forEach((item) => { let fileData = { textbookId, levelFirstId, levelSecondId, fileSource, fileRoot } fileData.fileShowName = item.fileData.fileShowName fileData.fileFlag = item.fileData.fileFlag @@ -83,17 +89,15 @@ const submitFile = (data) => { uploaderState().pushFile(fileList) } - const fileCallBack = (res) => { if (res.code == 200) { sourceStore.handleQuery() } } -onMounted(()=>{ +onMounted(() => { sourceStore.getCreate() }) -