注:这里的原型是展示效果,让大家有个感性的认识,编码不在这里进行,项目开发过程会在后面的章节从零开始。
");
window.frames["iframe_show6082"].document.write(decodeHtml($("textarea#stepcodeTextarea6082").val()));
window.frames["iframe_show6082"].document.close();
$(window.frames["iframe_show6082"]).load(function(){
$("#iframe_show6082").height($("#iframe_show6082").contents().find("body").height()+showittryitheight);
});
$("#iframe_show6082").height($("#iframe_show6082").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<html>
<head>
<script src="http://127.0.0.1/study../../../js/jquery/2.0.0/jquery.min.js"></script>
<link href="http://127.0.0.1/study../../../css/bootstrap/3.3.6/bootstrap.min.css" rel="stylesheet">
<script src="http://127.0.0.1/study../../../js/bootstrap/3.3.6/bootstrap.min.js"></script>
<link href="http://127.0.0.1/tmall../../../css/back/style.css" rel="stylesheet">
<script>
function checkEmpty(id, name){
var value = $("#"+id).val();
if(value.length==0){
alert(name+ "不能为空");
$("#"+id)[0].focus();
return false;
}
return true;
}
function checkNumber(id, name){
var value = $("#"+id).val();
if(value.length==0){
alert(name+ "不能为空");
$("#"+id)[0].focus();
return false;
}
if(isNaN(value)){
alert(name+ "必须是数字");
$("#"+id)[0].focus();
return false;
}
return true;
}
function checkInt(id, name){
var value = $("#"+id).val();
if(value.length==0){
alert(name+ "不能为空");
$("#"+id)[0].focus();
return false;
}
if(parseInt(value)!=value){
alert(name+ "必须是整数");
$("#"+id)[0].focus();
return false;
}
return true;
}
$(function(){
$("a").click(function(){
var deleteLink = $(this).attr("deleteLink");
console.log(deleteLink);
if("true"==deleteLink){
var confirmDelete = confirm("确认要删除");
if(confirmDelete)
return true;
return false;
}
});
})
</script>
</head>
<body>
<div class="navitagorDiv">
<nav class="navbar navbar-default navbar-fixed-top navbar-inverse">
<img style="margin-left:10px;margin-right:0px" class="pull-left" src="http://127.0.0.1/tmall../../../img/site/tmallbuy.png" height="45px">
<a class="navbar-brand" href="#nowhere">天猫后台</a>
<a class="navbar-brand" href="#nowhere">分类管理</a>
<a class="navbar-brand" href="#nowhere">用户管理</a>
<a class="navbar-brand" href="#nowhere">订单管理</a>
</nav>
</div>
<script>
$(function(){
$("#addForm").submit(function(){
if(checkEmpty("name","分类名称"))
return true;
return false;
});
});
</script>
<title>分类管理</title>
<div class="workingArea">
<h1 class="label label-info" >分类管理</h1>
<br>
<br>
<div class="listDataTableDiv">
<table class="table table-striped table-bordered table-hover table-condensed">
<thead>
<tr class="success">
<th>ID</th>
<th>图片</th>
<th>分类名称</th>
<th>属性管理</th>
<th>产品管理</th>
<th>编辑</th>
<th>删除</th>
</tr>
</thead>
<tbody>
<tr>
<td>83</td>
<td><img height="40px" src="http://127.0.0.1/tmall/img/category/83.jpg"></td>
<td>平板电视</td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-th-list"></span></a></td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-shopping-cart"></span></a></td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-edit"></span></a></td>
<td><a deleteLink="true" href="#nowhere"><span class=" glyphicon glyphicon-trash"></span></a></td>
</tr>
<tr>
<td>82</td>
<td><img height="40px" src="http://127.0.0.1/tmall/img/category/82.jpg"></td>
<td>马桶</td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-th-list"></span></a></td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-shopping-cart"></span></a></td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-edit"></span></a></td>
<td><a deleteLink="true" href="#nowhere"><span class=" glyphicon glyphicon-trash"></span></a></td>
</tr>
<tr>
<td>81</td>
<td><img height="40px" src="http://127.0.0.1/tmall/img/category/81.jpg"></td>
<td>沙发</td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-th-list"></span></a></td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-shopping-cart"></span></a></td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-edit"></span></a></td>
<td><a deleteLink="true" href="#nowhere"><span class=" glyphicon glyphicon-trash"></span></a></td>
</tr>
<tr>
<td>80</td>
<td><img height="40px" src="http://127.0.0.1/tmall/img/category/80.jpg"></td>
<td>电热水器</td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-th-list"></span></a></td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-shopping-cart"></span></a></td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-edit"></span></a></td>
<td><a deleteLink="true" href="#nowhere"><span class=" glyphicon glyphicon-trash"></span></a></td>
</tr>
<tr>
<td>79</td>
<td><img height="40px" src="http://127.0.0.1/tmall/img/category/79.jpg"></td>
<td>平衡车</td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-th-list"></span></a></td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-shopping-cart"></span></a></td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-edit"></span></a></td>
<td><a deleteLink="true" href="#nowhere"><span class=" glyphicon glyphicon-trash"></span></a></td>
</tr>
</tbody>
</table>
</div>
<div class="pageDiv">
<script>
$(function(){
$("ul.pagination li.disabled a").click(function(){
return false;
});
});
</script>
<nav>
<ul class="pagination">
<li class="disabled">
<a href="#nowhere" aria-label="Previous" >
<span aria-hidden="true">«</span>
</a>
</li>
<li class="disabled">
<a href="#nowhere" aria-label="Previous" >
<span aria-hidden="true">‹</span>
</a>
</li>
<li class="disabled">
<a
href="#nowhere"
class="current"
>1</a>
</li>
<li >
<a
href="#nowhere"
>2</a>
</li>
<li >
<a
href="#nowhere"
>3</a>
</li>
<li >
<a
href="#nowhere"
>4</a>
</li>
<li >
<a href="#nowhere" aria-label="Next">
<span aria-hidden="true">›</span>
</a>
</li>
<li >
<a href="#nowhere" aria-label="Next">
<span aria-hidden="true">»</span>
</a>
</li>
</ul>
</nav>
</div>
<div class="panel panel-warning addDiv">
<div class="panel-heading">新增分类</div>
<div class="panel-body">
<form method="post" id="addForm" enctype="multipart/form-data1">
<table class="addTable">
<tr>
<td>分类名称</td>
<td><input id="name" name="name" type="text" class="form-control"></td>
</tr>
<tr>
<td>分类圖片</td>
<td>
<input id="categoryPic" type="file" name="image" />
</td>
</tr>
<tr class="submitTR">
<td colspan="2" align="center">
<button type="button" class="btn btn-success">提 交</button>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
<div class="footer">
</div>
</body>
</html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<html>
<head>
<script src="http://127.0.0.1/study../../../js/jquery/2.0.0/jquery.min.js"></script>
<link href="http://127.0.0.1/study../../../css/bootstrap/3.3.6/bootstrap.min.css" rel="stylesheet">
<script src="http://127.0.0.1/study../../../js/bootstrap/3.3.6/bootstrap.min.js"></script>
<link href="http://127.0.0.1/tmall../../../css/back/style.css" rel="stylesheet">
<script>
function checkEmpty(id, name){
var value = $("#"+id).val();
if(value.length==0){
alert(name+ "不能为空");
$("#"+id)[0].focus();
return false;
}
return true;
}
function checkNumber(id, name){
var value = $("#"+id).val();
if(value.length==0){
alert(name+ "不能为空");
$("#"+id)[0].focus();
return false;
}
if(isNaN(value)){
alert(name+ "必须是数字");
$("#"+id)[0].focus();
return false;
}
return true;
}
function checkInt(id, name){
var value = $("#"+id).val();
if(value.length==0){
alert(name+ "不能为空");
$("#"+id)[0].focus();
return false;
}
if(parseInt(value)!=value){
alert(name+ "必须是整数");
$("#"+id)[0].focus();
return false;
}
return true;
}
$(function(){
$("a").click(function(){
var deleteLink = $(this).attr("deleteLink");
console.log(deleteLink);
if("true"==deleteLink){
var confirmDelete = confirm("确认要删除");
if(confirmDelete)
return true;
return false;
}
});
})
</script>
</head>
<body>
<div class="navitagorDiv">
<nav class="navbar navbar-default navbar-fixed-top navbar-inverse">
<img style="margin-left:10px;margin-right:0px" class="pull-left" src="http://127.0.0.1/tmall../../../img/site/tmallbuy.png" height="45px">
<a class="navbar-brand" href="#nowhere">天猫后台</a>
<a class="navbar-brand" href="#nowhere">分类管理</a>
<a class="navbar-brand" href="#nowhere">用户管理</a>
<a class="navbar-brand" href="#nowhere">订单管理</a>
</nav>
</div>
<script>
$(function(){
$("#addForm").submit(function(){
if(checkEmpty("name","分类名称"))
return true;
return false;
});
});
</script>
<title>分类管理</title>
<div class="workingArea">
<h1 class="label label-info" >分类管理</h1>
<br>
<br>
<div class="listDataTableDiv">
<table class="table table-striped table-bordered table-hover table-condensed">
<thead>
<tr class="success">
<th>ID</th>
<th>图片</th>
<th>分类名称</th>
<th>属性管理</th>
<th>产品管理</th>
<th>编辑</th>
<th>删除</th>
</tr>
</thead>
<tbody>
<tr>
<td>83</td>
<td><img height="40px" src="http://127.0.0.1/tmall/img/category/83.jpg"></td>
<td>平板电视</td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-th-list"></span></a></td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-shopping-cart"></span></a></td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-edit"></span></a></td>
<td><a deleteLink="true" href="#nowhere"><span class=" glyphicon glyphicon-trash"></span></a></td>
</tr>
<tr>
<td>82</td>
<td><img height="40px" src="http://127.0.0.1/tmall/img/category/82.jpg"></td>
<td>马桶</td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-th-list"></span></a></td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-shopping-cart"></span></a></td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-edit"></span></a></td>
<td><a deleteLink="true" href="#nowhere"><span class=" glyphicon glyphicon-trash"></span></a></td>
</tr>
<tr>
<td>81</td>
<td><img height="40px" src="http://127.0.0.1/tmall/img/category/81.jpg"></td>
<td>沙发</td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-th-list"></span></a></td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-shopping-cart"></span></a></td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-edit"></span></a></td>
<td><a deleteLink="true" href="#nowhere"><span class=" glyphicon glyphicon-trash"></span></a></td>
</tr>
<tr>
<td>80</td>
<td><img height="40px" src="http://127.0.0.1/tmall/img/category/80.jpg"></td>
<td>电热水器</td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-th-list"></span></a></td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-shopping-cart"></span></a></td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-edit"></span></a></td>
<td><a deleteLink="true" href="#nowhere"><span class=" glyphicon glyphicon-trash"></span></a></td>
</tr>
<tr>
<td>79</td>
<td><img height="40px" src="http://127.0.0.1/tmall/img/category/79.jpg"></td>
<td>平衡车</td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-th-list"></span></a></td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-shopping-cart"></span></a></td>
<td><a href="#nowhere"><span class="glyphicon glyphicon-edit"></span></a></td>
<td><a deleteLink="true" href="#nowhere"><span class=" glyphicon glyphicon-trash"></span></a></td>
</tr>
</tbody>
</table>
</div>
<div class="pageDiv">
<script>
$(function(){
$("ul.pagination li.disabled a").click(function(){
return false;
});
});
</script>
<nav>
<ul class="pagination">
<li class="disabled">
<a href="#nowhere" aria-label="Previous" >
<span aria-hidden="true">«</span>
</a>
</li>
<li class="disabled">
<a href="#nowhere" aria-label="Previous" >
<span aria-hidden="true">‹</span>
</a>
</li>
<li class="disabled">
<a
href="#nowhere"
class="current"
>1</a>
</li>
<li >
<a
href="#nowhere"
>2</a>
</li>
<li >
<a
href="#nowhere"
>3</a>
</li>
<li >
<a
href="#nowhere"
>4</a>
</li>
<li >
<a href="#nowhere" aria-label="Next">
<span aria-hidden="true">›</span>
</a>
</li>
<li >
<a href="#nowhere" aria-label="Next">
<span aria-hidden="true">»</span>
</a>
</li>
</ul>
</nav>
</div>
<div class="panel panel-warning addDiv">
<div class="panel-heading">新增分类</div>
<div class="panel-body">
<form method="post" id="addForm" enctype="multipart/form-data1">
<table class="addTable">
<tr>
<td>分类名称</td>
<td><input id="name" name="name" type="text" class="form-control"></td>
</tr>
<tr>
<td>分类圖片</td>
<td>
<input id="categoryPic" type="file" name="image" />
</td>
</tr>
<tr class="submitTR">
<td colspan="2" align="center">
<button type="button" class="btn btn-success">提 交</button>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
<div class="footer">
</div>
</body>
</html>
");
window.frames["iframe6082"].document.write(decodeHtml(code6082));
window.frames["iframe6082"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe6082"]).load(function(){
$("#iframe6082").height($("#iframe6082").contents().find("body").height()+showittryitheight);
});
$("#iframe6082").height($("#iframe6082").contents().find("body").height()+showittryitheight);
alreadyWriteCode6082 = code6082;
$("#rendering6082").hide();
$("#rendered6082").show();
}
var tRereshRetry2DemoPanel6082 = setInterval(rereshRetry2DemoPanel6082,1000);
var binded6082 = false;
$("textarea#stepcodeTextarea6082").keyup(function(){
if(!binded6082){
$(window).bind('beforeunload',function(){
binded6082 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code6082 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code6082!=newCode){
// window.frames["iframe6082"].document.write("
");
// window.frames["iframe6082"].document.write(decodeHtml($("textarea#stepcodeTextarea6082").val()));
// window.frames["iframe6082"].document.close();
// $(window.frames["iframe6082"]).load(function(){
// $("#iframe6082").height($("#iframe6082").contents().find("body").height()+showittryitheight);
// });
// code6082 = newCode;
// }
});
$(".tryButton6082").click(function(){
$("#tryDiv6082").show();
$("#stepcodeTextarea6082").focus();
$("#stepcodeTextarea6082").height(200);
$("#iframe6082").height(0);
window.frames["iframe6082"].document.write("
");
window.frames["iframe6082"].document.write(decodeHtml($("textarea#stepcodeTextarea6082").val()));
window.frames["iframe6082"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe6082"]).load(function(){
$("#iframe6082").height($("#iframe6082").contents().find("body").height()+showittryitheight);
});
$("#iframe6082").height($("#iframe6082").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor6082.focus();
editor6082.setSize(null, "250");
$("#rendering6082").hide();
$("#rendered6082").hide();
});
var mixedMode = {
name: "htmlmixed",
scriptTypes: [{matches: /\/x-handlebars-template|\/x-mustache/i,
mode: null},
{matches: /(text|application)\/(x-)?vb(a|script)/i,
mode: "vbscript"}]
};
var editor6082 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea6082"), {
lineNumbers: true,
styleActiveLine: true,
matchBrackets: true,
mode:"text/html",
theme:"eclipse",
selectionPointer: true,
lineWrapping: true,
extraKeys: {
"Alt-/": "autocomplete",
"Ctrl-F": "findPersistent",
"F8": function(cm) {
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
},
"Esc": function(cm) {
if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
}
}
});
editor6082.on("change",function(doc){
if(!binded6082){
$(window).bind('beforeunload',function(){
binded6082 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code6082 = newCode;
$("textarea#stepcodeTextarea6082").val(newCode);
if(alreadyWriteCode6082!=code6082){
lastModifedTime6082 = new Date().getTime();
$("#rendering6082").show();
$("#rendered6082").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor6082 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor6082.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv6082").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|