diff --git a/client/js/operations/categoryManageAdd.js b/client/js/operations/categoryManageAdd.js index 701d169..a1095f3 100644 --- a/client/js/operations/categoryManageAdd.js +++ b/client/js/operations/categoryManageAdd.js @@ -75,7 +75,12 @@ $(document).on("change", ".observe", function() { }); $(document).on("click", "#addUrl", function () { - common.dialog.confirm("添加链接", common.util.__template2($("#template2").html(), {}), function () { + var urlIndex = '","url":"'; + var val = $("#sortUrl").val(); + var action = val.substring('{"action":"'.length, val.indexOf(urlIndex)); + console.log(action); + var url = val.substring(val.indexOf(urlIndex) + urlIndex.length, val.length - 2); + common.dialog.confirm("添加链接", common.util.__template2($("#template2").html(), {action: action, url: url}), function () { var url = JSON.stringify({ action: $("#goTo").val(), url: $("#goToUrl").val() @@ -83,6 +88,7 @@ $(document).on("click", "#addUrl", function () { $("#sortUrl").val(url); Category.sortUrl = url; }); + new common.edit2("#action-row").init(); }); $(document).on("click", "#saveBtn", function () { diff --git a/server/views/pages/operations/categoryManageAdd.html b/server/views/pages/operations/categoryManageAdd.html index e96ad8c..758910a 100644 --- a/server/views/pages/operations/categoryManageAdd.html +++ b/server/views/pages/operations/categoryManageAdd.html @@ -156,12 +156,12 @@ </script> <script type="text/template" id="template2"> - <div class="rows"> + <div id="action-row" class="rows"> <div class="form-group"> <label class="col-sm-2 control-label">选择跳转目的地:</label> <div class="col-sm-8"> - <select name="goTo" id="goTo" class="form-control"> + <select name="goTo" id="goTo" class="form-control" value="[[action]]"> [[layout action_template]] </select> @@ -172,7 +172,7 @@ <label class="col-sm-2 control-label">跳转地址:</label> <div class="col-sm-8"> - <textarea rows="2" id="goToUrl" class="form-control" placeholder="跳转地址"></textarea> + <textarea rows="2" id="goToUrl" class="form-control" placeholder="跳转地址">[[url]]</textarea> </div> </div>