Authored by 马力

Merge branch 'dev_5.6' into test5.6

# Conflicts:
#	code/apps/goods/controllers/basegoods.js
#	code/apps/resource/views/__partail/jiangming.html
#	code/static/js.jquery/module/resource/resourceManage/ContentManage.js
@@ -154,7 +154,19 @@ module.exports = { @@ -154,7 +154,19 @@ module.exports = {
154 } 154 }
155 return callback(null, result); 155 return callback(null, result);
156 }); 156 });
157 - } else { 157 + }else if (req.body.bucket === 'staticFile') {
  158 + req.body.file = fs.createReadStream(req.files[req.body.filename].path);
  159 + request.post({
  160 + url: config.domain + '/fileupload/uploadStaticFile',
  161 + formData: req.body
  162 + }, function optionalCallback(error, httpResponse, rebody) {
  163 + if (!error && httpResponse.statusCode == 200) {
  164 + result = JSON.parse(rebody);
  165 + result.status = true;
  166 + }
  167 + return callback(null, result);
  168 + });
  169 + }else {
158 req.body.file = fs.createReadStream(req.files[req.body.filename].path); 170 req.body.file = fs.createReadStream(req.files[req.body.filename].path);
159 request.post({ 171 request.post({
160 url: config.domain + '/fileupload/upload', 172 url: config.domain + '/fileupload/upload',
@@ -119,10 +119,11 @@ module.exports=function(app) { @@ -119,10 +119,11 @@ module.exports=function(app) {
119 119
120 app.post("/product/queryProductPicBySkn","basegoods_queryProductPicBySkn"); 120 app.post("/product/queryProductPicBySkn","basegoods_queryProductPicBySkn");
121 121
  122 +
  123 + app.post("/basegoods/queryProductColors","basegoods_queryProductColors");
  124 +
  125 +
122 app.post("/product/queryProductInfoBySkns","basegoods_queryProductInfoBySkns"); 126 app.post("/product/queryProductInfoBySkns","basegoods_queryProductInfoBySkns");
123 127
124 app.post("/product/searchProductDetail","basegoods_searchProductDetail"); 128 app.post("/product/searchProductDetail","basegoods_searchProductDetail");
125 -  
126 - app.post("/basegoods/queryProductColors","basegoods_queryProductColors");  
127 -  
128 } 129 }
@@ -14,7 +14,7 @@ module.exports={ @@ -14,7 +14,7 @@ module.exports={
14 {name: 'pageTitle', type: 'String'}, 14 {name: 'pageTitle', type: 'String'},
15 {name: 'keyWord', type: 'String'}, 15 {name: 'keyWord', type: 'String'},
16 {name: 'pageDesc', type: 'String'}, 16 {name: 'pageDesc', type: 'String'},
17 - {name: 'content', type: 'String'} 17 + {name: 'zip', type: 'String'}
18 ] 18 ]
19 }, 19 },
20 deleteById:{ 20 deleteById:{
@@ -48,6 +48,17 @@ @@ -48,6 +48,17 @@
48 <script type="text/template" id="template"> 48 <script type="text/template" id="template">
49 49
50 <input type="text" hidden="true" id="id" value="[[id]]"/> 50 <input type="text" hidden="true" id="id" value="[[id]]"/>
  51 + [[if !modifyFlag]]
  52 + <div class="form-group">
  53 + <label class="col-sm-2 control-label">上传文件</label>
  54 + <div class="col-sm-10">
  55 + <input type="hidden" name="zip" id="zip" class="form-control" required prompt="图片包">
  56 + <input id="uploadBox" name="图片包" type="file"
  57 + style="position: absolute; top: 0;left: 0;z-index: -999">
  58 + <div id="chooseFile" class="file-name btn btn-success">上传图片包</div>
  59 + </div>
  60 + </div>
  61 + [[/if]]
51 <div class="form-group"> 62 <div class="form-group">
52 <label for="fileType" class="col-sm-2 control-label">静态文件类型:</label> 63 <label for="fileType" class="col-sm-2 control-label">静态文件类型:</label>
53 64
@@ -83,9 +94,9 @@ @@ -83,9 +94,9 @@
83 </div> 94 </div>
84 </div> 95 </div>
85 96
86 - <div class="rows"> 97 + <div class="rows" [[if modifyFlag==0]]hidden="hidden"[[/if]]>
87 <label for="content" class="col-sm-2 control-label">内容:</label> 98 <label for="content" class="col-sm-2 control-label">内容:</label>
88 - <script id="content" style="width: 100%;" name="content" type="text/plain"></script> 99 + <script id="content" style="width: 100%;" name="content" type="text/plain"/>
89 </div> 100 </div>
90 101
91 102
@@ -175,14 +175,15 @@ @@ -175,14 +175,15 @@
175 <input class="form-control observe" type="text" value="[[item.name]]" data-field="list.[[index]].name"> 175 <input class="form-control observe" type="text" value="[[item.name]]" data-field="list.[[index]].name">
176 [[/if]] 176 [[/if]]
177 </div> 177 </div>
178 - [[if contentData.template_name=='appHotBrands']] 178 +
  179 + [[if contentData.template_name=='appHotBrands'||contentData.template_name=='customBrands']]
179 <div class="form-group"> 180 <div class="form-group">
180 - <select name="goTo" class="observe form-control" value="[[item.url.action]]" data-field="list.[[index]].url.action">  
181 - [[layout action_template]]  
182 - </select> 181 + <select name="goTo" class="observe form-control" value="[[item.url.action]]" data-field="list.[[index]].url.action">
  182 + [[layout action_template]]
  183 + </select>
183 </div> 184 </div>
184 <div class="form-group"> 185 <div class="form-group">
185 - <input placeholder="url" value="[[item.url.url]]" class="observe form-control" data-field="list.[[index]].url.url"/> 186 + <input placeholder="url" value="[[item.url.url]]" class="observe form-control" data-field="list.[[index]].url.url"/>
186 </div> 187 </div>
187 [[/if]] 188 [[/if]]
188 </td> 189 </td>
@@ -143,6 +143,7 @@ $(document).on('click', '#filter', function () { @@ -143,6 +143,7 @@ $(document).on('click', '#filter', function () {
143 //编辑 143 //编辑
144 $(document).on('click', '.info-modify', function () { 144 $(document).on('click', '.info-modify', function () {
145 var item = g.rows[$(this).data("index")]; 145 var item = g.rows[$(this).data("index")];
  146 + item.modifyFlag = 1;
146 staticFileOP("编辑", '/staticFileManage/update', item); 147 staticFileOP("编辑", '/staticFileManage/update', item);
147 }); 148 });
148 149
@@ -151,7 +152,7 @@ function staticFileOP(prefix, url, item) { @@ -151,7 +152,7 @@ function staticFileOP(prefix, url, item) {
151 var a = new common.edit(".confirm", { 152 var a = new common.edit(".confirm", {
152 //"bucket" : "author" 153 //"bucket" : "author"
153 }); 154 });
154 - 155 + console.log(item);
155 var dialog = new common.dialog({ 156 var dialog = new common.dialog({
156 width: '70%', 157 width: '70%',
157 title: prefix + '静态文件', 158 title: prefix + '静态文件',
@@ -168,7 +169,8 @@ function staticFileOP(prefix, url, item) { @@ -168,7 +169,8 @@ function staticFileOP(prefix, url, item) {
168 pageTitle: $('#pageTitle').val(), 169 pageTitle: $('#pageTitle').val(),
169 keyWord: $('#keyWord').val(), 170 keyWord: $('#keyWord').val(),
170 pageDesc: $('#pageDesc').val(), 171 pageDesc: $('#pageDesc').val(),
171 - content: baidu.getContent() 172 + content: baidu.getContent(),
  173 + zip:$('#zip').val()
172 } 174 }
173 }, function (res) { 175 }, function (res) {
174 //res=res.data; 176 //res=res.data;
@@ -206,4 +208,26 @@ function staticFileOP(prefix, url, item) { @@ -206,4 +208,26 @@ function staticFileOP(prefix, url, item) {
206 208
207 209
208 a.init(); 210 a.init();
209 -}  
  211 + $("#uploadBox").ajaxfileupload({
  212 + 'action': '/ajax/upload',
  213 + 'params': {
  214 + bucket: "staticFile",
  215 + __type: "upload"
  216 + },
  217 + onComplete: function (response) {
  218 + if (response.status && response.code == 200) {
  219 + if(response.data){
  220 + common.util.__tip(response.message, "success");
  221 + $("#zip").val(response.data);
  222 + }
  223 + } else {
  224 + common.util.__tip(response.message);
  225 + }
  226 + },
  227 + valid_extensions: ["zip"]
  228 + });
  229 +}
  230 +
  231 +$(document).on("click", "#chooseFile", function () {
  232 + $("#uploadBox").click();
  233 +});
@@ -284,7 +284,7 @@ var Bll = { @@ -284,7 +284,7 @@ var Bll = {
284 "id": Brands2[i].id, 284 "id": Brands2[i].id,
285 "title": Brands2[i].brand_name 285 "title": Brands2[i].brand_name
286 }; 286 };
287 - } else if(Bll.module.contentData.template_name == "appHotBrands"){ 287 + } else if(Bll.module.contentData.template_name == "appHotBrands"||Bll.module.contentData.template_name == "customBrands"){
288 pic = { 288 pic = {
289 "src": Brands2[i].brandIco, 289 "src": Brands2[i].brandIco,
290 "id": Brands2[i].id, 290 "id": Brands2[i].id,
@@ -461,17 +461,17 @@ $(document).on("change", ".observe", function () { @@ -461,17 +461,17 @@ $(document).on("change", ".observe", function () {
461 var urlName = $this.attr("placeholder"); 461 var urlName = $this.attr("placeholder");
462 //如果属性不存在,会报错 462 //如果属性不存在,会报错
463 if(typeof (urlName) !='undefined'){ 463 if(typeof (urlName) !='undefined'){
464 - if(platformName.toLocaleLowerCase().indexOf("web")==-1&&httpsEnable=='true'){  
465 - console.log("限制https")  
466 - if(urlName.indexOf("url")!=-1||urlName.indexOf("链接")!=-1||urlName.indexOf("地址")!=-1){  
467 - var urlVal = $this.val();  
468 - if(urlVal.toLowerCase().indexOf("https")!=0){  
469 - common.util.__tip("url必须以https开头!", "warning");  
470 - $this.val(''); 464 + if(platformName.toLocaleLowerCase().indexOf("web")==-1&&httpsEnable=='true'){
  465 + console.log("限制https")
  466 + if(urlName.indexOf("url")!=-1||urlName.indexOf("链接")!=-1||urlName.indexOf("地址")!=-1){
  467 + var urlVal = $this.val();
  468 + if(urlVal.toLowerCase().indexOf("https")!=0){
  469 + common.util.__tip("url必须以https开头!", "warning");
  470 + $this.val('');
  471 + }
471 } 472 }
472 } 473 }
473 } 474 }
474 - }  
475 var name = $this.data("field"); 475 var name = $this.data("field");
476 // 以 .. 开头的,赋值到 contentData 476 // 以 .. 开头的,赋值到 contentData
477 if (name.indexOf("..") == 0) { 477 if (name.indexOf("..") == 0) {
@@ -505,11 +505,11 @@ $(document).on("change", ".observe", function () { @@ -505,11 +505,11 @@ $(document).on("change", ".observe", function () {
505 window.onbeforeunload = function(){ 505 window.onbeforeunload = function(){
506 if(lock_type==1){ 506 if(lock_type==1){
507 common.util.__ajax({ 507 common.util.__ajax({
508 - url: "/resources/updateLock",  
509 - data: {id: param,  
510 - status:0}  
511 - }, function () {  
512 - }); 508 + url: "/resources/updateLock",
  509 + data: {id: param,
  510 + status:0}
  511 + }, function () {
  512 + });
513 } 513 }
514 } 514 }
515 /*删除*/ 515 /*删除*/
@@ -539,23 +539,23 @@ $(document).on("click", ".edit", function () { @@ -539,23 +539,23 @@ $(document).on("click", ".edit", function () {
539 if(item.contentData.template_name=='shopRecommend'){ 539 if(item.contentData.template_name=='shopRecommend'){
540 var list = item.contentData.data.list; 540 var list = item.contentData.data.list;
541 for(var i = 0; i < list.length; i++) { 541 for(var i = 0; i < list.length; i++) {
542 - if(typeof(list[i].goods2) == 'undefined'){  
543 - var goods2 = {  
544 - "src":"",  
545 - "url":{  
546 - "url":"",  
547 - "action":""  
548 - }  
549 - };  
550 - list[i].goods2 = goods2;  
551 - } 542 + if(typeof(list[i].goods2) == 'undefined'){
  543 + var goods2 = {
  544 + "src":"",
  545 + "url":{
  546 + "url":"",
  547 + "action":""
  548 + }
  549 + };
  550 + list[i].goods2 = goods2;
  551 + }
552 } 552 }
553 Bll.module = $.extend(true, {}, item); 553 Bll.module = $.extend(true, {}, item);
554 Bll.renderDialog("shopRecommend-template"); 554 Bll.renderDialog("shopRecommend-template");
555 Bll.toast(index, Bll.module); 555 Bll.toast(index, Bll.module);
556 var _shopRecommendFlag = item.contentData.isShopRecommend==''?"N":item.contentData.isShopRecommend; 556 var _shopRecommendFlag = item.contentData.isShopRecommend==''?"N":item.contentData.isShopRecommend;
557 changeShopRecommendDivShow(_shopRecommendFlag); 557 changeShopRecommendDivShow(_shopRecommendFlag);
558 - }else if(item.contentData.template_name=='appHotBrands'){ 558 + }else if(item.contentData.template_name=='appHotBrands'||item.contentData.template_name=='customBrands'){
559 //热门品牌兼容老版本,url设置空值 559 //热门品牌兼容老版本,url设置空值
560 var list = item.contentData.data.list; 560 var list = item.contentData.data.list;
561 for(var i=0;i<list.length;i++){ 561 for(var i=0;i<list.length;i++){
@@ -754,7 +754,7 @@ $(document).on("click", '.isShopRecommend', function () { @@ -754,7 +754,7 @@ $(document).on("click", '.isShopRecommend', function () {
754 Bll.module.contentData.isShopRecommend = _isShopRecommend; 754 Bll.module.contentData.isShopRecommend = _isShopRecommend;
755 //Bll.renderDialog("shopRecommend-template"); 755 //Bll.renderDialog("shopRecommend-template");
756 //切换到推荐 756 //切换到推荐
757 - changeShopRecommendDivShow(_isShopRecommend) 757 + changeShopRecommendDivShow(_isShopRecommend)
758 }); 758 });
759 $(document).on("change", '.shopChannelId', function () { 759 $(document).on("change", '.shopChannelId', function () {
760 Bll.module.contentData.shopChannelId = $(this).val(); 760 Bll.module.contentData.shopChannelId = $(this).val();
@@ -1155,7 +1155,7 @@ $(document).on("click", "#goodsSelectBtn", function () { @@ -1155,7 +1155,7 @@ $(document).on("click", "#goodsSelectBtn", function () {
1155 // 线上bug修改,商品个数不超过150个 1155 // 线上bug修改,商品个数不超过150个
1156 var datas = Bll.module.contentData.data.concat(gs); 1156 var datas = Bll.module.contentData.data.concat(gs);
1157 if (datas.length > 150) { 1157 if (datas.length > 150) {
1158 - common.util.__tip('选择商品失败,您选择的商品总数超过150个。', 'warning'); 1158 + common.util.__tip('选择商品失败,您选择的商品总数超过150个。', 'warning');
1159 return; 1159 return;
1160 } 1160 }
1161 1161