diff --git a/Views/Home/KolList.cshtml b/Views/Home/KolList.cshtml index f19a7f3..22e5707 100644 --- a/Views/Home/KolList.cshtml +++ b/Views/Home/KolList.cshtml @@ -10,6 +10,7 @@ + }
@@ -27,9 +28,61 @@

KOL清單

- + +
- +
+
+ +
+ +
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+ + +
+ + + + + +
diff --git a/Views/Home/ProjectList.cshtml b/Views/Home/ProjectList.cshtml index cf27351..cad305d 100644 --- a/Views/Home/ProjectList.cshtml +++ b/Views/Home/ProjectList.cshtml @@ -28,9 +28,10 @@

專案清單

+
- +
diff --git a/wwwroot/assets/javascript/custom/kollist.js b/wwwroot/assets/javascript/custom/kollist.js index 9c49873..2c8e287 100644 --- a/wwwroot/assets/javascript/custom/kollist.js +++ b/wwwroot/assets/javascript/custom/kollist.js @@ -14,6 +14,7 @@ var kolProjectPos; $(document).ready(function () { delMedia = ''; loadTagsInput(); + loadTagsInput2(); loadMedia(); loadKolMakeupCheckboxItem(); loadKolStyleCheckboxItem(); @@ -1088,6 +1089,85 @@ $(document).ready(function () { $('#kol_tags').find('[value="' + tag.text + '"]').replaceWith(''); + } else { + alert(data.message); + + if (data.err_code == "99999") { + location.href = "/Root/Login"; + } + } + }, + error: function (jqXHR, textStatus, errorThrown) { + alert('網路或伺服器發生錯誤,請稍後重試!'); + } + }); + }); + } + + function loadTagsInput2() { + $('#kol_tags2').select2({ + width: '100%', + tags: true, + tokenSeparators: [',', ' '], + multiple: true, + minimumInputLength: 0, + placeholder: '輸入Tag用空白或逗號分隔關鍵字', + ajax: { + url: '/Api/queryTags', + dataType: 'json', + delay: 500, + type: 'post', + // 要送出的資料 + data: function (params) { + // 在伺服器會得到一個 POST 'search' + return { + search: params.term + }; + }, + processResults: function (data, params) { + console.log(data.data) + + // 一定要返回 results 物件 + return { + results: data.data, + + } + } + }, + createTag: function (params) { + return null; + let term = $.trim(params.term); + if (term.length < 2) { + return null + } + + return { + id: term, + text: term, + // add indicator: + isNew: true + }; + + + } + }); + + $('#kol_tags2').on('select2:select', function (e) { + let tag = e.params.data; + var formData = { + search: tag.text + } + + $.ajax({ + url: "/Api/updateTags", + type: "post", + data: formData, + success: function (data, textStatus, jqXHR) { + var obj = data.data; + if (data.ret == "yes") { + $('#kol_tags').find('[value="' + tag.text + '"]').replaceWith(''); + + } else { alert(data.message); @@ -1640,7 +1720,7 @@ function loadMedia() { success: function (data, textStatus, jqXHR) { if (data.ret == "yes") { var obj = data.optionItems; - + var items2 = ""; $.each(obj, function (i, item) { $("#media_select").append($("