Skip to content

Commit

Permalink
Merge pull request #20 from FleyX/dev
Browse files Browse the repository at this point in the history
fix:路径收藏增加删除
  • Loading branch information
FleyX committed Aug 22, 2022
2 parents cae49c3 + 9d8a6dc commit fe70be3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 2 additions & 0 deletions openRenamerFront/src/components/FileChose.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,14 @@ export default {
this.showSave = false;
this.$message.success("操作成功");
},
//取消收藏路径
async cancelSavePath() {
await HttpUtil.delete("/file/path/delete", { id: this.curSavePathId });
this.refreshSavePathList();
this.$emit("refreshSavePathList");
this.$message.success("操作成功");
},
//变更路径
changePath(item) {
this.pathList = JSON.parse(item.content);
this.breadcrumbClick(this.pathList.length - 1);
Expand Down
22 changes: 21 additions & 1 deletion openRenamerFront/src/views/home/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,18 @@
<el-button type="primary" @click="showFileAdd" size="small">新增</el-button>
<el-button type="primary" size="small" @click="selectAllFiles">反选</el-button>
<el-button type="danger" size="small" @click="deleteCheckedFiles">删除</el-button>
收藏路径:<el-button v-for="item in savePathList" :key="item.id" @click="clickSavePath(item)" type="primary" text>{{ item.name }}</el-button>
收藏路径:<el-tag
v-for="item in savePathList"
:round="true"
class="savePath"
closable
:key="item.id"
@click="clickSavePath(item)"
@close="deleteSavePath(item)"
type="primary"
text
>{{ item.name }}</el-tag
>
</div>
<div class="fileBlock">
<!-- 左侧原始文件名 -->
Expand Down Expand Up @@ -177,6 +188,11 @@ export default {
this.$refs["fileChose"].changePath(item);
});
},
async deleteSavePath(item) {
console.log(item);
await HttpUtil.delete("/file/path/delete", { id: item.id });
await this.refreshSavePathList();
},
async refreshSavePathList() {
this.savePathList = await HttpUtil.get("/file/path");
},
Expand Down Expand Up @@ -234,6 +250,10 @@ function readChar(a, i, n) {
</script>

<style lang="less" scoped>
.savePath {
cursor: pointer;
margin-right: 0.5em;
}
.fileList {
margin-top: 20px;
text-align: left;
Expand Down

0 comments on commit fe70be3

Please sign in to comment.