Browse Source

企业上传文件

luyanan 7 years ago
parent
commit
0522831ba6
1 changed files with 16 additions and 1 deletions
  1. 16 1
      cmp-portal/js/cmp-setAuth-imgup.js

+ 16 - 1
cmp-portal/js/cmp-setAuth-imgup.js

@ -1,12 +1,27 @@
1 1
/*企业认证上传*/
2
function aa(name,names){
3
	var index=name.lastIndexOf(".");
4
	var hou;
5
	if(index>0) {
6
		 hou=name.substring(index+1).toUpperCase();
7
		 for(var i in names) {
8
		 	if(hou==names[i]) {
9
		 		return true;
10
		 	}
11
		 }
12
	}
13
	return false;
14
}
15

2 16
function uploadFun(_this, num) {
17
	
3 18
	var fileval = $(_this).val();
4 19
	var reg = /[^\\\/]*[\\\/]+/g;     
5 20
	var name = fileval.replace(reg, '');      
6 21
	var postfix = /\.[^\.]+/.exec(name);      
7 22
	var filename = name.substr(0, postfix['index']);
8 23
	console.log(postfix[0]);
9
	if(postfix[0] == ".jpg" || postfix[0] == ".JPG" || postfix[0] == ".jpeg" || postfix[0] == ".JPEG" || postfix[0] == ".png" || postfix[0] == ".PNG" ) {
24
	if(aa(name,['PNG','JPG','JPEG'])) {
10 25
		if(fileval != "") {
11 26
			$(_this).parents(".upFront").addClass("displayNone");
12 27
			$(_this).parents(".uploadlogo").find(".upBack").removeClass("displayNone");