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