Authored by liuyue

Merge branch 'release/1.6' of git.dev.yoho.cn:platform/yohobuy-portal-fe into release/1.6

... ... @@ -143,7 +143,7 @@ e.init();
if(RESPONSEDATA.isAuditing!=200){
new common.dropDown({el:"#brandId",ajax:"brand",params:function(){
status:1
return {status:1}
}});
new common.dropDown({el:"#shopId",ajax:"sortbybrand",params:function(){
... ... @@ -416,7 +416,7 @@ e.on("validate",function(){
return "同一颜色包含两组相同尺码";
}
if(_count1>0&&common.util.__input("supplierId")){
return "JIT商品条码不能重复";
return "GIT商品条码不能重复";
}
});
e.on("validate",function(){
... ... @@ -431,7 +431,7 @@ $(document).on("click","#btnReview",function(){
if(e.validate()){
common.dialog.confirm("温馨提示","<p>若是JIT商品,请务必选择供应商!</p><p>你确定提交吗?</p>",function(){
common.dialog.confirm("温馨提示","<p>若是GIT商品,请务必选择供应商!</p><p>你确定提交吗?</p>",function(){
e.submit($("#basicForm").attr("action"),function(option){
var select=tabTree.getAddress();
... ...
... ... @@ -53,13 +53,13 @@ dropDown.prototype = {
type: 'POST',
delay: 250,
data: function(params) {
var param={};
if(Object.prototype.toString.call(option.params)=="[object Function]"){
param=option.params();
}else{
param=option.params;
}
var data = $.extend({}, {
idName: params.term
}, param || {});
... ...
... ... @@ -95,8 +95,6 @@ var util = {
return result;
},
__template2: function(str, source) {
// console.log(str);
var result = "";
var script = [];
script.push('var each=function(obj,fn){');
script.push(' var that=this;');
... ... @@ -112,66 +110,81 @@ var util = {
script.push(' }');
script.push(' return;');
script.push(' }');
script.push('}');
result = script.join('') + ";\n";
script.push('};');
var formstr = function(code) {
return "'" + code
.replace(/('|\\)/g, '\\$1')
.replace(/\r/g, '\\r')
.replace(/\n/g, '\\n') + "'";
}
//获取参数
var params = [];
var html = "";
html = str.replace(/\[\[(.*?)\]\]/igm, function(name, $1) {
var trim = $1.replace(/^\s+|\s+$/, '');
return "'" + code
.replace(/('|\\)/g, '\\$1')
.replace(/\r/g, '\\r')
.replace(/\n/g, '\\n') + "'";
}
var formJs=function(code){
var trim = code.replace(/^\s+|\s+$/, '');
//each goodsSizeList as item __index
if (/^each/.test(trim)) {
trim = trim.replace(/^each\s+([a-zA-Z0-1.]+)\s+as\s+(\w+)\s+(\w+)/, function($0, $1, $2, $3) {
params.push($1);
return trim.replace(/^each\b([\w\W]+)\bas\b([\w\W]+)\b([\w\W]+)/, function($0, $1, $2, $3) {
return 'each\( ' + $1 + ',function(' + $3 + ',' + $2 + '){';
});
return "[[" + trim + "]]";
} else
if (/^\/each/.test(trim)) {
trim = trim.replace(/^\/each/, '});')
return "[[" + trim + "]]";
}else if (/^\/each/.test(trim)) {
return trim.replace(/^\/each/, '});')
} else if (/^if/.test(trim)) {
trim = trim.replace(/^if(.+)/, function($0, $1) {
params.push($1);
return trim.replace(/^if(.+)/, function($0, $1) {
return 'if(' + $1 + '){';
});
return "[[" + trim + "]]";
} else if (/^\/if/.test(trim)) {
trim = trim.replace(/^\/if/, '};')
return "[[" + trim + "]]";
return trim.replace(/^\/if/, '};')
} else if (/^else$/.test(trim)) {
trim = trim.replace(/else/, '}else{');
return "[[" + trim + "]]";
} else {
params.push(trim);
return "[[+(" + trim + ")+]]";
return trim.replace(/else/, '}else{');
} else{
return code;
}
});
// console.log(params);
//.match(/(\w+)+/g)
for (var i in params) {
var aps = params[i].split(/\+|\-|\*|\/|\=|\!|\~|'|"|\||&/g);
for (var j in aps) {
var ap = aps[j].replace(/^\s+|\s+$/, '');
// console.log(":" + ap + ":");
if (!/^[0-9]+$/.test(ap) && !/^\s*$/.test(ap) && !/\./g.test(ap)) {
if (!source.hasOwnProperty(ap)) {
source[ap] = "";
// console.log(":" + ap + ":");
}
}
// var PARAMS={};
var OBJECT=/\.\w+|'.*'|".*"/g;
var KEYWORDS='for,if,else,each,as';
var SPECHAR=/\W/g;
var NUMBER=/^\d[^,]*|,\d[^,]*/g;
var SPLIT2_RE = /^$|,+/;
var REGEXKEYWORDS=new RegExp("\\b"+[KEYWORDS.replace(/,/g,'\\b|\\b')].join('|'),'g');
var getVar=function(code){
var strArr= code.replace(OBJECT,'')
.replace(SPECHAR,',')
.replace(REGEXKEYWORDS,'')
.replace(NUMBER,'')
.split(SPLIT2_RE);
for(var key in strArr){
if(strArr[key]&&!source.hasOwnProperty(strArr[key])){
source[strArr[key]]="";
}
}
}
var code=[],params={};
var arr=str.split(/\[\[|\]\]/).map(function(item,index){
if(index%2){
return{
value:item,
regex:true
};
}else{
return{
value:item,
regex:false
};
}
});
arr.forEach(function(item,index){
if(item.regex){
getVar(item.value);
code.push(formJs(item.value));
}else{
code.push("result.push("+formstr(item.value)+");");
}
});
// var header="var result=[],";
// header+=Object.keys(source).join(',')+";"
var keys = [];
for (var key in source) {
if (typeof source[key] == "boolean") {
... ... @@ -180,27 +193,15 @@ var util = {
keys.push(key + "=" + JSON.stringify(source[key]));
}
}
var header = "var " + keys.join(',') + ";";
var header = "var result=[]," + keys.join(',') + ";";
html = html.replace(/(^|\]\])(.*?)(\[\[|$)/igm, function(name, $1, $2) {
var trim = $2.replace(/^\s+|\s+$/, '');
return trim ? formstr($2) : '';
});
// var result="var result='';result+=";
var arr = html.split(/\n+/igm);
result += "var p=[];\n";
for (var i = 0; i < arr.length; i++) {
if (/^'/.test(arr[i])) {
result += "p.push(" + (arr[i]) + ");\n";
} else {
result += (arr[i]);
}
}
result += "return p.join('');\n";
var fn = new Function(header + result);
var b = fn.call(source);
return b;
var result=header + code.join('\n')+"return result.join('');";
// console.log(result);
var fn = new Function(script.join('')+result);
return fn.call(null,source);
},
__input: function(id) {
return !!~$.trim($('#' + id).val()) ? $('#' + id).val() : ""
... ...
var $ = require('jquery'),
common = require('../../common/common');
var searchKeys = window.NETSALEDATA.productExtBo.searchKeys || "";
$("#searchKeys").val(searchKeys);
var g = new common.grid({
el: "#search-key",
hash: false,
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');
$("#searchKeys").on('change', function() {
searchKeys = $("#searchKeys").val();
});
$(document).on('click', '.add', function() {
var item = g.rows[$(this).data("index")];
var value = $("#searchKeys").val();
if (value) value += ",";
$("#searchKeys").val(value + item.content);
searchKeys = $("#searchKeys").val();
});
$("#save-searchKey").on('click', function() {
common.util.__ajax({
url: '/netSale/saveNetSaleSearchKeys',
data: {
productSkn: window.NETSALEDATA.baseProductInfo.baseProduct.productSkn,
searchKeys: searchKeys
}
}, function(res) {
});
});
\ No newline at end of file
... ...
var $ = require('jquery'),
common = require('../common/common');
common = require('../common/common'),
util = require('../common/util');
new common.dropDown({el: "#help-categoryId", "ajax": "getHelpCategory"});
new common.dropDown({el: "#help-platform"});
var ENUM = {
id:{}
id:[]
};
var g = new common.grid({
... ... @@ -21,7 +22,7 @@ var $ = require('jquery'),
{display: "编号", name: "id"},
{display: "标题", name: "title"},
{display: "分类", name: "categoryId", render: function(item) {
return ENUM.id[item.id];
return ENUM.id[item.categoryId];
}},
{display: "平台", name: "platform", render: function(item) {
if(item.platform != null && item.platform.trim() != "") {
... ... @@ -53,9 +54,10 @@ var $ = require('jquery'),
for(var i = 0; i < list.length; i++) {
ENUM.id[list[i].id] = list[i].categoryName;
}
});
g.init('/operations/helpcontent/getAllHelpContent');
g.init('/operations/helpcontent/getAllHelpContent');
},function() {
g.init('/operations/helpcontent/getAllHelpContent');
},true);
var Bll = {
toast:function(url, item, hint) {
... ... @@ -65,8 +67,12 @@ var $ = require('jquery'),
common.util.__template($("#template").html(), item),
function() {
e.submit(url, function (option) {
option.data.categoryId = item.categoryId;
option.success=function() {
option.success=function(res) {
if(res.data.code == 200) {
util.__tip(res.data.message, "success");
} else {
util.__tip(res.data.message);
}
g.reload();
};
option.error=function(){};
... ... @@ -77,7 +83,7 @@ var $ = require('jquery'),
new common.dropDown({el: "#categoryId", "ajax": "getByCategoryId"});
if(hint == "修改内容") {
$("#select2-categoryId-container").html(ENUM.id[item.id]);
$("#select2-categoryId-container").html(ENUM.id[item.categoryId]);
}
}
};
... ...
... ... @@ -16,7 +16,9 @@ var config = {
// domain: 'http://172.16.6.240:8088/platform',
// domain:'http://172.16.6.240:8088/platform',//王书生
// domain: 'http://172.16.6.252:9080',//陈超
//domain: 'http://172.16.6.227:8088/platform', //玛丽
//domain:'http://172.16.6.227:8088/platform',//玛丽
// domain: 'http://192.168.102.202:8088/platform',
// domain:'http://172.16.9.8:8080/yohobuy-platform-web',//葛超
domain: 'http://192.168.102.202:8088/platform',
loggers: {
api: {
... ...
... ... @@ -103,7 +103,7 @@
<th>款型编码</th>
<th>条码</th>
<th>厂家颜色</th>
<th>厂家颜色</th>
<th>能否补货</th>
</tr>
</thead>
<tbody>
... ...
... ... @@ -59,7 +59,7 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="helpContent">帮助内容</label>
<label class="col-sm-2 control-label" for="content">帮助内容</label>
<div class="col-sm-10">
<input type="text" value="{content}" class="form-control" id="content" required="required" />
</div>
... ... @@ -68,7 +68,7 @@
<label class="col-sm-2 control-label" for="categoryId">分类</label>
<div class="col-sm-10">
<select id="categoryId" style="width: 280px;" value="{categoryId}">
<option value="-1">请选择分类</option>
<option value="{categoryId}">请选择分类</option>
</select>
</div>
</div>
... ...