完成书签的管理功能

This commit is contained in:
WangHao 2021-11-06 10:51:44 +08:00
parent 5755ac1e57
commit c505a34d56
5 changed files with 112 additions and 25 deletions

View File

@ -27,6 +27,25 @@ export function addTagByUser(data) {
}) })
} }
// 刪除书签
export function deleteTag(id) {
return request({
url: '/system/tag/deleteTag/' + id,
method: 'get'
})
}
// 修改书签管理
export function editByUser(data) {
return request({
url: '/system/tag/editByUser',
method: 'post',
data: data
})
}

View File

@ -36,7 +36,7 @@
<div class="bookmark-time" v-if="bm.tagNameAll!=null&&bm.tagNameAll!=''" > <div class="bookmark-time" v-if="bm.tagNameAll!=null&&bm.tagNameAll!=''" >
<el-tag v-for="item in JSON.parse(bm.tagNameAll)" class="bookmark-list-tag bookmark-list-tag-top" style="float: left" type="info" data-tagid="item.tagId" size="mini"> <el-tag v-for="item in JSON.parse(bm.tagNameAll)" class="bookmark-list-tag bookmark-list-tag-top" style="float: left" type="info" data-tagid="item.tagId" size="mini">
{{item.name}} #{{item.name}}
</el-tag> </el-tag>
</div> </div>
</div> </div>

View File

@ -95,6 +95,7 @@
<!-- </div>--> <!-- </div>-->
</div> </div>
</div> </div>

View File

@ -42,13 +42,13 @@
<!-- </div>--> <!-- </div>-->
<div class="aside-titleB" @mouseenter="eidtMenuText=!eidtMenuText" @mouseleave="eidtMenuText=!eidtMenuText"> <div class="aside-titleB" @click="menuListShowCk" @mouseenter="eidtMenuText=!eidtMenuText" @mouseleave="eidtMenuText=!eidtMenuText">
<i @click="menuListShowCk" :class="menuListShow ? 'el-icon-caret-bottom aside-titleB_childi_one':'el-icon-caret-right aside-titleB_childi_one'" ></i> <i :class="menuListShow ? 'el-icon-caret-bottom aside-titleB_childi_one':'el-icon-caret-right aside-titleB_childi_one'" ></i>
<i class="el-icon-folder-opened aside-titleB_childi_two"></i> <i class="el-icon-folder-opened aside-titleB_childi_two"></i>
<span >我的收藏</span> <span >我的收藏</span>
<div style="margin-left: 40%" v-show="eidtMenuText"> <div style="margin-left: 40%" v-show="eidtMenuText">
<i class="el-icon-search" style="font-size: 19px;margin-left: 5px;margin-top: 7px" @click="searchBkMenuCk"></i> <i class="el-icon-search" style="font-size: 19px;margin-left: 5px;margin-top: 7px" @click.stop="searchBkMenuCk"></i>
<i class="el-icon-folder-add" style="font-size: 19px;margin-left: 5px;margin-top: 7px" @click="addBkMenuCk"></i> <i class="el-icon-folder-add" style="font-size: 19px;margin-left: 5px;margin-top: 7px" @click.stop="addBkMenuCk"></i>
</div> </div>
</div> </div>

View File

@ -1,12 +1,12 @@
<template> <template>
<div class="main" > <div class="main" >
<div class="aside-titleB" @mouseenter="eidtTAGText=!eidtTAGText" @mouseleave="eidtTAGText=!eidtTAGText"> <div class="aside-titleB" @click="tagListShowCk" @mouseenter="eidtTAGText=!eidtTAGText" @mouseleave="eidtTAGText=!eidtTAGText">
<i @click="tagListShowCk" :class="tagListShow ? 'el-icon-caret-bottom aside-titleB_childi_one':'el-icon-caret-right aside-titleB_childi_one'" ></i> <i :class="tagListShow ? 'el-icon-caret-bottom aside-titleB_childi_one':'el-icon-caret-right aside-titleB_childi_one'" ></i>
<i class="el-icon-price-tag aside-titleB_childi_two"></i> <i class="el-icon-price-tag aside-titleB_childi_two"></i>
<span >标签管理</span> <span >标签管理</span>
<div style="margin-left: 40%" v-show="eidtTAGText"> <div style="margin-left: 40%" v-show="eidtTAGText">
<i class="el-icon-search title-name" @click="searchBkTagCk"></i> <i class="el-icon-search title-name" @click.stop="searchBkTagCk"></i>
<i class="el-icon-folder-add title-name" @click="addBkTagCk"></i> <i class="el-icon-folder-add title-name" @click.stop="addBkTagCk"></i>
</div> </div>
</div> </div>
@ -51,14 +51,14 @@
<i v-show="seen&&item.id == current" class="el-icon-delete tag_coomon" @click="updateTagOpen(item.id)"></i> <i v-show="seen&&item.id == current" class="el-icon-delete tag_coomon" @click="deleteTagOpen(item.id)"></i>
<i v-show="seen&&item.id == current" class="el-icon-edit tag_coomon_eidt" @click="updateTagOpen(item.id)"></i> <i v-show="seen&&item.id == current" class="el-icon-edit tag_coomon_eidt" @click="updateTagOpen(item.id,item.name)"></i>
<!-- <el-tag type="info" size="mini">{{item.name}}</el-tag>--> <!-- <el-tag type="info" size="mini">{{item.name}}</el-tag>-->
</div> </div>
</div> </div>
<div v-if=" tagList != undefined && tagList != null && total > 8 " class="aside-title name transition-box" >加载更多</div> <div v-if=" tagList != undefined && tagList != null && total > 8 " class="aside-title name transition-box" @click="getListTag()">加载更多({{total}})</div>
<!-- 无标签 --> <!-- 无标签 -->
<div v-if=" tagList == undefined ||tagList == null || tagList.length <= 0" class="aside-title name transition-box" > <div v-if=" tagList == undefined ||tagList == null || tagList.length <= 0" class="aside-title name transition-box" >
@ -77,19 +77,22 @@
title="编辑" title="编辑"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
width="30%" width="30%"
:before-close="handleClose"> >
<el-input v-model="newName" placeholder="请输入新的标签名称"></el-input> <el-input v-model="newName" placeholder="请输入新的标签名称"></el-input>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="dialogVisible = false"> </el-button> <el-button type="primary" @click="editByUser()"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import {listByUser,listByUserLike,addTagByUser} from "@/api/bookmark/tag"; import {listByUser,listByUserLike,addTagByUser,deleteTag,editByUser} from "@/api/bookmark/tag";
export default { export default {
name: 'areaTree', name: 'areaTree',
@ -98,13 +101,15 @@
data: function () { data: function () {
return { return {
dialogVisible: false, dialogVisible: false,
deleteTag:false,
msg:'暂无标签', msg:'暂无标签',
tagList:[], tagList:[],
total:0, total:0,
tagParams: { tagParams: {
pageNum: 1, pageNum: 1,
pageSize: 8, pageSize: 8,
name:undefined name:undefined,
id:undefined
}, },
newName:'',// newName:'',//
addBkTAG:true,//TAG addBkTAG:true,//TAG
@ -122,9 +127,49 @@
that.listByUsers(); that.listByUsers();
}, },
methods: { methods: {
updateTagOpen(id){
this.dialogVisible = true; updateTagOpen(id,name){
console.log(id) var that = this;
that.dialogVisible = true;
that.newName = name;
that.tagParams.id = id;
},
/** 修改书签*/
editByUser(){
var that = this;
that.tagParams.name = that.newName;
editByUser(this.tagParams).then(response => {
if (response.code === 200) {
that.listByUsers();
that.msgSuccess("修改成功");
}else{
that.msgError("修改失败");
}
});
that.dialogVisible = false
},
/** 删除书签*/
deleteTagOpen(id){
this.$confirm('是否确认删除此条书签数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
deleteTag(id).then(response => {
if (response.code === 200) {
this.listByUsers();
this.msgSuccess("删除成功");
}else{
this.msgError("删除失败");
}
});
}).catch(function () {
//
});
}, },
handleClose(done) { handleClose(done) {
this.$confirm('确认关闭?') this.$confirm('确认关闭?')
@ -136,10 +181,11 @@
// //
reset() { reset() {
this.form = { this.tagParams = {
pageNum: 1, pageNum: 1,
pageSize: 8, pageSize: 8,
name: undefined, name: undefined,
id: undefined
}; };
}, },
/**回车搜索**/ /**回车搜索**/
@ -159,8 +205,7 @@
this.tagList = null; this.tagList = null;
this.total = 0; this.total = 0;
listByUserLike(this.tagParams).then(response => { listByUserLike(this.tagParams).then(response => {
if (response.code === 200) {1 if (response.code === 200) {
this.tagList=response.rows; this.tagList=response.rows;
this.total = response.total; this.total = response.total;
if (this.total == 0){ if (this.total == 0){
@ -197,21 +242,43 @@
}); });
}, },
/** 修改书签*/
/** 删除书签*/
/** 查询书签 */ /** 查询书签 */
listByUsers() { listByUsers() {
var that = this; var that = this;
// //
listByUser(that.tagParams).then(response => { that.reset();
listByUserLike(that.tagParams).then(response => {
if (response.code === 200) { if (response.code === 200) {
that.tagList=response.rows; that.tagList=response.rows;
that.total = response.total; that.total = response.total;
} }
}); });
}, },
/**加载更多*/
getListTag(){
var that = this;
var that = this;
//
var i = that.tagParams.pageNum + 1;
var listcount = Math.ceil(that.total / 8);
if (i > listcount) {
this.msgSuccess("已加载全部");
return ;
}
that.tagParams.pageNum = i;
//
listByUserLike(that.tagParams).then(response => {
if (response.code === 200) {
that.tagList=that.tagList.concat(response.rows)
that.total = response.total;
}
});
},
/**添加书签目录**/ /**添加书签目录**/
addBkTagCk(){ addBkTagCk(){