tianyun 1 年之前
父節點
當前提交
e979b70fd1
共有 1 個文件被更改,包括 24 次插入8 次删除
  1. 24 8
      simple-demo/send_memos.html

+ 24 - 8
simple-demo/send_memos.html

@@ -117,13 +117,9 @@
     });
     function showModel() {
         document.getElementById('mask').style.display = 'block';
-        // 隐藏编辑器
-        // document.getElementById('all').style.display = 'none';
     }
     function hideModel() {
         document.getElementById('mask').style.display = 'none';
-        // 显示编辑器
-        // document.getElementById('all').style.display = 'block';
     }
 
 
@@ -309,6 +305,9 @@
             // flex 定位
             div.innerHTML = '';
             res.forEach(item => {
+                let lineDiv = document.createElement('div');
+                div.appendChild(lineDiv);
+
                 let tmpDiv = document.createElement('div');
                 tmpDiv.innerText = item['content'];
                 // 样式加上border,点击跳转到对应的url https://memos.tianyunperfect.cn/m/ + item['resource_name']
@@ -327,7 +326,7 @@
                     // focus
                     quillModel.focus();
                 };
-                div.appendChild(tmpDiv);
+                lineDiv.appendChild(tmpDiv);
 
 
                 // 右侧添加一个编辑按钮
@@ -340,7 +339,24 @@
                 editBtn.onclick = function () {
                     window.open(`https://memos.tianyunperfect.cn/m/${item['resource_name']}`);
                 };
-                div.appendChild(editBtn);
+                lineDiv.appendChild(editBtn);
+
+                // 归档按钮
+                let archiveBtn = document.createElement('button');
+                archiveBtn.innerText = '归档';
+                archiveBtn.style.margin = '10px';
+                // inline
+                archiveBtn.style.display = 'inline-block';
+                archiveBtn.onclick = function () {
+                    let data = {
+                        id: item['id']
+                    };
+                    requestUtil.async(`https://web_history.tianyunperfect.cn/memos/archive`, 'post', data, {}).then(res => {
+                        showMsg('归档成功', 1);
+                        lineDiv.style.display = 'none';
+                    });
+                };
+                lineDiv.appendChild(archiveBtn);
 
                 // 删除按钮
                 let delBtn = document.createElement('button');
@@ -359,10 +375,10 @@
                     };
                     requestUtil.async(`https://web_history.tianyunperfect.cn/memos/delete`, 'post', data, {}).then(res => {
                         showMsg('删除成功', 1);
-                        search();
+                        lineDiv.style.display = 'none';
                     });
                 };
-                div.appendChild(delBtn);
+                lineDiv.appendChild(delBtn);
             });
         });
     }