|
|
|
@ -8,16 +8,22 @@
|
|
|
|
|
<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>
|
|
|
|
|
{{asyncAllFileVisiable?'同步中':'云同步'}}
|
|
|
|
|
{{ asyncAllFileVisiable ? '同步中' : '云同步' }}
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-popover>
|
|
|
|
@ -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,
|
|
|
|
@ -180,14 +188,14 @@ export default {
|
|
|
|
|
methods: {
|
|
|
|
|
async asyncAllFile() {
|
|
|
|
|
this.lastAsyncAllTime = new Date()
|
|
|
|
|
localStorage.setItem('lastAsyncAllTime',this.lastAsyncAllTime)
|
|
|
|
|
let arr = [];
|
|
|
|
|
this.asyncAllFileVisiable = true;
|
|
|
|
|
localStorage.setItem('lastAsyncAllTime', this.lastAsyncAllTime)
|
|
|
|
|
let arr = []
|
|
|
|
|
this.asyncAllFileVisiable = true
|
|
|
|
|
const test = (item) => {
|
|
|
|
|
return new Promise((resolve, reject)=>{
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
isHaveLocalFile(item.fileNewName).then((res) => {
|
|
|
|
|
item.async = res
|
|
|
|
|
if (res===false) {
|
|
|
|
|
if (res === false) {
|
|
|
|
|
ipcRenderer.send('download-file-default', {
|
|
|
|
|
url: item.fileFullPath,
|
|
|
|
|
fileName: item.fileNewName
|
|
|
|
@ -197,7 +205,7 @@ export default {
|
|
|
|
|
item.async = isSuccess
|
|
|
|
|
resolve()
|
|
|
|
|
})
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
resolve()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
@ -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,12 +396,14 @@ export default {
|
|
|
|
|
color: #a2a2a2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.prepare-item-info-message {
|
|
|
|
|
.circular {
|
|
|
|
|
width: 100% !important;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.prepare-body-header{
|
|
|
|
|
|
|
|
|
|
.prepare-body-header {
|
|
|
|
|
.circular {
|
|
|
|
|
width: 100% !important;
|
|
|
|
|
}
|
|
|
|
@ -454,6 +485,7 @@ export default {
|
|
|
|
|
line-height: 23px;
|
|
|
|
|
color: #909399;
|
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
|
|
.circular {
|
|
|
|
|
width: 100% !important;
|
|
|
|
|
}
|
|
|
|
|