书签编辑和删除

This commit is contained in:
WangHao 2020-08-31 22:02:30 +08:00
parent 0696de196b
commit 0934737d36
3 changed files with 154 additions and 28 deletions

View File

@ -69,6 +69,17 @@
<hr class="bookamrk-hr"/> <hr class="bookamrk-hr"/>
<el-col :span="24" v-for="bm in bookmarkList"> <el-col :span="24" v-for="bm in bookmarkList">
<div class="editBookamrk">
<div class="editlist">
<div> <el-button plain size="small" @click="handleUpdate(bm.bookmarkId)">修改</el-button></div>
<div> <el-button plain size="small" @click="handleDelete(bm.bookmarkId)">删除</el-button></div>
<div> <el-button plain size="small">分享</el-button></div>
</div>
</div>
<div class="bookmark" :data-id="bm.id" @click="windowurl(bm.url,bm.bookmarkId)"> <div class="bookmark" :data-id="bm.id" @click="windowurl(bm.url,bm.bookmarkId)">
<p class="bookmark-title">{{bm.title}}</p> <p class="bookmark-title">{{bm.title}}</p>
<div class=""> <div class="">
@ -85,21 +96,48 @@
<div class="bookmark-official">{{bm.urls}}&nbsp;·&nbsp;</div><div class="bookmark-time">{{bm.createTime|changeTime}}</div> <div class="bookmark-official">{{bm.urls}}&nbsp;·&nbsp;</div><div class="bookmark-time">{{bm.createTime|changeTime}}</div>
</div> </div>
</div> </div>
</div> </div>
<el-divider class="bookmark-hr"></el-divider> <el-divider class="bookmark-hr"></el-divider>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
<!-- 添加或修改书签管理对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="书签标题" prop="title">
<el-input v-model="form.title" placeholder="请输入书签标题" />
</el-form-item>
<el-form-item label="书签地址" prop="url">
<el-input v-model="form.url" placeholder="请输入书签地址" />
</el-form-item>
<el-form-item label="书签描述" prop="description">
<el-input v-model="form.description" placeholder="请输入书签描述" />
</el-form-item>
<el-form-item label="书签标签" prop="label">
<el-input v-model="form.label" placeholder="请输入标签" />
</el-form-item>
<el-form-item label="所属目录" prop="menuId">
<el-input v-model="form.menuId" placeholder="请选择上级目录" />
</el-form-item>
<!-- 0公开显示1隐藏显示2好友显示3稍后再看-->
<el-form-item label="选择状态" prop="start">
<el-input v-model="form.start" placeholder="" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
@ -119,6 +157,12 @@
data: function () { data: function () {
return { return {
//
loading: true,
//
title: "",
//
open: false,
showbookmark:true, showbookmark:true,
showimg:false, showimg:false,
loading:false, loading:false,
@ -139,6 +183,11 @@
}, },
bookmarkList:[], bookmarkList:[],
urltext:'?from=yunshuqian.com',//广 urltext:'?from=yunshuqian.com',//广
//
form: {},
//
rules: {
}
} }
}, },
filters: { filters: {
@ -176,6 +225,78 @@
}, },
methods: { methods: {
/** 修改按钮操作 */
handleUpdate(bookmarkId) {
this.reset();
const ibookmarkId = bookmarkId || this.ids
getBookmark(ibookmarkId).then(response => {
this.form = response.data;
this.open = true;
this.title = "书签编辑管理";
});
},
/** 提交按钮 修改和新增 */
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.bookmarkId != undefined) {
updateBookmark(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}
});
} else {
addBookmark(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(bookmarkId) {
const bookmarkIds = bookmarkId || this.ids;
this.$confirm('是否确认删除此条书签数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delBookmark(bookmarkIds);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(function() {});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
bookmarkId: undefined,
userid: undefined,
title: undefined,
url: undefined,
urls: undefined,
description: undefined,
image: undefined,
label: undefined,
menuId: undefined,
zcount: undefined,
idelete: undefined,
start: undefined,
createTime: undefined
};
this.resetForm("form");
},
/** 回收站**/ /** 回收站**/
getrecycleList() { getrecycleList() {
this.loading = true; this.loading = true;
@ -225,24 +346,8 @@
window.open(url); window.open(url);
//
// if (this.$route.params.menuId=6666){
// this.$axios.get(`/api/bookmark/updateBookmarkStart?bookmarkId=${bookmarkId}`).then(response => {
//
// if (response.status == 200 && response.data.status == 'success') {
// this.momentlList()
// this.$message({type: 'success', message: ',,!'})
//
// }else {
// this.$message({type: 'error', message: '!'})
// }
//
// });
// }
}, },
}, },
@ -299,5 +404,27 @@
color: #D4D4D4!important; color: #D4D4D4!important;
} }
.editBookamrk{
width: 200px;
height: 70px;
position: absolute;
background-color: #acd7ff;
right: 0;
}
.editlist{
display: flex;
width: 200px;
height: 70px;
flex-flow: wrap;
align-items: center;
}
.editlist div{
margin-left:10px;
width: 50px;
height: 35px;
align-content: center;
}
</style> </style>

View File

@ -42,7 +42,7 @@ public class SqBookmark
private String url; private String url;
/** $column.columnComment */ /** $column.columnComment */
@Excel(name = "书签地址") @Excel(name = "官网地址")
@Column(name = "urls") @Column(name = "urls")
private String urls; private String urls;
@ -52,7 +52,7 @@ public class SqBookmark
private String description; private String description;
/** $column.columnComment */ /** $column.columnComment */
@Excel(name = "书签描述") @Excel(name = "图片")
@Column(name = "image") @Column(name = "image")
private String image; private String image;

View File

@ -75,7 +75,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="menuOrder != null">menu_order = #{menuOrder},</if> <if test="menuOrder != null">menu_order = #{menuOrder},</if>
<if test="bookmarkCount != null">bookmark_count = #{bookmarkCount},</if> <if test="bookmarkCount != null">bookmark_count = #{bookmarkCount},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
update_time = now()
</trim> </trim>
where menu_id = #{menuId} where menu_id = #{menuId}
</update> </update>