Authored by 姜敏

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

... ... @@ -31,11 +31,11 @@ function batchExport(el, type) {
},
onStart: function(params) {
params.brandId=common.util.__input("brandId");
params.shopId=common.util.__input("shopId");
params.shopsId=common.util.__input("shopId");
params.supplierId=common.util.__input("supplierId");
params.brandName=params.brandId?$("#brandId").find("option[value="+$("#brandId").val()+"]").text():"";
params.shopsName=params.shopId?$("#shopId").find("option[value="+$("#shopId").val()+"]").text():"";
params.shopsName=params.shopsId?$("#shopId").find("option[value="+$("#shopId").val()+"]").text():"";
params.supplierName=params.supplierId?$("#supplierId").find("option[value="+$("#supplierId").val()+"]").text():"";
console.log("params",params);
... ...
... ... @@ -101,7 +101,8 @@ var g = new common.grid({
name: 'picImgUrl',
render: function(item) {
if (item.picImgUrl) {
return '<a target="_blank" href="' + item.productUrl + '"><img src="' + item.picImgUrl + '" width="100" height="60"></a>';
return '<a class="list-img" target="_blank" href="' + item.productUrl + '">' +
'<img src="' + item.picImgUrl + '"></a>';
} else {
return '';
}
... ...
... ... @@ -51,7 +51,25 @@ $(document).on("click",".tag a",function(){
$("#taglist").html(common.util.__template2($("#template4").html(),{tags:g.selected}));
return false;
});
var Brand={},Brands=[];
$(document).on("click","#addBrands",function(){
common.util.__ajax({url:'/goods/brands/queryBrandsByStatus'},function(res){
res.data.forEach(function(item,index){
var brandAlif=item.brandAlif.toUpperCase();
if(/^[0-9]$/.test(item.brandAlif)){
brandAlif="0-9";
}
if(/^\W$/.test(item.brandAlif)){
brandAlif="#";
}
Brand[brandAlif]=Brand[brandAlif]||[];
Brand[brandAlif].push(item);
});
for(var i in Brand){
Brands.push({name:i,items:Brand[i]});
}
console.log(JSON.stringify(Brands));
},true);
});
var e=new common.edit("#panel-body",{});
... ...
... ... @@ -2,6 +2,21 @@
border-top: 1px solid #e7e7e7;
}
.list-img {
display: block;
width: 78px;
height: 78px;
line-height: 78px;
font-size: 0;
text-align: center;
img {
vertical-align: middle;
max-width: 100%;
max-height: 100%;
}
}
.red {
color: red;
font-family: bold;
... ...
... ... @@ -3,7 +3,7 @@
* @type {Object}
*/
module.exports = {
url:'http://admin.portal.yohobuy.com',
url:'http://admin.yohobuy.com',//'http://admin.portal.yohobuy.com',
sessionKeep:'/account/profile/display',
timeout:30000
};
\ No newline at end of file
... ...
... ... @@ -25,11 +25,7 @@ var errorMessage = {
util.setLogger(res.app.logger);
var options = {
url:oldService.login,
form:{
account:user,
password:password,
website:WEBSITE
}
form:'["'+user+'","'+password+'",1]'//'["zhiyuan","lzy111111",1]'//
}
//调用登陆
... ... @@ -38,8 +34,9 @@ var errorMessage = {
res.json(errorMessage);
return;
} else {
console.log(ret);
//调用菜单
_callGetMenu(ret.data.pid,function(err,data){
_callGetMenu(ret.data.pid,ret.data.role_id,function(err,data){
if(err) {
res.json(errorMessage);
} else {
... ... @@ -66,24 +63,22 @@ var errorMessage = {
* @param {Number} pid 操作员ID
* @param {Function} callback 回调
*/
function _callGetMenu(pid,callback) {
function _callGetMenu(pid,roleid,callback) {
var options = {
url:oldService.getResourceByPid,
form:{
pid:pid,
website:WEBSITE
}
form:'['+pid+','+roleid+',1]'
}
console.log(options);
util.httpCall(options,function(err,ret){
if(err) {
callback(err);
} else {
var menuData = {menu:[],right:{}};
if(ret.data && ret.data.length>0) {
if(ret.data) {
menuData = _makeMenu(ret.data);
}
_getAllMenu(function(ret){
filterRight(ret,menuData);
menuData.noRight = filterRight(ret,menuData);
delete menuData.right;
callback(null,menuData);
... ... @@ -102,14 +97,17 @@ function _callGetMenu(pid,callback) {
function filterRight(ret,menuData) {
var noRight = {};
//匹配没有权限
_.forEach(ret,function(v,k){
if(v.module_url!=='') {
if(!menuData.right[v.module_url]) {
noRight[v.module_url] = true;
for(var key in ret){
var item=ret[key];
for(var i in item.sub){
var v=item.sub[i];
if(v.menu_url!=='') {
if(!menuData.right[v.menu_url]) {
noRight[v.menu_url] = true;
}
}
}
});
}
return noRight;
}
... ... @@ -120,7 +118,7 @@ function filterRight(ret,menuData) {
function _getAllMenu (callback) {
var options = {
url:oldService.getAllResByWebsite+'?website='+WEBSITE+'&sort=',
method:'GET'
form:'['+WEBSITE+']'
}
util.httpCall(options,function(err,ret){
... ... @@ -140,27 +138,51 @@ function _getAllMenu (callback) {
function _makeMenu (data) {
var menu = [];
var right = {};
_.forEach(data,function(v){
var item = {
title:v.resource_name,
for(var key in data){
var v=data[key];
var item = {
title:v.menu_name,
}
if(v.parent_id === "0") {
item.parent = 'menu-template';
var itemSubs = [];
_.forEach(v.sub,function(val) {
var sub = {
title:val.resource_name,
href:val.module_url,
title:val.menu_name,
href:val.menu_url,
icon: 'list-alt'
}
right[val.module_url] = true;
right[val.menu_url] = true;
itemSubs.push(sub);
});
item.menu = itemSubs;
}
menu.push(item);
});
}
// _.forEach(data,function(v){
// var item = {
// title:v.menu_name,
// }
// if(v.parent_id === "0") {
// item.parent = 'menu-template';
// var itemSubs = [];
// _.forEach(v.sub,function(val) {
// console.log(v.sub);
// var sub = {
// title:val.menu_name,
// href:val.menu_url,
// icon: 'list-alt'
// }
// right[val.menu_url] = true;
// itemSubs.push(sub);
// });
// item.menu = itemSubs;
// }
// menu.push(item);
// });
return {
menu:menu,
... ...
var oldSerDomain = 'http://service.api.yohobuy.com';
// var oldSerDomain = 'http://service.api.yohobuy.com';
// module.exports = {
// login: oldSerDomain + '/account/api/v1/profile/login',
// getResourceByPid: oldSerDomain + '/account/api/v1/profile/getResourceByPid',
// getAllResByWebsite: oldSerDomain + '/account/api/v1/resources/getAllResByWebsite'
// };
var oldSerDomain = 'http://lserve.yohobuy.com';
module.exports = {
login: oldSerDomain + '/account/api/v1/profile/login',
getResourceByPid: oldSerDomain + '/account/api/v1/profile/getResourceByPid',
getAllResByWebsite: oldSerDomain + '/account/api/v1/resources/getAllResByWebsite'
};
\ No newline at end of file
login: oldSerDomain + '/service/account/v1/Profile/login',
getResourceByPid: oldSerDomain + '/service/account/v1/Profile/getMenuByPid',
getAllResByWebsite: oldSerDomain + '/service/setting/v1/menu/getAllMenu'
};
... ...
... ... @@ -243,4 +243,27 @@
[[each tags as tag __index]]
<span class="tag"><span>[[tag.tagName]]</span><a href="#" title="Removing tag" data-index='[[__index]]'>x</a></span>
[[/each]]
</script>
<script type="text/template" id="template5">
<div class="row">
<div class="form-group">
[[each Brands as brand index]]
<a>[[brand.name]]</a>
[[/each]]
</div>
<div class="form-group">
[[each Brands as brand index]]
<div class="form-group" name="[[brand.name]]">
[[each brand.items as item __index ]]
<input type="checkbox" value="[[item.id]]" name="brandCheckBox">
<label>[[item.brandName]]</label>
[[/each]]
</div>
[[/each]]
</div>
</div>
</script>
\ No newline at end of file
... ...