Authored by xuhongyun

Merge branch 'dev_上下架弹窗优化' into grey

@@ -83,8 +83,9 @@ toast.prototype.init = function(options) { @@ -83,8 +83,9 @@ toast.prototype.init = function(options) {
83 }); 83 });
84 } 84 }
85 85
86 -  
87 - __self.dom.wrap.on('click', '[data-id]', function(event) { 86 + // mod by xueyin: 修改事件实现
  87 + // __self.dom.wrap.on('click', '[data-id]', function(event) {
  88 + __self.dom.wrap.find('.modal-content').on('click', '[data-id]', function(event) {
88 var $this = $(this); 89 var $this = $(this);
89 if (!$this.attr('disabled')) { 90 if (!$this.attr('disabled')) {
90 __self._trigger($this.data('id')); 91 __self._trigger($this.data('id'));
@@ -92,6 +93,17 @@ toast.prototype.init = function(options) { @@ -92,6 +93,17 @@ toast.prototype.init = function(options) {
92 event.preventDefault(); 93 event.preventDefault();
93 }); 94 });
94 95
  96 + // mod by xueyin: 对话框上的事件不需要冒泡
  97 + $(document).on('click', '.modal-content', function(event) {
  98 + event.stopPropagation();
  99 + });
  100 +
  101 + // add by xueyin: 增加点击背影关闭对话框功能
  102 + if (_o.backdrop == true) {
  103 + $(document).on('click', '.modal', function(event) {
  104 + __self.close();
  105 + });
  106 + }
95 return __self; 107 return __self;
96 }; 108 };
97 toast.prototype.addclass = function(css) { 109 toast.prototype.addclass = function(css) {
@@ -160,9 +172,11 @@ toast.prototype.time = function(second) { @@ -160,9 +172,11 @@ toast.prototype.time = function(second) {
160 }; 172 };
161 toast.prototype.zIndex = function () { 173 toast.prototype.zIndex = function () {
162 var __self = this, _o = __self.options; 174 var __self = this, _o = __self.options;
163 - var index = _o.zIndex++;  
164 - __self.dom.wrap.css('zIndex', index);  
165 - __self.dom.backdrop.css('zIndex', index - 1); 175 + // mod by xueyin 修改zindex,将对话框放到最上层
  176 + var index = _o.zIndex + 2;
  177 + __self.dom.wrap.find('.modal-content').css('zIndex', index);
  178 + __self.dom.wrap.css('zIndex', index - 1);
  179 + __self.dom.backdrop.css('zIndex', index - 2);
166 _o.zIndex = index; 180 _o.zIndex = index;
167 return __self; 181 return __self;
168 }; 182 };
@@ -181,6 +195,13 @@ toast.prototype.close = function() { @@ -181,6 +195,13 @@ toast.prototype.close = function() {
181 var __self = this, 195 var __self = this,
182 _o = __self.options; 196 _o = __self.options;
183 197
  198 + // add by xueyin: 关闭所注册过的事件
  199 + $(document).off('click', '.modal-content');
  200 +
  201 + if (_o.backdrop == true) {
  202 + $(document).off('click', '.modal');
  203 + }
  204 +
184 if (!__self.destroyed && __self.open) { 205 if (!__self.destroyed && __self.open) {
185 __self.dom.wrap.removeClass('in'); 206 __self.dom.wrap.removeClass('in');
186 setTimeout(function() { 207 setTimeout(function() {
@@ -248,12 +269,14 @@ toast._through = function() { @@ -248,12 +269,14 @@ toast._through = function() {
248 return api; 269 return api;
249 }; 270 };
250 toast.open = function(options, callback) { 271 toast.open = function(options, callback) {
251 - return this._through({  
252 - title: options.title,  
253 - addClass: options.addClass,  
254 - width: options.width,  
255 - content: options.content  
256 - }); 272 + // mod by xueyin: 这个参数传递很奇怪,不全,修改之
  273 + // return this._through({
  274 + // title: options.title,
  275 + // addClass: options.addClass,
  276 + // width: options.width,
  277 + // content: options.content
  278 + // });
  279 + return this._through(options);
257 } 280 }
258 toast.alert = function(content, callback) { 281 toast.alert = function(content, callback) {
259 var __self = this, 282 var __self = this,
@@ -243,8 +243,9 @@ var g = new common.grid({ @@ -243,8 +243,9 @@ var g = new common.grid({
243 } else if (item.middleSortName) { 243 } else if (item.middleSortName) {
244 catgory = item.middleSortName; 244 catgory = item.middleSortName;
245 }; 245 };
246 -  
247 - html.push('<p>名称:<a target="_blank" data-index="' + item.__index + '" href="/base/goods/info/' + item.productSkn + '/' + item.isAuditing + '" class="btn btn-info btn-xs edit-class-btn">' + item.productName + '</a>'); 246 + // mod by xueyin: 优化,商品名称去掉链接,支持业务复制
  247 + //html.push('<p>名称:<a target="_blank" data-index="' + item.__index + '" href="/base/goods/info/' + item.productSkn + '/' + item.isAuditing + '" class="btn btn-info btn-xs edit-class-btn">' + item.productName + '</a>');
  248 + html.push("<p>名称:" + item.productName + "</p>");
248 html.push("<p>品牌:" + item.brandName + "</p>"); 249 html.push("<p>品牌:" + item.brandName + "</p>");
249 html.push("<p>品类:" + catgory + "</p>"); 250 html.push("<p>品类:" + catgory + "</p>");
250 return html.join(''); 251 return html.join('');
@@ -449,6 +450,10 @@ var g = new common.grid({ @@ -449,6 +450,10 @@ var g = new common.grid({
449 display: "操作", 450 display: "操作",
450 render: function(item) { 451 render: function(item) {
451 var html = []; 452 var html = [];
  453 +
  454 + // add by xueyin: 仍然保留详情页链接
  455 + html.push('<a target="_blank" data-index="' + item.__index + '" href="/base/goods/info/' + item.productSkn + '/' + item.isAuditing + '" class="btn btn-info btn-xs edit-class-btn">查看</a>');
  456 +
452 if (item.isAuditing != 100) { 457 if (item.isAuditing != 100) {
453 html.push('<a target="_blank" data-index="' + item.__index + '" class="btn btn-info btn-xs edit-class-btn" href="/base/goods/update/' + item.productSkn + '/' + item.isAuditing + '">修改</a>'); 458 html.push('<a target="_blank" data-index="' + item.__index + '" class="btn btn-info btn-xs edit-class-btn" href="/base/goods/update/' + item.productSkn + '/' + item.isAuditing + '">修改</a>');
454 } 459 }
@@ -605,7 +605,10 @@ $('#basicTable').on('click', '.shelve-btn', function () { @@ -605,7 +605,10 @@ $('#basicTable').on('click', '.shelve-btn', function () {
605 shelveLayer = common.dialog.open({ 605 shelveLayer = common.dialog.open({
606 title: '上/下架', 606 title: '上/下架',
607 width: 900, 607 width: 900,
608 - content: common.util.__template($('#template').html(), res.data.baseProductInfo.baseProduct) 608 + content: common.util.__template($('#template').html(), res.data.baseProductInfo.baseProduct),
  609 +
  610 + // add by xueyin: 增加支持点击背影关闭对话框功能
  611 + backdrop: true
609 }); 612 });
610 613
611 $(that).removeClass('disabled'); 614 $(that).removeClass('disabled');