zhuhao_dev #33

Merged
zhuhao merged 8 commits from zhuhao_dev into main 2024-07-17 21:25:06 +08:00
3 changed files with 64 additions and 24 deletions
Showing only changes of commit 69e835a743 - Show all commits

View File

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

View File

@ -23,3 +23,11 @@ export const updateSmarttalk = (params) => {
params params
}) })
} }
export const moveSmarttalk = (params) => {
return request({
url: '/smarttalk/file/moveSmarttalk',
method: 'post',
params
})
}

View File

@ -8,12 +8,18 @@
<el-popover placement="top-start" :width="250" trigger="hover"> <el-popover placement="top-start" :width="250" trigger="hover">
<template #default> <template #default>
<div> <div>
<el-button type="success" v-if="lastAsyncAllTime" size="small" :icon="Check" circle /> <el-button
{{lastAsyncAllTime?(toTimeText(lastAsyncAllTime) + '同步成功'):''}} v-if="lastAsyncAllTime"
type="success"
size="small"
:icon="Check"
circle
/>
{{ lastAsyncAllTime ? toTimeText(lastAsyncAllTime) + '同步成功' : '' }}
</div> </div>
</template> </template>
<template #reference> <template #reference>
<el-button size="small" @click="asyncAllFile" text> <el-button size="small" text @click="asyncAllFile">
<el-icon v-loading="asyncAllFileVisiable"> <el-icon v-loading="asyncAllFileVisiable">
<Refresh /> <Refresh />
</el-icon> </el-icon>
@ -28,11 +34,7 @@
</div> </div>
</div> </div>
<div class="prepare-body-main"> <div class="prepare-body-main">
<div <div v-for="(item, index) in currentFileList" :key="index" class="prepare-body-main-item">
v-for="(item, index) in currentFileList"
:key="index"
class="prepare-body-main-item"
>
<div class="prepare-body-main-item-icon" @click="openFileWin(item)"> <div class="prepare-body-main-item-icon" @click="openFileWin(item)">
<FileImage :size="50" :file-name="item.fileShowName" /> <FileImage :size="50" :file-name="item.fileShowName" />
</div> </div>
@ -104,8 +106,10 @@
</el-button> </el-button>
</div> </div>
<div class="item-popover-item"> <div class="item-popover-item">
<el-button text> <el-button text @click="isMoveDialogOpen = true">
<el-icon><Switch /></el-icon> <el-icon>
<Switch />
</el-icon>
<span>移动</span> <span>移动</span>
</el-button> </el-button>
</div> </div>
@ -120,6 +124,7 @@
</div> </div>
</div> </div>
</div> </div>
<MoveFile v-model="isMoveDialogOpen" @on-submit="chooseMoveCata" />
<uploadDialog v-model="isDialogOpen" @submit-file="submitFile" /> <uploadDialog v-model="isDialogOpen" @submit-file="submitFile" />
</div> </div>
</template> </template>
@ -132,16 +137,19 @@ import uploadDialog from '@/components/upload-dialog/index.vue'
import { Refresh } from '@element-plus/icons-vue' import { Refresh } from '@element-plus/icons-vue'
import uploaderState from '@/store/modules/uploader' import uploaderState from '@/store/modules/uploader'
import FileImage from '@/components/file-image/index.vue' import FileImage from '@/components/file-image/index.vue'
import { deleteSmarttalk, getSmarttalkPage, updateSmarttalk } from '@/api/file' import MoveFile from '@/components/move-file/index.vue'
import { deleteSmarttalk, getSmarttalkPage, updateSmarttalk, moveSmarttalk } from '@/api/file'
import { toTimeText } from '@/utils/date' import { toTimeText } from '@/utils/date'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import { isHaveLocalFile } from '@/utils/talkFile' import { isHaveLocalFile } from '@/utils/talkFile'
const { ipcRenderer } = window.electron || {} const { ipcRenderer } = window.electron || {}
export default { export default {
name: 'Prepare', name: 'Prepare',
components: { ChooseTextbook, Refresh, uploadDialog, FileImage }, components: { ChooseTextbook, Refresh, uploadDialog, FileImage, MoveFile },
data() { data() {
return { return {
isMoveDialogOpen: false,
asyncAllFileVisiable: false, asyncAllFileVisiable: false,
isLoading: false, isLoading: false,
isDialogOpen: false, isDialogOpen: false,
@ -181,8 +189,8 @@ export default {
async asyncAllFile() { async asyncAllFile() {
this.lastAsyncAllTime = new Date() this.lastAsyncAllTime = new Date()
localStorage.setItem('lastAsyncAllTime', this.lastAsyncAllTime) localStorage.setItem('lastAsyncAllTime', this.lastAsyncAllTime)
let arr = []; let arr = []
this.asyncAllFileVisiable = true; this.asyncAllFileVisiable = true
const test = (item) => { const test = (item) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
isHaveLocalFile(item.fileNewName).then((res) => { isHaveLocalFile(item.fileNewName).then((res) => {
@ -206,7 +214,7 @@ export default {
for (let i = 0; i < this.currentFileList.length; i++) { for (let i = 0; i < this.currentFileList.length; i++) {
await test(this.currentFileList[i]) await test(this.currentFileList[i])
} }
this.asyncAllFileVisiable = false; this.asyncAllFileVisiable = false
}, },
openFileWin(item) { openFileWin(item) {
isHaveLocalFile(item.fileNewName).then((res) => { isHaveLocalFile(item.fileNewName).then((res) => {
@ -274,6 +282,27 @@ export default {
closePopver(index) { closePopver(index) {
this.$refs['popover_' + index][0].hide() this.$refs['popover_' + index][0].hide()
}, },
chooseMoveCata(cataData, item) {
let params = {
id: item.id,
textBookId: cata.textBook.curBookId,
}
let cata = this.parseCataByNode(cataData.node)
if (cata.length > 0) {
params.levelFirstId = cata[0];
}
if (cata.length > 1) {
params.levelSecondId = cata[1];
}
if (cata.length > 2) {
params.levelThirdId = cata[2];
}
moveSmarttalk(params).then((res) => {
if (res.data === true) {
this.isMoveDialogOpen = false
}
})
},
submitFile(files) { submitFile(files) {
let _this = this let _this = this
files.filter((file) => { files.filter((file) => {
@ -284,7 +313,7 @@ export default {
res.resData.levelSecondId == _this.uploadData.levelSecondId && res.resData.levelSecondId == _this.uploadData.levelSecondId &&
res.resData.levelThirdId == _this.uploadData.levelThirdId res.resData.levelThirdId == _this.uploadData.levelThirdId
) { ) {
res.resData.async = true; res.resData.async = true
_this.currentFileList.unshift(res.resData) _this.currentFileList.unshift(res.resData)
ElMessage({ ElMessage({
type: 'success', type: 'success',
@ -367,11 +396,13 @@ export default {
color: #a2a2a2; color: #a2a2a2;
} }
} }
.prepare-item-info-message { .prepare-item-info-message {
.circular { .circular {
width: 100% !important; width: 100% !important;
} }
} }
.prepare-body-header { .prepare-body-header {
.circular { .circular {
width: 100% !important; width: 100% !important;
@ -454,6 +485,7 @@ export default {
line-height: 23px; line-height: 23px;
color: #909399; color: #909399;
display: flex; display: flex;
.circular { .circular {
width: 100% !important; width: 100% !important;
} }