MxWeiXinPF.Web/templatesstore/js/avatar.js

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/* 
*作者:一些事情
*时间:2012-10-28
*需要结合jquery.Jcrop一起使用
----------------------------------------------------------*/
var jcrop_api, boundx, boundy;
//提交裁剪
function CropSubmit(webpath) {
	$("#upload_form").ajaxSubmit({
		success: function(data, textStatus) {
			if (data.status == 1){
				$.dialog.tips("头像上传成功!", 2, "32X32/succ.png", function(){
				    location.reload();
				});
			} else {
                $.dialog.alert(data.msg);
			}
		},
		error: function (XMLHttpRequest, textStatus, errorThrown) {
		    $.dialog.alert("状态:" + textStatus + ";出错提示:" + errorThrown);
		},
		url: webpath + "tools/submit_ajax.ashx?action=user_avatar_crop",
		type: "post",
		dataType: "json",
		timeout: 200000
	});
	return false;
}

//上传头像
function Upload(webpath) {
    //开始提交
    $("#upload_form").ajaxSubmit({
        beforeSubmit: function (formData, jqForm, options) {
            //隐藏上传按钮
            $(".avatar_upload .files").eq(0).hide();
            //显示LOADING图片
            $(".avatar_upload .uploading").eq(0).show();
        },
        success: function (data, textStatus) {
            if (data.status == 1) {
                //初始化
                InitJcrop();
                jcrop_api.setImage(data.path, function () {
                    $('#hideFileName').val(data.path);
                    $('#preview').attr('src', data.path);
                    var bounds = jcrop_api.getBounds();
                    boundx = bounds[0];
                    boundy = bounds[1];
                    jcrop_api.setSelect([0, 0, 180, 180]);
                });
            } else {
                $.dialog.alert(data.msg);
            }
            $(".avatar_upload .files").eq(0).show();
            $(".avatar_upload .uploading").eq(0).hide();
        },
        error: function (data, status, e) {
            $.dialog.alert("上传失败,错误信息:" + e);
            $(".avatar_upload .files").eq(0).show();
后面还有 40 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。