function cur_test_typeid() { return $('select#select-test-type').val(); } function cur_test_type_name() { var id = cur_test_typeid(); return $('select#select-test-type option[value="' + id + '"]').text(); } function cur_test_name() { return $('select#select-test-name').val(); } function on_test_type_changed() { var id = cur_test_typeid(); if (id > 0) { $('select#select-test-name').load('/card/test_name_option/' + id); $('div#editor').html(''); $('span#type-title-display').text(cur_test_type_name()); $('span#template-name-display').text('未选中'); } } function on_test_name_changed() { var typ = cur_test_typeid(); var name = cur_test_name(); if (typ > 0 && name != '未选中') { $('div#editor').load('/editor/' + typ + '/' + name, function() { $("div#loading-spinner").hide(); }); $('span#template-name-display').text(name); } } function do_post_json(url, data, success, complete) { if (!complete) { complete = function (xml, status) { console.log("final", status); }; } if (!success) { success = function (d) { console.log("succ", d); }; } $.ajax({ type: "post", url: url, dataType : "json", contentType : "application/json", data: JSON.stringify(data), complete: complete, success: success, }); } function on_new_test() { if (cur_test_typeid() == 0) { use_yorn_modal('警告', '需要先选择测试类型'); return; } use_yorn_modal('新建测试', '