Browse Source

fix:替换layer

master
燕鹏 3 years ago
parent
commit
4cf3d47c34
  1. 2
      conf/app.conf
  2. 34
      views/ublogs.html

2
conf/app.conf

@ -1,6 +1,6 @@
appname = beeblog
runmode = "dev"
runmode = "prod"
sessionon = true
sessiongcmaxlifetime = 36000

34
views/ublogs.html

@ -5,7 +5,6 @@
<div class="root-container">
{{template "nav" .}}
{{template "memenu" .}}
<div class="me-blog-root">
<div class="me-blog-list">
<div class="breadcrumb-container">
@ -24,7 +23,8 @@
<em>浏览量:{{.Browses}}</em>
<span style="width: 35px;margin-left: 30px;"><a href="javascript:void(0)" style="color: #F84822"
onclick="del(this,{{.Id}})">删除</a></span>
<span style="width: 35px;margin-left: 10px;"><a href="/blog/edit/{{.Id}}" target="_blank" style="color: #F84822">编辑</a></span>
<span style="width: 35px;margin-left: 10px;"><a href="/blog/edit/{{.Id}}" target="_blank"
style="color: #F84822">编辑</a></span>
</div>
</div>
<hr style="height:1px;border:none;border-top:1px solid #EEE;margin: 6px;"/>
@ -56,28 +56,38 @@
</div>
</body>
<script>
function del(obj, id) {
layer.confirm('删除后将无法恢复', {
btn: ['确认', '手滑了'] //按钮
}, function () {
var app = new Vue({
el: ".root-container",
delimiters: ['${', '}'],
data: {},
created() {
},
methods: {
del(obj, id) {
const _this = this
this.$confirm('此操作将永久删除,删除后将无法恢复, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
$.post('/api/blog/del/' + id,
function (data) {
if (data.Status == 0) {
$(obj).parent().parent().parent().remove()
layer.msg("删除成功", {icon: 6});
_this.$message.success("删除成功")
} else if (data.Status == 401) {
window.location.href = "/login"
} else if (data.Status == 403) {
layer.msg("暂无权限", {icon: 5});
this.$message.error("暂无权限")
} else {
this.$message.error("服务器异常")
}
}, 'json')
}, function () {
});
}).catch(() => {
})
}
}
})
</script>
</html>
Loading…
Cancel
Save