Browse Source

fix:替换layer

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

2
conf/app.conf

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

74
views/ublogs.html

@ -3,9 +3,8 @@
</head> </head>
<body style="background-color: #f9f9f9"> <body style="background-color: #f9f9f9">
<div class="root-container"> <div class="root-container">
{{template "nav" .}} {{template "nav" .}}
{{template "memenu" .}} {{template "memenu" .}}
<div class="me-blog-root"> <div class="me-blog-root">
<div class="me-blog-list"> <div class="me-blog-list">
<div class="breadcrumb-container"> <div class="breadcrumb-container">
@ -16,7 +15,7 @@
<a><cite>博客列表</cite></a> <a><cite>博客列表</cite></a>
</span> </span>
</div> </div>
{{range .Page.List}} {{range .Page.List}}
<div> <div>
<p><a href="/blog/{{.Id}}">{{.Title}}</a></p> <p><a href="/blog/{{.Id}}">{{.Title}}</a></p>
<div> <div>
@ -24,28 +23,29 @@
<em>浏览量:{{.Browses}}</em> <em>浏览量:{{.Browses}}</em>
<span style="width: 35px;margin-left: 30px;"><a href="javascript:void(0)" style="color: #F84822" <span style="width: 35px;margin-left: 30px;"><a href="javascript:void(0)" style="color: #F84822"
onclick="del(this,{{.Id}})">删除</a></span> 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>
</div> </div>
<hr style="height:1px;border:none;border-top:1px solid #EEE;margin: 6px;"/> <hr style="height:1px;border:none;border-top:1px solid #EEE;margin: 6px;"/>
{{end}} {{end}}
<div style="text-align: center"> <div style="text-align: center">
<nav> <nav>
<div class="pagination pagination-lg"> <div class="pagination pagination-lg">
<ul> <ul>
{{if .Page.FirstPage}} {{if .Page.FirstPage}}
{{else}} {{else}}
<li class="prev"> <li class="prev">
<a href="/me/blog?num={{ .Page.PageNo | NAdd -1}}&flag={{.Flag}}">&laquo;</a> <a href="/me/blog?num={{ .Page.PageNo | NAdd -1}}&flag={{.Flag}}">&laquo;</a>
</li> </li>
{{end}} {{end}}
<li class="active"><a href="javascript:void(0)">{{.Page.PageNo}}</a></li> <li class="active"><a href="javascript:void(0)">{{.Page.PageNo}}</a></li>
{{if .Page.LastPage}} {{if .Page.LastPage}}
{{else}} {{else}}
<li class="next"> <li class="next">
<a href="/me/blog?num={{ .Page.PageNo | NAdd +1}}&flag={{.Flag}}">&raquo;</a> <a href="/me/blog?num={{ .Page.PageNo | NAdd +1}}&flag={{.Flag}}">&raquo;</a>
</li> </li>
{{end}} {{end}}
</ul> </ul>
</div> </div>
</nav> </nav>
@ -56,28 +56,38 @@
</div> </div>
</body> </body>
<script> <script>
function del(obj, id) { var app = new Vue({
layer.confirm('删除后将无法恢复', { el: ".root-container",
btn: ['确认', '手滑了'] //按钮 delimiters: ['${', '}'],
}, function () { data: {},
$.post('/api/blog/del/' + id, created() {
function (data) {
if (data.Status == 0) {
$(obj).parent().parent().parent().remove()
layer.msg("删除成功", {icon: 6});
} 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 () {
}); },
} 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()
_this.$message.success("删除成功")
} else if (data.Status == 401) {
window.location.href = "/login"
} else if (data.Status == 403) {
this.$message.error("暂无权限")
} else {
this.$message.error("服务器异常")
}
}, 'json')
}).catch(() => {
})
}
}
})
</script> </script>
</html> </html>
Loading…
Cancel
Save