diff --git a/css/notepad.css b/css/notepad.css index 6a63b61..add2ffc 100644 --- a/css/notepad.css +++ b/css/notepad.css @@ -18,7 +18,8 @@ } .name { - font-size: 18px; + font-size: 1.4rem; + width: calc(100vw - 5px - 85px); color: black; line-height: 42px; padding-left: 5px; @@ -36,18 +37,18 @@ .right { float: right; + width: 60px; margin-left: 5px; } .small_title, .created_time, .updated_time { - font-size: 0.8rem; color: #BBBBBB; } .operation { - font-size: 1rem; + font-size: 1.2rem; line-height: 42px; padding-right: 10px; padding-left: 10px; diff --git a/js/notepad.js b/js/notepad.js index 8a68caf..dd292bb 100644 --- a/js/notepad.js +++ b/js/notepad.js @@ -20,10 +20,24 @@ const app = new Vue({ this.$set(this.noteData[index], 'currentDelete', false) }, confirmDelete(index){ - console.log("删除", this.noteData[index]) - // some ajax - mui.toast("删除") - window.location.reload() + $.ajax({ + url: qlgUrl("app/note/delete"), + method: "POST", + data: { + id: this.noteData[index].id, + }, + dataType: "json", + success: (res) => { + if(res.status != 1){ + mui.alert(res.msg); + } + this.loadData(); + }, + error: (err) => { + mui.alert("请求失败"); + this.loadData(); + } + }) }, edit(index){ mui.openWindow({ @@ -49,7 +63,7 @@ const app = new Vue({ url: qlgUrl("app/note/index"), method: "GET", dataType: 'json', - success: function(res){ + success: (res) => { if(res.status == 1){ this.noteData = res.data; localStorage.setItem("LOCAL_NOTE", JSON.stringify(res.data)); @@ -68,7 +82,13 @@ const app = new Vue({ var localData = localStorage.getItem("LOCAL_NOTE"); this.loadData(); if(localData){ - this.noteData = JSON.parse(localData); + try{ + JSON.parse(localData); + this.noteData = JSON.parse(localData); + } catch(e) { + console.log(e); + this.noteData = []; + } } }, }) \ No newline at end of file diff --git a/templete/notepad.html b/templete/notepad.html index 0d11853..42e7ee9 100644 --- a/templete/notepad.html +++ b/templete/notepad.html @@ -40,13 +40,13 @@ }