Authored by 陶雨

template2正则匹配修改

... ... @@ -7,7 +7,9 @@ require('../util/custom.js');
* 获取业务数据
*/
window.NETSALEDATA=require('./partials/data.js');
// require('./partials/search-key.js');
require('./partials/search-key.js');
require('./partials/size-info.js');
require('./partials/goods-sort.js');
console.log(window.NETSALEDATA);
... ...
var $ = require('jquery'),
common = require('../../common/common');
var searchSortList = window.NETSALEDATA.searchSortList;
for(var i = 0; i < searchSortList.length; i++) {
if(searchSortList[i].modelId == 1)
$("#brand-sort").val(searchSortList[i].intValue);
else if(searchSortList[i].modelId == 2)
$("#aolai-sort").val(searchSortList[i].intValue);
else if(searchSortList[i].modelId == 3)
$("#search-sort").val(searchSortList[i].intValue);
}
$('#add-category').on('click', function () {
var item = window.NETSALEDATA.searchSortList;
console.log(item);
for(var i = 0; i < searchSortList.length; i++) {
if(searchSortList[i].modelId == 1)
searchSortList[i].intValue = $("#brand-sort").val();
else if(searchSortList[i].modelId == 2)
searchSortList[i].intValue = $("#aolai-sort").val();
else if(searchSortList[i].modelId == 3)
searchSortList[i].intValue = $("#search-sort").val();
}
common.util.__ajax({
url:'/netSale/saveSearchSort',
data:{"searchSortList":searchSortList}
},function() {
});
});
\ No newline at end of file
... ...
var $ = require('jquery'),
common = require('../common/common');
\ No newline at end of file
common = require('../../common/common');
$("#searchKeys").val(window.NETSALEDATA.productExtBo.searchKeys);
var g = new common.grid({
el: "#search-key",
columns: [
{display: "ID", name: "id"},
{display: "内容", name: "content"},
{
display: "操作", name: "", render: function (item) {
return '<a class="btn btn-info add" data-index="' + item.__index + '">添加</a>';
}
}
]
});
g.init('/netSale/queryHotSearchTerms');
$(document).on('click', '.add', function() {
var item = g.rows[$(this).data("index")];
var value = $("#searchKeys").val();
if(value) value+=",";
$("#searchKeys").val(value + item.content);
});
\ No newline at end of file
... ...
var $ = require('jquery'),
common = require('../../common/common');
// window.NETSALEDATA=require('./data.js');
// var referenceSize = "";
// for(var i = 0; i < window.NETSALEDATA.sizeInfo.sizeBoList.length; i++) {
// referenceSize += window.NETSALEDATA.sizeInfo.sizeBoList[i].sizeName + " ";
// var sec = window.NETSALEDATA.sizeInfo.sizeBoList[i].sortAttributes;
// for(var j = 0; j < window.NETSALEDATA.sizeInfo.sizeBoList[i].sortAttributes.length; j++) {
// if(j > 0
// && window.NETSALEDATA.sizeInfo.sizeBoList[i].sortAttributes[j].sizeValue != ""
// && window.NETSALEDATA.sizeInfo.sizeBoList[i].sortAttributes[j].sizeValue != null) referenceSize += "/";
// referenceSize += window.NETSALEDATA.sizeInfo.sizeBoList[i].sortAttributes[j].sizeValue;
// }
// referenceSize += "\t";
// }
// var html = "<table style='width:100%;valign:top;'>";
// for (var x = 0; x < machines.length; x++) {
// if ($(this).attr("id") == machines[x].ID.substring(0, 3))
// html += ("<tr><td><input type='checkbox' id='" + machines[x].ID + "' />" + machines[x].ID + "</td></tr>");
// }
// html += "</table>";
// $("#grid_machines td[id=" + $(this).attr("id") + "]").append(html);
// $("#reference-size").val(referenceSize);
// for(var sizeAttributeBo in window.NETSALEDATA.sizeInfo.sizeAttributeBos) {
// if(sizeAttributeBo.attributeNam == "厚") {
// $("#height").val(sizeAttributeBo.id);
// } else if(sizeAttributeBo.attributeNam == "宽") {
// $("#width").val(sizeAttributeBo.id);
// } else if(sizeAttributeBo.attributeNam == "长") {
// $("#length").val(sizeAttributeBo.id);
// }
// }
$("#body").html(common.util.__template2($("#template").html(),window.NETSALEDATA.sizeInfo));
\ No newline at end of file
... ...
// var $ = require('jquery'),
// common = require('../common/common');
// var g = new common.grid({
// el: "#hot-key",
// columns: [
// ]
// });
\ No newline at end of file
exports.domain = require('../config/common.js').domain;
exports.res = [
{
route:'/netSale/saveSearchSort',
method:'POST',
url: '/product/saveSearchSort',
params: [
{name: 'searchSortList', type: 'string'}
]
},
{
route:'/netSale/queryHotSearchTerms',
method:'POST',
url: '/searchWords/queryHotSearchTerms',
params: [
{name: 'page', type: 'number'},
{name: 'size', type: 'number', def: 10}
]
}
];
\ No newline at end of file
... ...
... ... @@ -6,25 +6,25 @@
</div>
<h2 class="panel-title">商品排序设置</h2>
</div>
<div class="panel-body nopadding">
<div class="panel-body nopadding" id="goods-sort">
<div class="form-group">
<label class="col-sm-1 control-label" for="name">品牌:</label>
<label class="col-sm-1 control-label" for="brand-sort">品牌:</label>
<div class="col-sm-2">
<input type="text" class="form-control" id="name" value="{name}" required="required" />
<input type="text" class="form-control" id="brand-sort" value="{brand-sort}" required="required" />
</div>
<label class="col-sm-1 control-label" for="name">奥莱</label>
<label class="col-sm-1 control-label" for="aolai-sort">奥莱</label>
<div class="col-sm-2">
<input type="text" class="form-control" id="name" value="{name}" required="required" />
<input type="text" class="form-control" id="aolai-sort" value="{aolai-sort}" required="required" />
</div>
<label class="col-sm-1 control-label" for="name">搜索</label>
<label class="col-sm-1 control-label" for="search-sort">搜索</label>
<div class="col-sm-2">
<input type="text" class="form-control" id="name" value="{name}" required="required" />
<input type="text" class="form-control" id="search-sort" value="{search-sort}" required="required" />
</div>
</div>
<div class="col-sm-12" style="color: red;"><div class="col-sm-1"></div>提示:商品在品牌商品列表中的排序,数字越大越靠前</div>
</div>
<div class="panel-footer">
<button class="btn btn-primary">保存</button>
<button class="btn btn-primary" id="sort-save">保存</button>
</div>
</form>
</div>
\ No newline at end of file
... ...
... ... @@ -8,18 +8,16 @@
<div class="panel-body">
<div class="form-group">
<label class="col-sm-1 control-label height40" for="name">商品关键词</label>
<label class="col-sm-1 control-label height40" for="searchKeys">商品关键词</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="name" value="{name}" required="required" />
<input type="text" class="form-control" id="searchKeys" value="{searchKeys}" required="required" />
</div>
<div class="height40" style="color: red;">每个关键词请用英文“,”隔开</div>
</div>
<div class="contentpanel">
<div class="panel panel-default" style="margin-bottom: 10px">
<div class="form-group">
<label class="col-sm-1 control-label height40">搜索热词:</label>
<div class="col-sm-6">
<div class="col-sm-6" id="search-key">
</div>
</div>
... ...
... ... @@ -6,25 +6,31 @@
</div>
<h2 class="panel-title">尺码信息</h2>
</div>
<div class="panel-body nopadding">
<table class="table table-bordered">
<thead>
<tr>
<th>参考尺码</th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>{sizeName}<input type="text" disabled="disabled" /></td>
<td><input type="text" disabled="disabled" /></td>
<td><input type="text" disabled="disabled" /></td>
<td><input type="text" disabled="disabled" /></td>
</tr>
</tbody>
</table>
<div class="panel-body nopadding" id="body">
</div>
</form>
</div>
\ No newline at end of file
</div>
<script type="text/template" id="template">
<div class="row">
<div class="panel-col">
<p>参考尺码</p>
<p>
[[each sizeBoList as item index]]
<span>[[item.sizeName]]</span>
<p>
[[each item.sortAttributes as item1 index1]]
<span>item1.sizeValue</span>
[[/each]]
</p>
[[/each]]
</p>
</div>
[[each sizeAttributeBos as item index]]
<div class="panel-col">
<p>[[item.attributeName]]</p>
<p>[[item.id]]</p>
</div>
[[/each]]
</div>
</script>
\ No newline at end of file
... ...