Authored by weiqingting

4.5 商家端bug修改

... ... @@ -65,12 +65,9 @@ var Bll={
IsEnter:false,
productNameArr:['','男',''],
setProductName:function(){
if(!param){
if(!Bll.IsEnter){
if(!Bll.IsEnter){
$("#productName").val(Bll.productNameArr.join(""));
}
}
}
}
... ... @@ -262,7 +259,7 @@ var g=new common.grid({
}
for(var i=0;i<g.__length;i++){
var warp=$("#basicTable").find("tbody").children("tr").eq(i);
warp.find(".w-goods-text").prop("readonly",true).prop("disabled",true);
// warp.find(".w-goods-text").prop("readonly",true).prop("disabled",true);
warp.find("input[name=file]").prop("readonly",true).prop("disabled",true);
// warp.find(".modelCode").prop("readonly",true).prop("disabled",true);
// 如果为undefind,则清除require,并且设置为空
... ...
... ... @@ -116,12 +116,12 @@ new common.dropDown({
var tabTree = new common.tabTree("#sort");
tabTree.init();
var t = new common.tab({
var t = new common.tab2({
el: "#basicTab",
active:0,
click: function() {
var columnname = $(this).find('a').attr('columnname');
console.log("columnname = " + columnname);
var columnname=t.options.columns[t.options.active].name;
g.options.columns[6].hidden = true;
g.options.columns[9].hidden = true; //隐藏【创建时间】
... ... @@ -137,7 +137,6 @@ var t = new common.tab({
g.options.columns[6].hidden = false;
g.options.columns[15].hidden = false; //显示【状态】
g.options.columns[16].hidden = false; //显示【操作信息】
g.options.columns[17].hidden = false; //显示【操作】
$("#daochu").hide();
} else {
... ... @@ -151,31 +150,33 @@ var t = new common.tab({
break;
case 'failAuditNum':
{ // 驳回
{ // 待审核
g.options.columns[11].hidden = false; //显示【驳回时间】
g.options.columns[12].hidden = false; //显示【原因】
g.options.columns[17].hidden = false; //显示【操作】
}
$("#daochu").hide();
break;
case 'passAuditNum':
{ // 通过
{ // 待审核
g.options.columns[6].hidden = false;
g.options.columns[13].hidden = false; //显示【通过时间】
g.options.columns[14].hidden = false; //显示【通过人】
g.options.columns[17].hidden = false; //显示【操作】
}
$("#daochu").show();
break;
default:
{}
{
}
$("#daochu").hide();
break;
}
}
g.init('/product/getBaseProductList');
},
columns: [{
name: "toAuditNum",
... ... @@ -210,7 +211,7 @@ var g = new common.grid({
isJit: common.util.__input("isJit"),
isOutLets: common.util.__input("isOutLets"),
isAdvance: common.util.__input("isAdvance"),
isAuditing: AuditEnum.status[t.active],
isAuditing: AuditEnum.status[t.getData().name],
maxSortId: select[0] ? select[0].id : "",
middleSortId: select[1] ? select[1].id : "",
smallSortId: select[2] ? select[2].id : "",
... ... @@ -452,35 +453,7 @@ $(document).on('click', "#filter-btn", function() {
});
// // 通过
// var BllPass = {
// toast: function(content, fn) {
// common.dialog.confirm("温馨提示", content, function() {
// common.util.__ajax({
// url: '/product/batchAuditPassBaseProduct',
// data: fn()
// }, function() {
// g.reload();
// loadTab();
// });
// });
// }
// }
// // 驳回
// var BllReject = {
// toast: function(content, fn) {
// common.dialog.confirm("温馨提示", content, function() {
// common.util.__ajax({
// url: '/product/batchAuditRejectBaseProduct',
// data: fn()
// }, function() {
// g.reload();
// loadTab();
// });
// });
// }
// }
// tab初始化
var loadTab = function() {
... ... @@ -491,115 +464,15 @@ var loadTab = function() {
data: g.options.parms()
}, function(res) {
var __dt = $.extend({}, ENUM.tips, res.data);
t.init(__dt);
t.setData(__dt);
t.render(__dt);
}, true);
}, 400);
}
loadTab();
// //单个通过
// $(document).on("click", ".apply-success", function() {
// var item = g.rows[$(this).data("index")];
// var data = function() {
// return {
// productSknList: JSON.stringify([item.productSkn]),
// };
// }
// BllPass.toast("你确定审核通过吗?", data);
// });
// //单个驳回
// $(document).on("click", ".apply-back", function() {
// var item = g.rows[$(this).data("index")];
// var data = function() {
// var reason = $('#bohui').val();
// if (reason === '' || $.trim(reason) === '') {
// return "请填写驳回原因";
// }
// return {
// productSknList: JSON.stringify([item.productSkn]),
// rejectReason: reason
// };
// }
// BllReject.toast($("#template").html(), data);
// });
// //批量驳回
// $(document).on("click", "#reject-btn", function() {
// var selectedArr = g.selected,
// len = selectedArr.length,
// sknList = [];
// if (len <= 0) {
// common.util.__tip('请选择要驳回的商品', 'warning');
// return;
// }
// var data = function() {
// var reason = $('#bohui').val();
// if (reason === '' || $.trim(reason) === '') {
// return "请填写驳回原因";
// }
// $.each(selectedArr, function(i, value) {
// sknList.push(value['productSkn']);
// });
// console.log(sknList);
// return {
// productSknList: JSON.stringify(sknList),
// targetStatus: 3, // 驳回
// rejectReason: reason
// };
// }
// BllReject.toast($("#template").html(), data);
// });
// //批量通过
// $(document).on("click", "#pass-btn", function() {
// var selectedArr = g.selected,
// len = selectedArr.length,
// sknList = [];
// if (len <= 0) {
// common.util.__tip('请选择审核通过的商品', 'warning');
// return;
// }
// var data = function() {
// $.each(selectedArr, function(i, value) {
// sknList.push(value['productSkn']);
// });
// return {
// productSknList: JSON.stringify(sknList),
// };
// }
// BllPass.toast("确定要通过该申请吗?", data);
// });
// /*删除*/
// $(document).on("click", ".delete-class-btn", function() {
// var item = g.rows[$(this).data("index")];
// console.log(item);
// common.util.__ajax({
// url: '/product/deleteBaseProduct',
// data: {
// productSkn: item.productSkn,
// isAuditing: item.isAuditing
// }
// });
// });
... ...
... ... @@ -3,32 +3,22 @@ require('../util/jquery.gritter');
var grid=require('./grid'),
edit = require('./edit'),
edit2 = require('./edit2'),
dropDown = require('./dropDown'),
dialog=require('./dialog'),
tab=require('./tab'),
tab2=require('./tab2'),
tabTree=require('./tabTree'),
util=require('./util'),
components=require('./edit2'),
drag=require('./drag'),
drag2=require('./drag2'),
popImg=require('./popImg');
components=require('./edit2');
var common={
grid:grid,
dialog:dialog,
tab:tab,
tab2:tab2,
dropDown:dropDown,
edit:edit,
edit2:edit2,
util:util,
tabTree:tabTree,
drag:drag,
drag2:drag2,
popImg:popImg,
components:components
};
... ...
var $ = require('jquery');
var drag = function(el, array, callback) {
this.el = el;
this.dataArray = array;
this.callback = callback;
}
drag.prototype = {
constructor: drag,
minZindex: 1,
dragItemList: null,
dragItemPos: [],
Initialize: function(){
this.dragItemList = $(this.el).find(".dragItem");
if(this.dragItemList.length > 0){
var elHeight = $(this.el).height();
$(this.el).css("position","relative").css("height", elHeight + "px");
for(var i=0;i<this.dragItemList.length;i++){
var top = this.dragItemList[i].offsetTop;
var left = this.dragItemList[i].offsetLeft;
$(this.dragItemList[i]).css("top", top + "px").css("left", left + "px");
this.dragItemPos[i] = {left:left, top:top};
this.dragItemList[i].index = i;
}
for(var i=0; i<this.dragItemList.length; i++){
$(this.dragItemList[i]).css("position", "absolute").css("margin", 0).css("width","100%");
this.setDrag(this.dragItemList[i]);
}
}
},
setDrag: function(obj){
var _self = this;
obj.onmouseover = function(){
$(obj).css("cursor", "move");
$(obj).css("border-color","#9a9fa4");
$(obj).css("box-shadow","0 0 6px 0 rgba(0, 0, 0, 0.85)");
}
obj.onmouseout = function(){
$(obj).css("cursor", "default");
$(obj).css("border-color","none");
$(obj).css("box-shadow","none");
}
obj.onmousedown = function(event){
$(obj).css("z-index", _self.minZindex++);
var disX = event.clientX - obj.offsetLeft;
var disY = event.clientY - obj.offsetTop;
document.onmousemove = function(event){
var left = event.clientX - disX ;
var top = event.clientY - disY ;
$(obj).css("top", top + "px").css("left", left + "px");
for(var i=0;i<_self.dragItemList.length;i++){
$(_self.dragItemList[i]).css("border","0px");
}
var oNear = _self.findMin(obj);
if(oNear){
$(oNear).css("border","2px dashed red");
}
}
document.onmouseup = function(){
document.onmousemove = null;
document.onmouseup = null;
//检测是否普碰上,在交换位置
var oNear = _self.findMin(obj);
if(oNear){
$(oNear).css("border","0px").css("z-index", _self.minZindex++);
$(obj).css("z-index", _self.minZindex++);
//_self.move(oNear,_self.dragItemPos[obj.index]);
//_self.move(obj,_self.dragItemPos[oNear.index]);
//交换index
oNear.index += obj.index;
obj.index = oNear.index - obj.index;
oNear.index = oNear.index - obj.index;
//数组排序后返回
_self.getArry(_self.dragItemList);
}else{
_self.move(obj,_self.dragItemPos[obj.index]);
}
}
clearInterval(obj.timer);
return false;//低版本出现禁止符号
}
},
findMin: function(obj){
var minDis = 999999999;
var minIndex = -1;
for(var i=0;i<this.dragItemList.length;i++){
if(obj == this.dragItemList[i])continue;
if(this.coverCheck(obj,this.dragItemList[i])){
var dis = this.getDis(obj,this.dragItemList[i]);
if(dis < minDis){
minDis = dis;
minIndex = i;
}
}
}
if(minIndex == -1){
return null;
}else{
return this.dragItemList[minIndex];
}
},
coverCheck: function(obj1, obj2){
var t1 = obj1.offsetTop;
var r1 = obj1.offsetWidth + obj1.offsetLeft;
var b1 = obj1.offsetHeight + obj1.offsetTop;
var l1 = obj1.offsetLeft;
var t2 = obj2.offsetTop;
var r2 = obj2.offsetWidth + obj2.offsetLeft;
var b2 = obj2.offsetHeight + obj2.offsetTop;
var l2 = obj2.offsetLeft;
if(t1>b2 || r1<l2 || b1<t2 || l1>r2){
return false;
}else{
return true;
}
},
getDis: function(obj1,obj2){
var a = obj1.offsetLeft - obj2.offsetLeft;
var b = obj1.offsetTop - obj2.offsetTop;
return Math.sqrt(Math.pow(a,2)+Math.pow(b,2));
},
getArry: function(Array){
var sortArray = [];
for(var i=0; i<Array.length; i++){
for(var j=0; j<Array.length; j++){
if(Array[j].index == i){
sortArray.push(this.dataArray[j]);
break;
}
}
}
this.callback(sortArray);
},
move: function(obj,json){
clearInterval(obj.timer);
obj.timer = setInterval(function(){
var isStop = true;
for(var attr in json){
var iCur = 0;
if(attr=="opacity"){
iCur = parseInt(parseFloat(getStyle(obj,attr))*100);
}else{
iCur = parseInt(getStyle(obj,attr));
}
var ispeed = (json[attr]-iCur)/8;
ispeed = ispeed>0?Math.ceil(ispeed):Math.floor(ispeed);
if(iCur!=json[attr]){
isStop = false;
}
if(attr=="opacity"){
obj.style.filter = "alpha:(opacity:"+(json[attr]+ispeed)+")";
obj.style.opacity = (json[attr]+ispeed)/100;
}else{
obj.style[attr] = iCur+ispeed+"px";
}
}
if(isStop){
clearInterval(obj.timer);
}
},30);
function getStyle(obj,attr){
return obj.currentStyle?obj.currentStyle[attr]:getComputedStyle(obj,false)[attr];
}
},
destroy: function(){
this.dragItemList = $(this.el).find(".dragItem");
if(this.dragItemList.length > 0){
$(this.el).removeAttr("style");
for(var i=0; i<this.dragItemList.length; i++){
$(this.dragItemList[i]).removeAttr("style");
}
}
}
}
module.exports = drag;
\ No newline at end of file
var jQuery = require('jquery');
(function($) {
var dragging, placeholders = $();
$.fn.sortable = function(options) {
options = options || {};
return this.each(function() {
if (/^enable|disable|destroy$/.test(options)) {
var items = $(this).children($(this).data('items')).attr('draggable', options == 'enable');
options == 'destroy' && items.add(this)
.removeData('connectWith').removeData('items')
.unbind('dragstart.h5s dragend.h5s selectstart.h5s dragover.h5s dragenter.h5s drop.h5s');
return;
}
var _self = $(this);
_self.css("height",_self.height());
var index, items = $(this).children(options.items), connectWith = options.connectWith || false;
var dataArray = options.array;
var callBack = options.callback;
console.log(dataArray);
for(var i=0; i<items.length; i++){
$(items[i]).attr("drag-index", i);
items[i]._index = i;
}
var placeholder = $('<' + items[0].tagName + ' class="sortable-placeholder">');
placeholder.css("border","2px dashed red");
var handle = options.handle, isHandle;
items.find(handle).mousedown(function() {
isHandle = true;
}).mouseup(function() {
isHandle = false;
});
var isInput = false;
items.find("input").mousedown(function(){
isInput = true
}).mouseup(function() {
isInput = false;
});
$(this).data('items', options.items)
placeholders = placeholders.add(placeholder);
if (connectWith) {
$(connectWith).add(this).data('connectWith', connectWith);
}
items.attr('draggable', 'true').bind('dragstart.h5s', function(e) {
if(handle && !isHandle) {
return false;
}
if(isInput){
return false;
}
isHandle = false;
var dt = e.originalEvent.dataTransfer;
dt.effectAllowed = 'move';
dt.setData('Text', 'dummy');
dragging = $(this).addClass('sortable-dragging');
index = dragging.index();
}).bind('dragend.h5s', function() {
dragging.removeClass('sortable-dragging').fadeIn();
placeholders.detach();
if (index != dragging.index()) {
//拖拽返回排序后的数组
if(dataArray){
var Array = [], sortArray = [];
var itemsUpdate = _self.children(options.items);
for(var i=0; i<itemsUpdate.length; i++){
Array.push(itemsUpdate[i]._index);
}
for(var i=0; i<Array.length; i++){
sortArray.push(dataArray[Array[i]]);
}
if(callBack){
callBack(sortArray);
}
}
//拖拽回调函数
items.parent().trigger('sortupdate');
}
dragging = null;
}).not('a[href], img, input').bind('selectstart.h5s', function() {
this.dragDrop && this.dragDrop();
return false;
}).end().add([this, placeholder]).bind('dragover.h5s dragenter.h5s drop.h5s', function(e) {
if (!items.is(dragging) && connectWith !== $(dragging).parent().data('connectWith')) {
return true;
}
if (e.type == 'drop') {
e.stopPropagation();
placeholders.filter(':visible').after(dragging);
return false;
}
e.preventDefault();
e.originalEvent.dataTransfer.dropEffect = 'move';
if (items.is(this)) {
dragging.hide();
$(this)[placeholder.index() < $(this).index() ? 'after' : 'before'](placeholder);
placeholders.not(placeholder).detach();
}
return false;
});
});
};
})(jQuery);
/* jquery.poptrox.js v2.5.1 | (c) n33 | n33.co | MIT licensed */
var jQuery = require('jquery');
(function($) {
// Disables selection
$.fn.poptrox_disableSelection = function() { return $(this).css('user-select', 'none').css('-khtml-user-select', 'none').css('-moz-user-select', 'none').css('-o-user-select', 'none').css('-webkit-user-select', 'none'); }
// Poptrox prototype method
$.fn.poptrox = function(options) {
// Handle no elements.
if (this.length == 0)
return $(this);
// Handle multiple elements.
if (this.length > 1) {
for (var i=0; i < this.length; i++)
$(this[i]).poptrox(options);
return $(this);
}
// Settings
var settings = $.extend({
preload: false, // If true, preload fullsize images in the background
baseZIndex: 1000, // Base Z-Index
fadeSpeed: 300, // Global fade speed
overlayColor: '#000000', // Overlay color
overlayOpacity: 0.6, // Overlay opacity
overlayClass: 'poptrox-overlay', // Overlay class
windowMargin: 50, // Window margin size (in pixels; only comes into play when an image is larger than the viewport)
windowHeightPad: 0, // Window height pad
selector: '.pop', // Anchor tag selector
caption: null, // Caption settings (see docs)
parent: 'body', // Parent selector (ie. where all the popup/overlay stuff gets added).
popupSpeed: 300, // Popup (resize) speed
popupWidth: 200, // Popup width
popupHeight: 100, // Popup height
popupIsFixed: false, // If true, popup won't resize to fit images
useBodyOverflow: false, // If true, the BODY tag is set to overflow: hidden when the popup is visible
usePopupEasyClose: true, // If true, popup can be closed by clicking on it anywhere
usePopupForceClose: false, // If true, popup can be closed even while content is loading
usePopupLoader: true, // If true, show the popup loader
usePopupCloser: true, // If true, show the popup closer button/link
usePopupCaption: false, // If true, show the popup image caption
usePopupNav: false, // If true, show (and use) popup navigation
usePopupDefaultStyling: true, // If true, default popup styling will be applied (background color, text color, etc)
popupBackgroundColor: '#FFFFFF', // (Default Style) Popup background color (when usePopupStyling = true)
popupTextColor: '#000000', // (Default Style) Popup text color (when usePopupStyling = true)
popupLoaderTextSize: '2em', // (Default Style) Popup loader text size
popupCloserBackgroundColor: '#000000', // (Default Style) Popup closer background color (when usePopupStyling = true)
popupCloserTextColor: '#FFFFFF', // (Default Style) Popup closer text color (when usePopupStyling = true)
popupCloserTextSize: '20px', // (Default Style) Popup closer text size
popupPadding: 10, // (Default Style) Popup padding (when usePopupStyling = true)
popupCaptionHeight: 60, // (Default Style) Popup height of caption area
popupCaptionTextSize: null, // (Default Style) Popup caption text size
popupBlankCaptionText: '(untitled)', // Applied to images that don't have captions (when captions are enabled)
popupCloserText: '&#215;', // Popup closer text
popupLoaderText: '&bull;&bull;&bull;&bull;', // Popup loader text
popupClass: 'poptrox-popup', // Popup class
popupSelector: null, // (Advanced) Popup selector (use this if you want to replace the built-in popup)
popupLoaderSelector: '.loader', // (Advanced) Popup Loader selector
popupCloserSelector: '.closer', // (Advanced) Popup Closer selector
popupCaptionSelector: '.caption', // (Advanced) Popup Caption selector
popupNavPreviousSelector: '.nav-previous', // (Advanced) Popup Nav Previous selector
popupNavNextSelector: '.nav-next', // (Advanced) Popup Nav Next selector
onPopupClose: null, // Called when popup closes
onPopupOpen: null // Called when popup opens
}, options);
// Variables
var $this = $(this),
$body = $('body'),
$overlay = $('<div class="' + settings.overlayClass + '"></div>'),
$window = $(window);
var windowWidth,
windowHeight,
queue = [],
navPos = 0,
isLocked = false,
cache = new Array();
function updateWH() {
windowWidth = $(window).width();
windowHeight = $(window).height() + settings.windowHeightPad;
var dw = Math.abs($popup.width() - $popup.outerWidth()), dh = Math.abs($popup.height() - $popup.outerHeight());
var nw = $x.width(), nh = $x.height();
var maxw = windowWidth - (settings.windowMargin * 2) - dw, maxh = windowHeight - (settings.windowMargin * 2) - dh;
$popup
.css('min-width', settings.popupWidth)
.css('min-height', settings.popupHeight);
$pic.children()
.css('max-width', maxw)
.css('max-height', maxh);
}
// Disable unused features
if (!settings.usePopupLoader)
settings.popupLoaderSelector = null;
if (!settings.usePopupCloser)
settings.popupCloserSelector = null;
if (!settings.usePopupCaption)
settings.popupCaptionSelector = null;
if (!settings.usePopupNav) {
settings.popupNavPreviousSelector = null;
settings.popupNavNextSelector = null;
}
// Get popup
var $popup;
if (settings.popupSelector)
$popup = $(settings.popupSelector);
else
$popup = $('<div class="' + settings.popupClass + '">' + (settings.popupLoaderSelector ? '<div class="loader">' + settings.popupLoaderText + '</div>' : '') + '<div class="pic"></div>' + (settings.popupCaptionSelector ? '<div class="caption"></div>' : '') + (settings.popupCloserSelector ? '<span class="closer">' + settings.popupCloserText + '</span>' : '') + (settings.popupNavPreviousSelector ? '<div class="nav-previous"></div>' : '') + (settings.popupNavNextSelector ? '<div class="nav-next"></div>' : '') + '</div>');
// Get popup components
var $pic = $popup.find('.pic'),
$x = $(),
$loader = $popup.find(settings.popupLoaderSelector),
$caption = $popup.find(settings.popupCaptionSelector),
$closer = $popup.find(settings.popupCloserSelector),
$nav_next = $popup.find(settings.popupNavNextSelector),
$nav_previous = $popup.find(settings.popupNavPreviousSelector),
$nav = $nav_next.add($nav_previous);
// Apply default styling?
if (settings.usePopupDefaultStyling) {
$popup
.css('background', settings.popupBackgroundColor)
.css('color', settings.popupTextColor)
.css('padding', settings.popupPadding + 'px');
if ($caption.length > 0) {
$popup
.css('padding-bottom', settings.popupCaptionHeight + 'px');
$caption
.css('position', 'absolute')
.css('left', '0')
.css('bottom', '0')
.css('width', '100%')
.css('text-align', 'center')
.css('height', settings.popupCaptionHeight + 'px')
.css('line-height', settings.popupCaptionHeight + 'px');
if (settings.popupCaptionTextSize)
$caption.css('font-size', popupCaptionTextSize);
}
if ($closer.length > 0)
$closer
.html(settings.popupCloserText)
.css('font-size', settings.popupCloserTextSize)
.css('background', settings.popupCloserBackgroundColor)
.css('color', settings.popupCloserTextColor)
.css('display', 'block')
.css('width', '40px')
.css('height', '40px')
.css('line-height', '40px')
.css('text-align', 'center')
.css('position', 'absolute')
.css('text-decoration', 'none')
.css('outline', '0')
.css('top', '0')
.css('right', '-40px');
if ($loader.length > 0) {
$loader
.html('')
.css('position', 'relative')
.css('font-size', settings.popupLoaderTextSize)
.on('startSpinning', function(e) {
var x = $('<div>' + settings.popupLoaderText + '</div>');
x
.css('height', Math.floor(settings.popupHeight / 2) + 'px')
.css('overflow', 'hidden')
.css('line-height', Math.floor(settings.popupHeight / 2) + 'px')
.css('text-align', 'center')
.css('margin-top', Math.floor(($popup.height() - x.height() + ($caption.length > 0 ? $caption.height() : 0)) / 2))
.css('color', (settings.popupTextColor ? settings.popupTextColor : ''))
.on('xfin', function() { x.fadeTo(300, 0.5, function() { x.trigger('xfout'); }); })
.on('xfout', function() { x.fadeTo(300, 0.05, function() { x.trigger('xfin'); }); })
.trigger('xfin');
$loader.append(x);
})
.on('stopSpinning', function(e) {
var x = $loader.find('div');
x.remove();
});
}
if ($nav.length == 2) {
$nav
.css('font-size', '75px')
.css('text-align', 'center')
.css('color', '#fff')
.css('text-shadow', 'none')
.css('height', '100%')
.css('position', 'absolute')
.css('top', '0')
.css('opacity', '0.35')
.css('cursor', 'pointer')
.css('box-shadow', 'inset 0px 0px 10px 0px rgba(0,0,0,0)')
.poptrox_disableSelection();
var wn, wp;
if (settings.usePopupEasyClose) {
wn = '100px';
wp = '100px';
}
else {
wn = '75%';
wp = '25%';
}
$nav_next
.css('right', '0')
.css('width', wn)
.html('<div style="position: absolute; height: 100px; width: 125px; top: 50%; right: 0; margin-top: -50px;">&gt;</div>');
$nav_previous
.css('left', '0')
.css('width', wp)
.html('<div style="position: absolute; height: 100px; width: 125px; top: 50%; left: 0; margin-top: -50px;">&lt;</div>');
}
}
// Main
$window
.on('resize orientationchange', function() {
updateWH();
});
$caption
.on('update', function(e, s) {
if (!s || s.length == 0)
s = settings.popupBlankCaptionText;
$caption.html(s);
});
$closer
.css('cursor', 'pointer')
.on('click', function(e) {
e.preventDefault();
e.stopPropagation();
$popup.trigger('poptrox_close');
return true;
});
$nav_next
.on('click', function(e) {
e.stopPropagation();
e.preventDefault();
$popup.trigger('poptrox_next');
});
$nav_previous
.on('click', function(e) {
e.stopPropagation();
e.preventDefault();
$popup.trigger('poptrox_previous');
});
$overlay
.css('position', 'fixed')
.css('left', 0)
.css('top', 0)
.css('z-index', settings.baseZIndex)
.css('width', '100%')
.css('height', '100%')
.css('text-align', 'center')
.css('cursor', 'pointer')
.appendTo(settings.parent)
.prepend('<div style="display:inline-block;height:100%;vertical-align:middle;"></div>')
.append('<div style="position:absolute;left:0;top:0;width:100%;height:100%;background:' + settings.overlayColor + ';opacity:' + settings.overlayOpacity + ';filter:alpha(opacity=' + (settings.overlayOpacity * 100) + ');"></div>')
.hide()
.on('touchmove', function(e) {
return false;
})
.on('click', function(e) {
e.preventDefault();
e.stopPropagation();
$popup.trigger('poptrox_close');
});
$popup
.css('display', 'inline-block')
.css('vertical-align', 'middle')
.css('position', 'relative')
.css('z-index', 1)
.css('cursor', 'auto')
.appendTo($overlay)
.hide()
.on('poptrox_next', function() {
var x = navPos + 1;
if (x >= queue.length)
x = 0;
$popup.trigger('poptrox_switch', [x]);
})
.on('poptrox_previous', function() {
var x = navPos - 1;
if (x < 0)
x = queue.length - 1;
$popup.trigger('poptrox_switch', [x]);
})
.on('poptrox_reset', function() {
updateWH();
$popup
.data('width', settings.popupWidth)
.data('height', settings.popupHeight);
$loader.hide().trigger('stopSpinning');
$caption.hide();
$closer.hide();
$nav.hide();
$pic.hide();
$x
.attr('src', '')
.detach();
})
.on('poptrox_open', function(e, index) {
if (isLocked)
return true;
isLocked = true;
if (settings.useBodyOverflow)
$body.css('overflow', 'hidden');
if (settings.onPopupOpen)
(settings.onPopupOpen)();
$overlay
.fadeTo(settings.fadeSpeed, 1.0, function() {
$popup.trigger('poptrox_switch', [index, true]);
});
})
.on('poptrox_switch', function(e, index, ignoreLock) {
var x, img;
if (!ignoreLock && isLocked)
return true;
isLocked = true;
$popup
.css('width', $popup.data('width'))
.css('height', $popup.data('height'));
// Cleanup from previous
$caption.hide();
if ($x.attr('src'))
$x.attr('src', '');
$x.detach();
// Activate new object
x = queue[index];
$x = x.object;
$x.off('load');
$pic
.css('text-indent', '-9999px')
.show()
.append($x);
if (x.type == 'ajax')
$.get(x.src, function(data) {
$x.html(data);
$x.trigger('load');
});
else
$x.attr('src', x.src);
if (x.type != 'image') {
var xwidth, xheight;
xwidth = x.width;
xheight = x.height;
if (xwidth.slice(-1) == '%')
xwidth = (parseInt(xwidth.substring(0, xwidth.length - 1)) / 100.00) * $window.width();
if (xheight.slice(-1) == '%')
xheight = (parseInt(xheight.substring(0, xheight.length - 1)) / 100.00) * $window.height();
$x
.css('position', 'relative')
.css('outline', '0')
.css('z-index', settings.baseZIndex + 100)
.width(xwidth)
.height(xheight);
}
// Initialize
$loader.trigger('startSpinning').fadeIn(300);
$popup.show();
if (settings.popupIsFixed) {
$popup
.width(settings.popupWidth)
.height(settings.popupHeight);
$x.load(function() {
$x.off('load');
$loader.hide().trigger('stopSpinning');
$caption.trigger('update', [x.captionText]).fadeIn(settings.fadeSpeed);
$closer.fadeIn(settings.fadeSpeed);
$pic.css('text-indent', 0).hide().fadeIn(settings.fadeSpeed, function() { isLocked = false; });
navPos = index;
$nav.fadeIn(settings.fadeSpeed);
});
}
else {
$x.load(function() {
updateWH();
$x.off('load');
$loader.hide().trigger('stopSpinning');
var nw = $x.width(),
nh = $x.height(),
f = function() {
$caption.trigger('update', [x.captionText]).fadeIn(settings.fadeSpeed);
$closer.fadeIn(settings.fadeSpeed);
$pic.css('text-indent', 0).hide().fadeIn(settings.fadeSpeed, function() { isLocked = false; });
navPos = index;
$nav.fadeIn(settings.fadeSpeed);
$popup
.data('width', nw)
.data('height', nh)
.css('width', 'auto')
.css('height', 'auto');
};
if (nw == $popup.data('width')
&& nh == $popup.data('height'))
(f)();
else
$popup.animate({ width: nw, height: nh }, settings.popupSpeed, 'swing', f);
});
}
if (x.type != 'image')
$x.trigger('load');
})
.on('poptrox_close', function() {
if (isLocked
&& !settings.usePopupForceClose)
return true;
isLocked = true;
$popup
.hide()
.trigger('poptrox_reset');
if (settings.onPopupClose)
(settings.onPopupClose)();
$overlay
.fadeOut(settings.fadeSpeed, function() {
if (settings.useBodyOverflow)
$body.css('overflow', 'auto');
isLocked = false;
});
})
.trigger('poptrox_reset');
// Easy close.
if (settings.usePopupEasyClose) {
$caption.on('click', 'a', function(e) {
e.stopPropagation();
});
$popup
.css('cursor', 'pointer')
.on('click', function(e) {
e.stopPropagation();
e.preventDefault();
$popup.trigger('poptrox_close');
});
}
else
$popup
.on('click', function(e) {
e.stopPropagation();
});
$window
.keydown(function(e) {
if ($popup.is(':visible')) {
switch (e.keyCode) {
case 37:
case 32:
if (settings.usePopupNav) {
$popup.trigger('poptrox_previous');
return false;
}
break;
case 39:
if (settings.usePopupNav) {
$popup.trigger('poptrox_next');
return false;
}
break;
case 27:
$popup.trigger('poptrox_close');
return false;
break;
}
}
});
var sel_ = $this.find(settings.selector);
console.log(sel_);
$this.find(settings.selector).each(function(index) {
var x, tmp, a = $(this), i = a.find('img'), data = a.data('poptrox');
// Ignore? Skip.
if (data == 'ignore')
return;
// No href? Bail.
if (!a.attr('href'))
return;
x = {
src: a.attr('href'),
captionText: i.attr('title'),
width: null,
height: null,
type: null,
object: null,
options: null
};
// Determine caption.
// No caption setting? Use default (title attribute of image).
if (!settings.caption)
c = i.attr('title');
// Function?
else if (typeof(settings.caption) == 'function')
c = (settings.caption)(a);
// Selector?
else if ('selector' in settings.caption) {
var s;
s = a.find(settings.caption.selector);
if ('attribute' in settings.caption)
c = s.attr(settings.caption.attribute);
else {
c = s.html();
if (settings.caption.remove === true)
s.remove();
}
}
x.captionText = c;
// If a data attribute exists, use it
if (data) {
var b = data.split(',');
// Type.
if (0 in b)
x.type = b[0];
// Size.
if (1 in b) {
tmp = b[1].match(/([0-9%]+)x([0-9%]+)/);
if (tmp && tmp.length == 3) {
x.width = tmp[1];
x.height = tmp[2];
}
}
// Options.
if (2 in b)
x.options = b[2];
}
// No type? Attempt to guess it based on the href's domain
if (!x.type) {
tmp = x.src.match(/\/\/([a-z0-9\.]+)\/.*/);
if (!tmp || tmp.length < 2)
tmp = [false];
switch (tmp[1]) {
case 'api.soundcloud.com':
x.type = 'soundcloud';
break;
case 'youtu.be':
x.type = 'youtube';
break;
case 'vimeo.com':
x.type = 'vimeo';
break;
case 'wistia.net':
x.type = 'wistia';
break;
case 'bcove.me':
x.type = 'bcove';
break;
default:
x.type = 'image';
break;
}
}
// Create object (based on type)
tmp = x.src.match(/\/\/[a-z0-9\.]+\/(.*)/);
switch (x.type) {
case 'iframe':
x.object = $('<iframe src="" frameborder="0"></iframe>');
x.object
.on('click', function(e) { e.stopPropagation(); })
.css('cursor', 'auto');
if (!x.width || !x.height) {
x.width = "600";
x.height = "400";
}
break;
case 'ajax':
x.object = $('<div class="poptrox-ajax"></div>');
x.object
.on('click', function(e) { e.stopPropagation(); })
.css('cursor', 'auto')
.css('overflow', 'auto');
if (!x.width || !x.height) {
x.width = "600";
x.height = "400";
}
break;
case 'soundcloud':
x.object = $('<iframe scrolling="no" frameborder="no" src=""></iframe>');
x.src = '//w.soundcloud.com/player/?url=' + escape(x.src) + (x.options ? '&' + x.options : '');
x.width = '600';
x.height = "166";
break;
case 'youtube':
x.object = $('<iframe src="" frameborder="0" allowfullscreen="1"></iframe>');
x.src = '//www.youtube.com/embed/' + tmp[1] + (x.options ? '?' + x.options : '');
if (!x.width || !x.height) {
x.width = "800";
x.height = "480";
}
break;
case 'vimeo':
x.object = $('<iframe src="" frameborder="0" allowFullScreen="1"></iframe>');
x.src = '//player.vimeo.com/video/' + tmp[1] + (x.options ? '?' + x.options : '');
if (!x.width || !x.height) {
x.width = "800";
x.height = "480";
}
break;
case 'wistia':
x.object = $('<iframe src="" frameborder="0" allowFullScreen="1"></iframe>');
x.src = '//fast.wistia.net/' + tmp[1] + (x.options ? '?' + x.options : '');
if (!x.width || !x.height) {
x.width = "800";
x.height = "480";
}
break;
case 'bcove':
x.object = $('<iframe src="" frameborder="0" allowFullScreen="1" width="100%"></iframe>');
x.src = '//bcove.me/' + tmp[1] + (x.options ? '?' + x.options : '');
if (!x.width || !x.height) {
x.width = "640";
x.height = "360";
}
break;
default:
x.object = $('<img src="" alt="" style="vertical-align:bottom" />');
if (settings.preload) {
var tmp = document.createElement('img');
tmp.src = x.src; cache.push(tmp);
}
x.width = a.attr('width');
x.height = a.attr('height');
break;
}
// Fix src if protocol is 'file'.
if (window.location.protocol == 'file:'
&& x.src.match(/^\/\//))
x.src = 'http:' + x.src;
queue.push(x);
i.attr('title', '');
a
.attr('href', '')
.css('outline', 0)
.on('click', function(e) {
e.preventDefault();
e.stopPropagation();
$popup.trigger('poptrox_open', [index]);
});
});
return $(this);
};
})(jQuery);
\ No newline at end of file
var $ = require('jquery'),
util = require('./util');
var tab = function(options) {
var defaults = {
innerHtml: '<ul class="nav nav-pills"></ul>'
};
this.options = $.extend({}, defaults, options);
$(options.el).html(this.options.innerHtml);
this.tab = $("ul", options.el);
this.active = undefined; //undefined==void(0)
return this;
}
tab.prototype = {
constructor: tab,
init: function(data) {
var g = this,
p = this.options;
$(this.tab).html("");
var pattern = /tab=.*?(?=&&)/gi,
tab = pattern.exec(location.hash),
index = null;
if (tab instanceof Array) {
tab = tab[0];
index = tab.split('=')[1];
}
g.index = index;
g.active = index;
this.render(data);
p._init && p._init(g.active);
this.bind(p.click);
return this;
},
bind: function(callback) {
var g = this,
p = this.options;
$(p.el).off("click", "li");
$(p.el).on("click", "li", function() {
$(this).addClass('active').siblings().removeClass('active');
g.active = $(this).find("a").attr("columnname");
g.key = $(this).find("a").attr("key");
g.value = $(this).find("a").attr("value");
g.__index__ = $(this).index();
this._init = p._init;
callback && callback.call(this);
});
},
render: function(data) {
var g = this,
p = this.options;
var lis = [];
var hasActive = false;
$(p.columns).each(function(i, column) {
var li = $("<li></li>");
var a = $("<a href='javascript:void(0);'></a>");
if (g.index && i == g.index) {
li = $('<li class="active"></li>');
}else if(!g.index && column.active) {
li = $('<li class="active"></li>');
g.index = i;
g.active = i;
if (column.key) g.key = column.key;
if (column.value) g.value = column.value;
$.each(column, function(key,value) {
if(key != "index" && key != "active" && key != "name" && key != "display") {
g[key] = value;
}
});
hasActive = true;
}else if (!g.index && !hasActive && column.name == 'all') {
li = $('<li class="active"></li>');
}
if (column.name) a.attr({
columnname: column.name
});
$.each(column, function(key,value) {
if(key != "index" && key != "active" && key != "name" && key != "display") {
a.attr(key, value);
}
});
var h_t = column.display || "";
a.html(h_t);
li.append(a);
g.tab.append(li);
});
g.__tab = g.tab.html();
g.tab.html(util.__template(g.tab.html(), data || {}));
},
load: function(data) {
var g = this,
p = this.options;
g.tab.html(util.__template(g.__tab, data || {}));
if (g.__index__ != undefined) {
$('li',p.el).removeClass('active');
$('li',p.el).eq(g.__index__).addClass('active');
}
}
}
module.exports = tab;
\ No newline at end of file
... ... @@ -60,6 +60,54 @@ new common.dropDown({
hash: true
});
var editPostion = '',isInfoMiss,sortFlag;
var t = new common.tab2({
el: "#basicTab",
active:0,
click: function() {
var columnname=t.options.columns[t.options.active].name;
g.options.columns[11].hidden = true;
g.options.columns[8].hidden = true;
if (columnname == 3) {
isInfoMiss = 'Y';
g.options.columns[11].hidden = false;
} else {
isInfoMiss = 'N';
g.options.columns[8].hidden = false;
}
if (columnname == 1 || columnname == 2 || columnname == 3) {
sortFlag = 2;
} else {
sortFlag = 1;
}
g.init("/product/queryNetSaleInforList");
},
columns: [{
name: "0",
value: '8,3,2',
display: "上架前({1})"
}, {
name: "1",
value: '4,1,0,5,6',
display: "上架后({2})"
}, {
name: "2",
value: '1',
display: "搜索/标签({3})"
}, {
name: "3",
value: '1',
display: "上架后信息缺失({4})"
}, {
name: "all",
value: 'all',
display: "全部商品({all})"
}]
}).init(ENUM.tab);
var g = new common.grid({
el: "#basicTable",
parms: function() {
... ... @@ -68,7 +116,7 @@ var g = new common.grid({
productSkc: common.util.__input("productSkc"),
productSku: common.util.__input("productSku"),
productName: common.util.__input("productName"),
shopId: shopId,
shopId: common.util.__input("shopId"),
brandId: common.util.__input("brandId"),
isJit: common.util.__input("isJit"),
stock: common.util.__input("stock"),
... ... @@ -81,10 +129,10 @@ var g = new common.grid({
isOutLets: common.util.__input("isOutLets"),
productStatus: common.util.__input("productStatus"),
size: common.util.__input("size"),
productStatusStr: t.value,
productStatusStr: t.options.columns[t.options.active].value,
tab: $('#basicTab').find('.active').index(),
isInfoMiss: t.isInfoMiss,
sortFlag: t.sortFlag,
isInfoMiss: isInfoMiss,
sortFlag: sortFlag,
skcOnsaleStatus:common.util.__input("skcOnsaleStatus"),
isAdvance:common.util.__input("isAdvance")
};
... ... @@ -258,67 +306,9 @@ var g = new common.grid({
}
}]
});
g.init("/product/queryNetSaleInforList");
var editPostion = '',
shopId = common.util.__input("shopId");
var t = new common.tab({
el: "#basicTab",
_init: function(active) {
g.options.columns[11].hidden = true;
g.options.columns[8].hidden = true;
g.options.page = 1;
if (active == 3) {
g.options.columns[11].hidden = false;
} else if (active == 2) {
g.options.columns[8].hidden = false;
};
if (active == 1 || active == 2) {
editPostion = '#position9';
} else {
editPostion = '';
}
},
click: function() {
this._init(t.active);
if (t.active == 3) {
t.isInfoMiss = 'Y';
} else {
t.isInfoMiss = 'N';
}
if (t.active == 1 || t.active == 2 || t.active == 3) {
t.sortFlag = 2;
} else {
t.sortFlag = 1;
}
g.init($("#gridurl").val());
},
columns: [{
name: "0",
value: '8,3,2',
display: "上架前({1})"
}, {
name: "1",
value: '4,1,0,5,6',
display: "上架后({2})"
}, {
name: "2",
value: '1',
display: "搜索/标签({3})"
}, {
name: "3",
value: '1',
display: "上架后信息缺失({4})"
}, {
name: "all",
value: 'all',
display: "全部商品({all})"
}]
}).init(ENUM.tab);
//tab
var loadtab = function() {
t.active = undefined;
... ... @@ -328,7 +318,8 @@ var loadtab = function() {
data: g.options.parms()
}, function(res) {
var __dt = $.extend({}, ENUM.tab, res.data);
t.init(__dt);
t.setData(__dt);
t.render(__dt);
}, true);
}, 400);
}
... ...
... ... @@ -4262,6 +4262,7 @@ ul.tagit.inverse li.tagit-choice .tagit-close:focus .ui-icon-close:before,ul.tag
right:0;
bottom:0
}
.login-cover-image img {
max-width:100%;
top:0;
... ...