提交 2c86b025 authored 作者: 龙菲's avatar 龙菲

完成文件移动和复制

上级 1d351b1a
......@@ -60,6 +60,16 @@ export const getFoldTree = (params) => {
})
}
// 获取文件目录树by path
export const getFoldTreeByPath = (params) => {
return request({
url: baseUrl + '/file/getfiletreeByPath',
method: 'get',
params
})
}
/**
* 单文件操作相关接口
*/
......
......@@ -344,7 +344,7 @@ export default {
getFileDetail({ userFileId: this.activeFileObj.userFileId })
.then((res) => {
this.loading = false;
if (res.success) {
if (res.code == 200) {
this.audioInfo = {
...res.data.music,
duration: res.data.music.trackLength,
......
......@@ -260,7 +260,7 @@ export default {
})
.then((res) => {
this.codeMirrorLoading = false;
if (res.success) {
if (res.code == 200) {
this.$message.success("已保存");
this.getCodeText();
} else {
......
......@@ -213,7 +213,7 @@ export default {
})
.then((res) => {
this.markdownLoading = false;
if (res.success) {
if (res.code == 200) {
this.$message.success("已保存");
this.getMarkdownText();
} else {
......
......@@ -56,7 +56,7 @@ export default {
) {
console.log("getWeChatAuthStateData", getWeChatAuthStateData);
// getWeChatAuthState().then((res) => {
// if (res.success) {
// if (res.code == 200) {
// if (res.data) {
// this.callback("go");
// } else {
......
......@@ -58,7 +58,7 @@
</template>
<script>
import { getFoldTree, copyFile } from "@/api/qwFile.js";
import { getFoldTreeByPath, copyFile } from "@/api/qwFile.js";
export default {
name: "CopyFileDialog",
......@@ -90,11 +90,37 @@ export default {
* 初始化文件目录树
*/
initFileTree(id) {
// this.loading = true;
// getFoldTree().then((res) => {
// this.loading = false;
// if (res.code == 200) {
// this.fileTree = [res.data];
// this.defaultExpandedKeys = id ? [id] : [this.fileTree[0].id];
// } else {
// this.$message.error(res.message);
// }
// });
this.loading = true;
getFoldTree().then((res) => {
// 通过当前路由判断传入参数
const { pathname } = window.location;
let path = "/我的创作";
if (pathname.includes("myCreate")) {
path = "/我的创作";
} else if (pathname.includes("myTemplate")) {
path = "/我的模板";
} else if (pathname.includes("myCollect")) {
path = "/我的收藏";
} else if (pathname.includes("myNote")) {
path = "/我的笔记";
} else if (pathname.includes("myShare")) {
path = "/我的共享";
}
this.targetPath = path;
const params = { path };
getFoldTreeByPath(params).then((res) => {
this.loading = false;
if (res.code == 200) {
this.fileTree = [res.data];
this.fileTree = res.data.children; //隐藏掉根目录
this.defaultExpandedKeys = id ? [id] : [this.fileTree[0].id];
} else {
this.$message.error(res.message);
......@@ -135,7 +161,7 @@ export default {
copyFile(data)
.then((res) => {
this.sureBtnLoading = false;
if (res.success) {
if (res.code == 200) {
this.$message.success("复制成功");
this.visible = false;
this.callback("confirm");
......
......@@ -100,7 +100,7 @@ export default {
}
}
}
if (res.success) {
if (res.code == 200) {
this.sureBtnLoading = false;
this.$message.success("删除成功");
this.visible = false;
......
......@@ -58,14 +58,19 @@
</template>
<script>
import { getFoldTree, moveFile, batchMoveFile } from "@/api/qwFile.js";
import {
getFoldTree,
getFoldTreeByPath,
moveFile,
batchMoveFile,
} from "@/api/qwFile.js";
export default {
name: "MoveFileDialog",
data() {
return {
visible: false, // 对话框是否可见
targetPath: "/", // 目标路径
targetPath: "/我的创作", // 目标路径
fileTree: [], // 文件夹目录树
loading: false, // 文件夹目录树 loading 状态
defaultExpandedKeys: [],
......@@ -86,15 +91,38 @@ export default {
handleDialogOpen() {
this.initFileTree();
},
getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return r[2];
return null;
},
/**
* 初始化文件目录树
*/
initFileTree(id) {
this.loading = true;
getFoldTree().then((res) => {
// 通过当前路由判断传入参数
const { pathname } = window.location;
let path = "/我的创作";
if (pathname.includes("myCreate")) {
path = "/我的创作";
} else if (pathname.includes("myTemplate")) {
path = "/我的模板";
} else if (pathname.includes("myCollect")) {
path = "/我的收藏";
} else if (pathname.includes("myNote")) {
path = "/我的笔记";
} else if (pathname.includes("myShare")) {
path = "/我的共享";
}
this.targetPath = path;
const params = { path };
getFoldTreeByPath(params).then((res) => {
this.loading = false;
if (res.code == 200) {
this.fileTree = [res.data];
this.fileTree = res.data.children; //隐藏掉根目录
this.defaultExpandedKeys = id ? [id] : [this.fileTree[0].id];
} else {
this.$message.error(res.message);
......@@ -141,7 +169,7 @@ export default {
batchMoveFile(data)
.then((res) => {
this.sureBtnLoading = false;
if (res.success) {
if (res.code == 200) {
this.$message.success("移动成功");
this.visible = false;
this.fileInfo = {};
......@@ -162,7 +190,7 @@ export default {
moveFile(data)
.then((res) => {
this.sureBtnLoading = false;
if (res.success) {
if (res.code == 200) {
this.$message.success("移动成功");
this.visible = false;
this.callback("confirm");
......
......@@ -34,7 +34,7 @@ export default {
deleteBatchNum: this.deleteBatchNum,
filePath: this.filePath,
}).then((res) => {
if (res.success) {
if (res.code == 200) {
this.$message.success("文件已还原");
this.visible = false;
this.callback("confirm");
......
......@@ -135,7 +135,7 @@ export default {
})
.then((res) => {
this.sureBtnLoading = false;
if (res.success) {
if (res.code == 200) {
this.visible = false;
this.$message.success("保存成功");
} else {
......
......@@ -274,9 +274,6 @@ export default {
} else if (this.form.shareType == 2) {
this.form.shareTo = this.userIdsParams;
}
// console.log("this.form.shareTo", this.form.shareTo);
// return;
this.sureBtnLoading = true;
this.$refs[formName].validate((valid) => {
if (valid) {
......
......@@ -155,7 +155,7 @@ export default {
}
unzipFile(reqData).then((res) => {
this.sureBtnLoading = false;
if (res.success) {
if (res.code == 200) {
this.$message.success("解压成功");
this.visible = false;
this.callback("confirm");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论