chenjunkai 6 жил өмнө
parent
commit
5d7e25df77
1 өөрчлөгдсөн 10 нэмэгдсэн , 7 устгасан
  1. 10 7
      web/index.html

+ 10 - 7
web/index.html

@@ -338,8 +338,10 @@
         $.each(body_data, function (idx, obj) {
             // console.log(idx)
             console.log(obj)
-            let edit_btn = '<a href="javascript:void(0);" title="Edit" onclick="editFunc(\'' + idx + '\')"><i class="fa fa-edit"></i></a>';
-            let del_btn = '<a href="javascript:void(0);" title="Delete" onclick="deleteFunc(\'' + idx + '\')"><i class="fa fa-ban"></i></a>';
+            //let edit_btn = '<a href="javascript:void(0);" title="Edit" onclick="editFunc(\'' + idx + '\')"><i class="fa fa-edit"></i></a>';
+            //let del_btn = '<a href="javascript:void(0);" title="Delete" onclick="deleteFunc(\'' + idx + '\')"><i class="fa fa-ban"></i></a>';
+            let edit_btn = '<a href="javascript:void(0);" title="Edit" onclick="editFunc(this)"><i class="fa fa-edit"></i></a>';
+            let del_btn = '<a href="javascript:void(0);" title="Delete" onclick="deleteFunc(this)"><i class="fa fa-ban"></i></a>';
             // let del_btn = '';
             body_html += '<tr>';
             body_html += ('<td>' + idx + '</td>');
@@ -423,10 +425,9 @@
 
 
     // 编辑模态框
-    function editFunc(langKey) {
-        console.log(lw_data);
-        console.log(la_list);
-        // alert(langKey)
+    function editFunc($this) {
+
+        let langKey = $($this).parent().parent().children().eq(0).text()
         $('#modal-container-593541').modal('show')
         // let post_data = {'token': $.cookie('access_token')};
         let html_per = '<label for="lang_key_edit">KEY</label><input class="form-control" type="text" id="lang_key_edit" oldkey="' + langKey + '" value="' + langKey + '"> '
@@ -439,7 +440,9 @@
         $('#edit_model_form').html(html_per)
     }
 
-    function deleteFunc(langKey) {
+    function deleteFunc($this) {
+        let langKey = $($this).parent().parent().children().eq(0).text()
+
         var r = confirm("Press a button")
         if (r) {
             let post_data = {