Browse Source

类别灰显

laiguoran 4 years ago
parent
commit
2329275a3a
1 changed files with 8 additions and 0 deletions
  1. 8 0
      app/public/js/category.js

+ 8 - 0
app/public/js/category.js

@@ -66,6 +66,11 @@ function getValueHtml(value) {
     }
     }
     return html.join('');
     return html.join('');
 }
 }
+function makeIconColor() {
+    $('#value-list a').removeClass('text-secondary');
+    $('#value-list').children('tr').eq(0).find('.up-btn').addClass('text-secondary');
+    $('#value-list').children('tr').eq(-2).find('.down-btn').addClass('text-secondary');
+}
 // 根据分类id查找分类
 // 根据分类id查找分类
 function findCategory(cid) {
 function findCategory(cid) {
     for (const c of cData) {
     for (const c of cData) {
@@ -179,6 +184,7 @@ function bindCategoryControl() {
                 bindCategoryValueControl();
                 bindCategoryValueControl();
             });
             });
             bindCategoryValueControl();
             bindCategoryValueControl();
+            makeIconColor();
             $('#add').modal('show');
             $('#add').modal('show');
         }
         }
     });
     });
@@ -303,6 +309,7 @@ $(document).ready(() => {
         const prev = $(this).parents("tr").prev();
         const prev = $(this).parents("tr").prev();
         const prevIndex = parseInt($(prev).index('#value-list tr'));
         const prevIndex = parseInt($(prev).index('#value-list tr'));
         $(this).parents("tr").insertBefore(prev);
         $(this).parents("tr").insertBefore(prev);
+        makeIconColor();
         // if(prevIndex === 1){
         // if(prevIndex === 1){
         //     console.log('hello');
         //     console.log('hello');
         // }
         // }
@@ -315,5 +322,6 @@ $(document).ready(() => {
         if (nextIndex < nowlength) {
         if (nextIndex < nowlength) {
             $(this).parents("tr").insertAfter(next);
             $(this).parents("tr").insertAfter(next);
         }
         }
+        makeIconColor();
     });
     });
 });
 });