|
注:这里的原型是展示效果,让大家有个感性的认识,编码不在这里进行,项目开发过程会在后面的章节从零开始。
");
window.frames["iframe_show6086"].document.write(decodeHtml($("textarea#stepcodeTextarea6086").val()));
window.frames["iframe_show6086"].document.close();
$(window.frames["iframe_show6086"]).load(function(){
$("#iframe_show6086").height($("#iframe_show6086").contents().find("body").height()+showittryitheight);
});
$("#iframe_show6086").height($("#iframe_show6086").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>
<title>编辑产品属性值</title>
<script>
$(function() {
$("input.pvValue").keyup(function(){
var value = $(this).val();
var page = "admin_product_updatePropertyValue";
var pvid = $(this).attr("pvid");
var parentSpan = $(this).parent("span");
parentSpan.css("border","1px solid yellow");
if(false)$.post(
page,
{"value":value,"pvid":pvid},
function(result){
if("success"==result)
parentSpan.css("border","1px solid green");
else
parentSpan.css("border","1px solid red");
}
);
});
});
</script>
<div class="workingArea">
<ol class="breadcrumb">
<li><a href="#nowhere">所有分类</a></li>
<li><a href="#nowhere">太阳镜</a></li>
<li class="active">好先生同款墨镜孙红雷偏光男士太阳镜韩明星女款圆脸方框金属近视</li>
<li class="active">编辑产品属性</li>
</ol>
<div class="editPVDiv">
<div class="eachPV">
<span class="pvName" >适合脸型</span>
<span class="pvValue"><input class="pvValue" pvid="13169" type="text" value="圆脸 长脸 方脸 椭圆形脸"></span>
</div>
<div class="eachPV">
<span class="pvName" >是否可调</span>
<span class="pvValue"><input class="pvValue" pvid="13170" type="text" value="镜面弧度 镜架松紧"></span>
</div>
<div class="eachPV">
<span class="pvName" >颜色分类</span>
<span class="pvValue"><input class="pvValue" pvid="13171" type="text" value="黑框黑灰片 枪框渐灰片 银框反光膜天蓝片 金框G15片"></span>
</div>
<div class="eachPV">
<span class="pvName" >货号</span>
<span class="pvValue"><input class="pvValue" pvid="13172" type="text" value="8009"></span>
</div>
<div class="eachPV">
<span class="pvName" >镜片材质</span>
<span class="pvValue"><input class="pvValue" pvid="13173" type="text" value="其他"></span>
</div>
<div class="eachPV">
<span class="pvName" >是否商场同款</span>
<span class="pvValue"><input class="pvValue" pvid="13174" type="text" value="否"></span>
</div>
<div class="eachPV">
<span class="pvName" >眼镜配件类型</span>
<span class="pvValue"><input class="pvValue" pvid="13175" type="text" value="镜布 镜盒"></span>
</div>
<div class="eachPV">
<span class="pvName" >价格区间</span>
<span class="pvValue"><input class="pvValue" pvid="13176" type="text" value="100 - 200元"></span>
</div>
<div class="eachPV">
<span class="pvName" >风格</span>
<span class="pvValue"><input class="pvValue" pvid="13177" type="text" value="个性 舒适 运动"></span>
</div>
<div class="eachPV">
<span class="pvName" >适用性别</span>
<span class="pvValue"><input class="pvValue" pvid="13178" type="text" value="男"></span>
</div>
<div class="eachPV">
<span class="pvName" >功能</span>
<span class="pvValue"><input class="pvValue" pvid="13179" type="text" value="防UVA 防UVB 偏光"></span>
</div>
<div class="eachPV">
<span class="pvName" >型号</span>
<span class="pvValue"><input class="pvValue" pvid="13180" type="text" value="8009"></span>
</div>
<div class="eachPV">
<span class="pvName" >上市时间</span>
<span class="pvValue"><input class="pvValue" pvid="13181" type="text" value="2014年春夏季"></span>
</div>
<div class="eachPV">
<span class="pvName" >产地</span>
<span class="pvValue"><input class="pvValue" pvid="13182" type="text" value="厦门"></span>
</div>
<div class="eachPV">
<span class="pvName" >品牌</span>
<span class="pvValue"><input class="pvValue" pvid="13183" type="text" value="PARZIN/帕森"></span>
</div>
<div style="clear:both"></div>
</div>
</div>
<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>
<title>编辑产品属性值</title>
<script>
$(function() {
$("input.pvValue").keyup(function(){
var value = $(this).val();
var page = "admin_product_updatePropertyValue";
var pvid = $(this).attr("pvid");
var parentSpan = $(this).parent("span");
parentSpan.css("border","1px solid yellow");
if(false)$.post(
page,
{"value":value,"pvid":pvid},
function(result){
if("success"==result)
parentSpan.css("border","1px solid green");
else
parentSpan.css("border","1px solid red");
}
);
});
});
</script>
<div class="workingArea">
<ol class="breadcrumb">
<li><a href="#nowhere">所有分类</a></li>
<li><a href="#nowhere">太阳镜</a></li>
<li class="active">好先生同款墨镜孙红雷偏光男士太阳镜韩明星女款圆脸方框金属近视</li>
<li class="active">编辑产品属性</li>
</ol>
<div class="editPVDiv">
<div class="eachPV">
<span class="pvName" >适合脸型</span>
<span class="pvValue"><input class="pvValue" pvid="13169" type="text" value="圆脸 长脸 方脸 椭圆形脸"></span>
</div>
<div class="eachPV">
<span class="pvName" >是否可调</span>
<span class="pvValue"><input class="pvValue" pvid="13170" type="text" value="镜面弧度 镜架松紧"></span>
</div>
<div class="eachPV">
<span class="pvName" >颜色分类</span>
<span class="pvValue"><input class="pvValue" pvid="13171" type="text" value="黑框黑灰片 枪框渐灰片 银框反光膜天蓝片 金框G15片"></span>
</div>
<div class="eachPV">
<span class="pvName" >货号</span>
<span class="pvValue"><input class="pvValue" pvid="13172" type="text" value="8009"></span>
</div>
<div class="eachPV">
<span class="pvName" >镜片材质</span>
<span class="pvValue"><input class="pvValue" pvid="13173" type="text" value="其他"></span>
</div>
<div class="eachPV">
<span class="pvName" >是否商场同款</span>
<span class="pvValue"><input class="pvValue" pvid="13174" type="text" value="否"></span>
</div>
<div class="eachPV">
<span class="pvName" >眼镜配件类型</span>
<span class="pvValue"><input class="pvValue" pvid="13175" type="text" value="镜布 镜盒"></span>
</div>
<div class="eachPV">
<span class="pvName" >价格区间</span>
<span class="pvValue"><input class="pvValue" pvid="13176" type="text" value="100 - 200元"></span>
</div>
<div class="eachPV">
<span class="pvName" >风格</span>
<span class="pvValue"><input class="pvValue" pvid="13177" type="text" value="个性 舒适 运动"></span>
</div>
<div class="eachPV">
<span class="pvName" >适用性别</span>
<span class="pvValue"><input class="pvValue" pvid="13178" type="text" value="男"></span>
</div>
<div class="eachPV">
<span class="pvName" >功能</span>
<span class="pvValue"><input class="pvValue" pvid="13179" type="text" value="防UVA 防UVB 偏光"></span>
</div>
<div class="eachPV">
<span class="pvName" >型号</span>
<span class="pvValue"><input class="pvValue" pvid="13180" type="text" value="8009"></span>
</div>
<div class="eachPV">
<span class="pvName" >上市时间</span>
<span class="pvValue"><input class="pvValue" pvid="13181" type="text" value="2014年春夏季"></span>
</div>
<div class="eachPV">
<span class="pvName" >产地</span>
<span class="pvValue"><input class="pvValue" pvid="13182" type="text" value="厦门"></span>
</div>
<div class="eachPV">
<span class="pvName" >品牌</span>
<span class="pvValue"><input class="pvValue" pvid="13183" type="text" value="PARZIN/帕森"></span>
</div>
<div style="clear:both"></div>
</div>
</div>
");
window.frames["iframe6086"].document.write(decodeHtml(code6086));
window.frames["iframe6086"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe6086"]).load(function(){
$("#iframe6086").height($("#iframe6086").contents().find("body").height()+showittryitheight);
});
$("#iframe6086").height($("#iframe6086").contents().find("body").height()+showittryitheight);
alreadyWriteCode6086 = code6086;
$("#rendering6086").hide();
$("#rendered6086").show();
}
var tRereshRetry2DemoPanel6086 = setInterval(rereshRetry2DemoPanel6086,1000);
var binded6086 = false;
$("textarea#stepcodeTextarea6086").keyup(function(){
if(!binded6086){
$(window).bind('beforeunload',function(){
binded6086 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code6086 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code6086!=newCode){
// window.frames["iframe6086"].document.write("
");
// window.frames["iframe6086"].document.write(decodeHtml($("textarea#stepcodeTextarea6086").val()));
// window.frames["iframe6086"].document.close();
// $(window.frames["iframe6086"]).load(function(){
// $("#iframe6086").height($("#iframe6086").contents().find("body").height()+showittryitheight);
// });
// code6086 = newCode;
// }
});
$(".tryButton6086").click(function(){
$("#tryDiv6086").show();
$("#stepcodeTextarea6086").focus();
$("#stepcodeTextarea6086").height(200);
$("#iframe6086").height(0);
window.frames["iframe6086"].document.write("
");
window.frames["iframe6086"].document.write(decodeHtml($("textarea#stepcodeTextarea6086").val()));
window.frames["iframe6086"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe6086"]).load(function(){
$("#iframe6086").height($("#iframe6086").contents().find("body").height()+showittryitheight);
});
$("#iframe6086").height($("#iframe6086").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor6086.focus();
editor6086.setSize(null, "250");
$("#rendering6086").hide();
$("#rendered6086").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 editor6086 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea6086"), {
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);
}
}
});
editor6086.on("change",function(doc){
if(!binded6086){
$(window).bind('beforeunload',function(){
binded6086 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code6086 = newCode;
$("textarea#stepcodeTextarea6086").val(newCode);
if(alreadyWriteCode6086!=code6086){
lastModifedTime6086 = new Date().getTime();
$("#rendering6086").show();
$("#rendered6086").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor6086 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor6086.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv6086").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|
代码高亮插件双击即可选中,不过部分同学反应,通过代码高亮插件复制的代码无法在IDEA里正常显示,这里提供TEXTAREA的方式,方便复制,谢谢
1. 自行完成练习
根据练习目标尽量自己实现代码效果,期间会碰到疑问,难题,和自己不懂的地方,这些都是必要的过程
2. 带着疑问查看答案
完成过程中,碰到无法解决的问题,带着疑问,查看答案,分析答案的解决思路
3. 查看答案讲解视频
依然有不明白的地方,点开视频讲解,带着疑问,听视频讲解有问题的部分
4. 再做一遍
理解后,再从头做一遍,把有疑问的地方都捋清楚
5. 总结
最后再总结一遍,总结思路,总结解决办法,以后遇到类似的问题,怎么处理
HOW2J公众号,关注后实时获知布最新的教程和优惠活动,谢谢。
提问之前请登陆
|