accountManage.js 1.4 KB
define(function( require, exports, module ) {
/*
	引入包
*/

require( 'fancybox' );
require( 'validate' );
require( 'validate.extend' );

$(function(){
	
	//显示选择图片弹框
	$( ".upload-btn" ).fancybox({
		padding: 0
	});
	
	//选择图片
	$( ".li-img" ).live({
		click: function(){
			$( ".li-img" ).removeClass("on");
			$(this).addClass("on");
		},
		dblclick: function(){
			var img = $(this).find( "img" ).attr("src");
			console.log(img)
			$( ".li-img" ).removeClass("on");
			$(this).addClass("on");
			
			$(".file-img").attr( "src", img );
			$( ".upload-area" ).css({
				background: 'none'
			});
			
			$.fancybox.close();
		}
	});
	$( ".s-f-confirm" ).click(function(){
		var img = $(this).parent().parent().find( ".on img" ).attr("src");
		$(".file-img").attr( "src", img );
		$( ".upload-area" ).css({
			background: 'none'
		});
		$.fancybox.close();
	});

	jQuery.validator.addClassRules({
         trytry: {
    required: true,
    minlength: 2
  },
  zip: {
    required: true,
    digits: true,
    minlength: 5,
    maxlength: 5
  }
	});

    jQuery.validator.addMethod("product-max", function (value, element, param) {
        return this.optional( element ) || parseInt( value ) <= parseInt( param );
    }, "不能超过商品总金额");

    require.async( ['validate.extend'], function(){

        $(".k-validate").validate({

        });

    } );


});

});