From ff43780f12abdba6460ba806543127a39635ec94 Mon Sep 17 00:00:00 2001 From: JerryYan <792602257@qq.com> Date: Sun, 16 Aug 2020 15:03:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=B0=E8=B4=A6OK?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- css/notepad.css | 7 ++++--- js/notepad.js | 32 ++++++++++++++++++++++++++------ templete/notepad.html | 35 +++++++++++++++++++++++------------ 3 files changed, 53 insertions(+), 21 deletions(-) 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 @@ }
-
备忘记
-
信用卡
-
阅看越想
+
备忘记
+
信用卡
+
阅看越想
-
+
{{each.title}}
创建时间:{{each.create_time}}
更改时间:{{each.update_time}}
@@ -67,17 +67,23 @@
-
-
{{each.title}}
-
创建时间:{{each.create_time}}
-
更改时间:{{each.update_time}}
+
+
{{each.name}}
+
+ {{each.huankuan.create_time}}还款:{{each.huankuan.amount}}元 +
+
+ 余额:{{each.cur_cash}}元 +      + 额度:{{each.credit_cash}}元 +
你确定要删除么?
-
{{each.title}}
+
{{each.name}}
-
编辑
+
详情
删除
@@ -113,14 +119,19 @@ parent.style.visibility = "visible"; }, 100); }; - $('.subPage').hide().eq(0).show(); + var _index = window.localStorage.getItem('note_open'); + if (!_index) { + _index = 0; + } $('.indicator').click(function(){ $('.indicator').removeClass('act'); $('.subPage').hide(); $(this).addClass('act'); $('#'+$(this).data('app')).show(); - $('.footer').attr('data-app', $(this).data('app')) + $('.footer').attr('data-app', $(this).data('app')).text($(this).data('addText')) + window.localStorage.setItem('note_open', $(this).index()) }) + $('.indicator').eq(_index).click(); })