info.js
1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/**
* founder : zzf
* Creation time : 2015/2/28
* note :
* role :
*/
define(function( require, exports, module ) {
var Alert = require('alert');
var Validate = require('validate');
var Tools = require('tools');
window.URL = window.URL || window.webkitURL;
var methods = {
setimg : function(file, fun){
var files = file.files,
img = new Image();
img.src = window.URL.createObjectURL(files[0]); //创建一个object URL,并不是你的本地路径
img.onload = function(e) {
window.URL.revokeObjectURL(this.src); //图片加载后,释放object URL
fun(img);
}
}
};
//修改头像
$(".user-info input").change(function(){
var view = $(this);
methods.setimg(this, function(img){
view.parent().find("img").remove();
img.width = 28;
img.height = 28;
view.nextAll("h3").after(img);
});
});
//修改姓名
$(".user-name-save").click(function(){
new Validate({view : "#user-name", alerts : Alert}, function(){
Alert.show("验证成功");
});
return false;
});
//修改电话
$(".user-phone-save").click(function(){
new Validate({view : "#user-phone", alerts : Alert}, function(){
Alert.show("验证成功");
});
return false;
});
$(".user-phone-reg").click(function(){
new Tools.securitycode(this);
return false;
});
//认证
$(".user-upload-save").click(function(){
new Validate({view : "#user-upload", alerts : Alert}, function(){
Alert.show("验证成功");
});
return false;
});
$(".images input").change(function(){
var showview = $(this).prevAll(".img");
methods.setimg(this, function(img){
showview.append(img);
});
});
});