|
|
@@ -5,15 +5,15 @@ var json_table_data='|参数名|类型|说明|\n'+
|
|
|
|
|
|
$(function() {
|
|
|
/*加载目录*/
|
|
|
- getCatList();
|
|
|
+ secondCatList();
|
|
|
|
|
|
- function getCatList() {
|
|
|
- var default_cat_id = $("#default_cat_id").val();
|
|
|
+ function secondCatList() {
|
|
|
+ var default_second_cat_id = $("#default_second_cat_id").val();
|
|
|
var item_id = $("#item_id").val();
|
|
|
$.get(
|
|
|
"./", {
|
|
|
"item_id": item_id,
|
|
|
- "s": "home/catalog/catList",
|
|
|
+ "s": "home/catalog/secondCatList",
|
|
|
},
|
|
|
function(data) {
|
|
|
$("#cat_id").html('<OPTION value="0">无</OPTION>');
|
|
|
@@ -22,12 +22,13 @@ $(function() {
|
|
|
console.log(json);
|
|
|
for (var i = 0; i < json.length; i++) {
|
|
|
cat_html = '<OPTION value="' + json[i].cat_id + '" ';
|
|
|
- if (default_cat_id == json[i].cat_id) {
|
|
|
+ if (default_second_cat_id == json[i].cat_id) {
|
|
|
cat_html += ' selected ';
|
|
|
}
|
|
|
|
|
|
cat_html += ' ">' + json[i].cat_name + '</OPTION>';
|
|
|
$("#cat_id").append(cat_html);
|
|
|
+ getChildCatList();
|
|
|
};
|
|
|
};
|
|
|
|
|
|
@@ -37,6 +38,43 @@ $(function() {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ function getChildCatList() {
|
|
|
+ var cat_id = $("#cat_id").val();
|
|
|
+ var default_child_cat_id = $("#default_child_cat_id").val();
|
|
|
+ $.get(
|
|
|
+ "./", {
|
|
|
+ "cat_id": cat_id,
|
|
|
+ "s": "home/catalog/childCatList",
|
|
|
+ },
|
|
|
+ function(data) {
|
|
|
+ $("#parent_cat_id").html('<OPTION value="0">无</OPTION>');
|
|
|
+ if (data.error_code == 0) {
|
|
|
+ json = data.data;
|
|
|
+ console.log(json);
|
|
|
+ for (var i = 0; i < json.length; i++) {
|
|
|
+ cat_html = '<OPTION value="' + json[i].cat_id + '" ';
|
|
|
+ if (default_child_cat_id == json[i].cat_id) {
|
|
|
+ cat_html += ' selected ';
|
|
|
+ }
|
|
|
+
|
|
|
+ cat_html += ' ">' + json[i].cat_name + '</OPTION>';
|
|
|
+ $("#parent_cat_id").append(cat_html);
|
|
|
+ $("#li_parent_cat").show();
|
|
|
+ };
|
|
|
+ }else{
|
|
|
+ $("#li_parent_cat").hide();
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ "json"
|
|
|
+
|
|
|
+ );
|
|
|
+ }
|
|
|
+ //监听是否选择了目录。如果选择了,则跟后台判断是否还子目录
|
|
|
+ $("#cat_id").change(function(){
|
|
|
+ getChildCatList();
|
|
|
+ });
|
|
|
+
|
|
|
var keyMap = {
|
|
|
// 保存
|
|
|
"Ctrl-S": function() {
|
|
|
@@ -142,11 +180,15 @@ $(function() {
|
|
|
if (saving) return false;
|
|
|
var page_id = $("#page_id").val();
|
|
|
var item_id = $("#item_id").val();
|
|
|
- var cat_id = $("#cat_id").val();
|
|
|
var page_title = $("#page_title").val();
|
|
|
var page_content = $("#page_content").val();
|
|
|
var item_id = $("#item_id").val();
|
|
|
var s_number = $("#s_number").val();
|
|
|
+ var cat_id = $("#cat_id").val();
|
|
|
+ var parent_cat_id = $("#parent_cat_id").val();
|
|
|
+ if (parent_cat_id > 0 ) {
|
|
|
+ cat_id = parent_cat_id ;
|
|
|
+ };
|
|
|
saving = true;
|
|
|
$.post(
|
|
|
"?s=home/page/save", {
|