Explorar el Código

修改科研资源图片上传,和科研资源列表图片显示问题.

xuchunyang %!s(int64=8) %!d(string=hace) años
padre
commit
17ec698120

+ 170 - 163
src/main/webapp/js/ajaxfileupload.js

@ -1,211 +1,208 @@
1
// JavaScript Document
1 2
jQuery.extend({
2
    createUploadIframe: function(id, uri)
3
	{
4
		//create frame
5
		var frameId = 'jUploadFrame' + id;
6
		var iframeHtml = '<iframe id="' + frameId + '" name="' + frameId + '" style="position:absolute; top:-9999px; left:-9999px"';
7
		if(window.ActiveXObject)
8
		{
9
			if(typeof uri== 'boolean'){
10
				iframeHtml += ' src="' + 'javascript:false' + '"';
11 3

12
			}
13
			else if(typeof uri== 'string'){
14
				iframeHtml += ' src="' + uri + '"';
4
    createUploadIframe: function(id, uri)
5
 {
6
   //create frame
7
            var frameId = 'jUploadFrame' + id;
8
            
9
            if(window.ActiveXObject) {
10
                //var io = document.createElement('<iframe id="' + frameId + '" name="' + frameId + '" />');
11
            	if(jQuery.browser.version=="9.0" || jQuery.browser.version=="10.0"){  
12
                    var io = document.createElement('iframe');  
13
                    io.id = frameId;  
14
                    io.name = frameId;  
15
                }else if(jQuery.browser.version=="6.0" || jQuery.browser.version=="7.0" || jQuery.browser.version=="8.0"){  
16
                    var io = document.createElement('<iframe id="' + frameId + '" name="' + frameId + '" />');  
17
	                if(typeof uri== 'boolean'){
18
	                    io.src = 'javascript:false';
19
	                }
20
	                else if(typeof uri== 'string'){
21
	                    io.src = uri;
22
	                }
23
                }
24
            }else {
25
                var io = document.createElement('iframe');
26
                io.id = frameId;
27
                io.name = frameId;
28
            }
29
            io.style.position = 'absolute';
30
            io.style.top = '-1000px';
31
            io.style.left = '-1000px';
15 32

16
			}	
17
		}
18
		iframeHtml += ' />';
19
		jQuery(iframeHtml).appendTo(document.body);
33
            document.body.appendChild(io);
20 34

21
		return jQuery('#' + frameId).get(0);			
35
            return io;   
22 36
    },
23
    createUploadForm: function(id,fileElementId,data,fileElement)
24
	{
25
		//create form	
26
		var formId = 'jUploadForm' + id;
27
		var fileId = 'jUploadFile' + id;
28
		var form = jQuery('<form  action="" method="POST" name="' + formId + '" id="' + formId + '" enctype="multipart/form-data"></form>');	
29
		if(data)
30
		{
31
			for(var i in data)
32
			{
33
				jQuery('<input type="hidden" name="' + i + '" value="' + data[i] + '" />').appendTo(form);
34
			}			
35
		}
36
		var oldElement;
37
		if(fileElement == null)
38
			oldElement = jQuery('#' + fileElementId);
39
		else
40
			oldElement = fileElement;
41
		
42
		var newElement = jQuery(oldElement).clone();
43
		jQuery(oldElement).attr('id', fileId);
44
		jQuery(oldElement).before(newElement);
45
		jQuery(oldElement).appendTo(form);
46
		
47
		//set attributes
48
		jQuery(form).css('position', 'absolute');
49
		jQuery(form).css('top', '-1200px');
50
		jQuery(form).css('left', '-1200px');
51
		jQuery(form).appendTo('body');		
52
		return form;
37
    createUploadForm: function(id, fileElementId, data)
38
 {
39
  //create form 
40
  var formId = 'jUploadForm' + id;
41
  var fileId = 'jUploadFile' + id;
42
  var form = jQuery('<form  action="" method="POST" name="' + formId + '" id="' + formId + '" enctype="multipart/form-data"></form>'); 
43
  var oldElement = jQuery('#' + fileElementId);
44
  var newElement = jQuery(oldElement).clone();
45
  jQuery(oldElement).attr('id', fileId);
46
  jQuery(oldElement).before(newElement);
47
  jQuery(oldElement).appendTo(form);
48
  
49
  //add data
50
  if(data) { 
51
    for (var i in data) { 
52
        $('<input type="hidden" name="' + i + '" value="' + data[i] + '" />').appendTo(form); 
53
    } 
54
  }
55
  //set attributes
56
  jQuery(form).css('position', 'absolute');
57
  jQuery(form).css('top', '-1200px');
58
  jQuery(form).css('left', '-1200px');
59
  jQuery(form).appendTo('body');  
60
  return form;
53 61
    },
54 62

55 63
    ajaxFileUpload: function(s) {
56
        // TODO introduce global settings, allowing the client to modify them for all requests, not only timeout		
64
        // TODO introduce global settings, allowing the client to modify them for all requests, not only timeout  
57 65
        s = jQuery.extend({}, jQuery.ajaxSettings, s);
58
        var id = new Date().getTime()        
59
		var form = jQuery.createUploadForm(id, s.fileElementId, (typeof(s.data)=='undefined'?false:s.data),s.fileElement);
66
        var id = s.id;        
67
        //var id = s.fileElementId;        
68
		var form = jQuery.createUploadForm(id, s.fileElementId,s.data);
60 69
		var io = jQuery.createUploadIframe(id, s.secureuri);
61 70
		var frameId = 'jUploadFrame' + id;
62
		var formId = 'jUploadForm' + id;		
63
        // Watch for a new set of requests
64
        if ( s.global && ! jQuery.active++ )
65
		{
71
		var formId = 'jUploadForm' + id;  
72
        
73
		if( s.global && ! jQuery.active++ ){
74
			// Watch for a new set of requests
66 75
			jQuery.event.trigger( "ajaxStart" );
67 76
		}            
68 77
        var requestDone = false;
69 78
        // Create the request object
70
        var xml = {}   
71
        if ( s.global )
72
            jQuery.event.trigger("ajaxSend", [xml, s]);
73
        // Wait for a response to come back
74
        var uploadCallback = function(isTimeout)
75
		{			
79
        var xml = {};   
80
        if( s.global ){
81
         jQuery.event.trigger("ajaxSend", [xml, s]);
82
        }            
83
        
84
        var uploadCallback = function(isTimeout){  
85
			// Wait for a response to come back 
76 86
			var io = document.getElementById(frameId);
77
            try 
78
			{				
79
				if(io.contentWindow)
80
				{
81
					 xml.responseText = io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;
82
                	 xml.responseXML = io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;
83
					 
84
				}else if(io.contentDocument)
85
				{
86
					 xml.responseText = io.contentDocument.document.body?io.contentDocument.document.body.innerHTML:null;
87
                	xml.responseXML = io.contentDocument.document.XMLDocument?io.contentDocument.document.XMLDocument:io.contentDocument.document;
88
				}						
89
            }catch(e)
90
			{
87
			try{    
88
				if(io.contentWindow){
89
					xml.responseText = io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;
90
					xml.responseXML = io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;
91
			    }else if(io.contentDocument){
92
			    	xml.responseText = io.contentDocument.document.body?io.contentDocument.document.body.innerHTML:null;
93
			    	xml.responseXML = io.contentDocument.document.XMLDocument?io.contentDocument.document.XMLDocument:io.contentDocument.document;
94
			    }      
95
			}catch(e){
91 96
				jQuery.handleError(s, xml, null, e);
92 97
			}
93
            if ( xml || isTimeout == "timeout") 
94
			{				
98
            if( xml || isTimeout == "timeout"){    
95 99
                requestDone = true;
96 100
                var status;
97 101
                try {
98 102
                    status = isTimeout != "timeout" ? "success" : "error";
99 103
                    // Make sure that the request was successful or notmodified
100
                    if ( status != "error" )
101
					{
104
                    if( status != "error" ){
102 105
                        // process the data (runs the xml through httpData regardless of callback)
103
                        var data = jQuery.uploadHttpData( xml, s.dataType );    
104
                        // If a local callback was specified, fire it and pass it the data
105
                        if ( s.success )
106
                            s.success( data, status );
107
    
108
                        // Fire the global callback
109
                        if( s.global )
110
                            jQuery.event.trigger( "ajaxSuccess", [xml, s] );
111
                    } else
112
                        jQuery.handleError(s, xml, status);
113
                } catch(e) 
114
				{
106
                        var data = jQuery.uploadHttpData( xml, s.dataType );                        
107
                        if( s.success ){
108
                        	// ifa local callback was specified, fire it and pass it the data
109
                    		s.success( data, status );
110
                        };                 
111
                        if( s.global ){
112
                        	// Fire the global callback
113
                        	jQuery.event.trigger( "ajaxSuccess", [xml, s] );
114
                        };                            
115
                    } else{
116
                     jQuery.handleError(s, xml, status);
117
                    }
118
                        
119
                } catch(e){
115 120
                    status = "error";
116 121
                    jQuery.handleError(s, xml, status, e);
117
                }
118

119
                // The request was completed
120
                if( s.global )
121
                    jQuery.event.trigger( "ajaxComplete", [xml, s] );
122
                };                
123
                if( s.global ){
124
                	// The request was completed
125
            		jQuery.event.trigger( "ajaxComplete", [xml, s] );
126
                };
122 127

123 128
                // Handle the global AJAX counter
124
                if ( s.global && ! --jQuery.active )
125
                    jQuery.event.trigger( "ajaxStop" );
126

127
                // Process result
128
                if ( s.complete )
129
                    s.complete(xml, status);
130

131
                jQuery(io).unbind()
132

133
                setTimeout(function()
134
									{	try 
135
										{
136
											jQuery(io).remove();
137
											jQuery(form).remove();	
138
											
139
										} catch(e) 
140
										{
141
											jQuery.handleError(s, xml, null, e);
142
										}									
143

144
									}, 100)
145

146
                xml = null
147

148
            }
129
                if(s.global && ! --jQuery.active){
130
                 jQuery.event.trigger("ajaxStop");
131
                };
132
                if(s.complete){
133
                  s.complete(xml, status);
134
                };                 
135

136
                jQuery(io).unbind();
137
                setTimeout(function(){
138
                try{
139
					jQuery(io).remove();
140
					jQuery(form).remove(); 
141
                }catch(e){
142
		    	  	jQuery.handleError(s, xml, null, e);
143
            	}}, 100);
144
                xml = null;
145
            };
149 146
        }
150 147
        // Timeout checker
151
        if ( s.timeout > 0 ) 
152
		{
153
            setTimeout(function(){
154
                // Check to see if the request is still happening
155
                if( !requestDone ) uploadCallback( "timeout" );
156
            }, s.timeout);
148
        if( s.timeout > 0 ){
149
            setTimeout(function(){if(!requestDone ){uploadCallback( "timeout" );}}, s.timeout);
157 150
        }
158
        try 
159
		{
160

151
        try{
161 152
			var form = jQuery('#' + formId);
162 153
			jQuery(form).attr('action', s.url);
163 154
			jQuery(form).attr('method', 'POST');
164 155
			jQuery(form).attr('target', frameId);
165
            if(form.encoding)
166
			{
167
				jQuery(form).attr('encoding', 'multipart/form-data');      			
168
            }
169
            else
170
			{	
171
				jQuery(form).attr('enctype', 'multipart/form-data');			
172
            }			
156
            if(form.encoding){
157
                form.encoding = 'multipart/form-data';    
158
            }else{    
159
                form.enctype = 'multipart/form-data';
160
            }   
173 161
            jQuery(form).submit();
174 162

175
        } catch(e) 
176
		{			
163
        } catch(e){   
177 164
            jQuery.handleError(s, xml, null, e);
178 165
        }
179
		
180
		jQuery('#' + frameId).load(uploadCallback);
181
        return {abort: function(){
182
			try
183
			{
184
				jQuery('#' + frameId).remove();
185
				jQuery(form).remove();
186
			}
187
			catch(e){}
188
		}};
166
        /*if(window.attachEvent){
167
            document.getElementById(frameId).attachEvent('onload', uploadCallback);
168
        }
169
        else{
170
            document.getElementById(frameId).addEventListener('load', uploadCallback, false);
171
        }   */
172
        jQuery('#' + frameId).load(uploadCallback);
173
        return {abort: function () {}}; 
174

189 175
    },
190 176

191 177
    uploadHttpData: function( r, type ) {
192 178
        var data = !type;
193 179
        data = type == "xml" || data ? r.responseXML : r.responseText;
194
		
195
        // If the type is "script", eval it in global context
196
        if ( type == "script" )
197
            jQuery.globalEval( data );
198
        // Get the JavaScript object, if JSON is used.
199
        if ( type == "json" )
200
            data = jQuery.parseJSON(jQuery(data).text());
180
        // ifthe type is "script", eval it in global context
181
        if( type == "script" ){
182
         jQuery.globalEval( data );
183
        }
184
            
185
        // Get the JavaScript object, ifJSON is used.
186
        if( type == "json" ){
187
        	data = r.responseText;  
188
            var start = data.indexOf(">");  
189
            if(start != -1) {  
190
              var end = data.indexOf("<", start + 1);  
191
              if(end != -1) {  
192
                data = data.substring(start + 1, end);  
193
               }  
194
            }  
195
            eval( "data = " + data);  
196
        }
197
            
201 198
        // evaluate scripts within html
202
        if ( type == "html" )
203
            jQuery("<div>").html(data).evalScripts();
204

199
        if( type == "html" ){
200
         jQuery("<div>").html(data).evalScripts();
201
        }
202
            
205 203
        return data;
206 204
    },
207
	
208
	handleError: function( s, xml, status, e ) {
205
    /*handleError: function( s, xml, status, e ) {
209 206
		// If a local callback was specified, fire it
210 207
		if ( s.error )
211 208
			s.error( xml, status, e );
@ -213,5 +210,15 @@ jQuery.extend({
213 210
		// Fire the global callback
214 211
		if ( s.global )
215 212
			jQuery.event.trigger( "ajaxError", [xml, s, e] );
216
	}
217
});
213
	}*/
214
    handleError: function( s, xhr, status, e ) {
215
        // If a local callback was specified, fire it
216
        if ( s.error ) {
217
            s.error.call( s.context || s, xhr, status, e );
218
        }
219
        // Fire the global callback
220
        if ( s.global ) {
221
        	(s.context ? jQuery(s.context) : jQuery.event).trigger("ajaxError", [xhr, s, e] );
222
        }
223
    }
224
});

+ 97 - 14
src/main/webapp/js/popup.js

@ -33,9 +33,12 @@ function ResourceInfo() {
33 33
		//图像
34 34
		PopHtml +='<div class="resouimgbox resouimgboxadd floatL">';
35 35
		PopHtml += '<div class="resouinforcon">';
36
		PopHtml += '<div class="resouimg" >';
37
		PopHtml += '<span class="resouup"><input type="file" name="file" id="resouup" >上传资源图片</span>';
38
		PopHtml += '<div class="resouimgshow"><img width="100%" height="100%" src="" class="resouImage" /></div></div>';
36
		//PopHtml += '<div class="resouimg" >';
37
		//PopHtml += '<span class="resouup"><input type="file" name="file" id="resouup" >上传资源图片</span>';
38
		//PopHtml += '<div class="resouimgshow"><img width="100%" height="100%" src="" class="resouImage" /></div></div>';
39
		PopHtml += '<div id="uploader">';
40
		PopHtml += '<div id="fileList" class="uploader-list"></div>';
41
		PopHtml += '<div id="filePicker">选择图片</div></div>';
39 42
		PopHtml += '<span class="resouimgmsg">尺寸240*240,大小在5M以内,<br/>JPG、PNG格式</span>';
40 43
		PopHtml += '</div></div>';
41 44
		/////////////资源图片上传 结束////////////////////
@ -140,7 +143,7 @@ function ResourceInfo() {
140 143
			supportedServices();
141 144
		});
142 145
	   //资源图像上传
143
		$(function (){
146
		/*$(function (){
144 147
			var id = $.cookie('');
145 148
			cacheImageKey=null;
146 149
			if(id){
@ -168,7 +171,87 @@ function ResourceInfo() {
168 171
				});
169 172
				
170 173
			}
171
		})	
174
		})	*/
175
		
176
		// 初始化Web Uploader
177
		var uploader = WebUploader.create({
178
			// 选完文件后,是否自动上传。
179
		    auto: true,
180
		    // 添加的文件数量
181
		    fileNumLimit: 1,
182
		    // swf文件路径
183
		    swf: '../js/webuploader/Uploader.swf',
184
		    // 文件接收服务端。
185
		    server: '../ajax/cachedFileUpload',
186
		    // 选择文件的按钮。可选。
187
		    // 内部根据当前运行是创建,可能是input元素,也可能是flash.
188
	
189
		    pick : {
190
		    	id : "#filePicker",
191
		    	multiple: false
192
		    	},
193
		    // 只允许选择图片文件。
194
		    accept: {
195
		        title: 'Images',
196
		        extensions: 'gif,jpg,jpeg,bmp,png',
197
		        mimeTypes: 'image/*'
198
		    }
199
		   
200
		});
201
	
202
		// 当有文件添加进来的时候
203
		uploader.on( 'fileQueued', function( file ) {
204
		    var $li = $(
205
		            '<div id="' + file.id + '" class="file-item thumbnail">' +
206
		                '<img>' +
207
		            '</div>'
208
		            )
209
		            
210
		        $img = $li.find('img');
211

212
		    // $list为容器jQuery实例
213
		    var $list = $('#fileList');
214
		    $list.append( $li );
215

216
		    // 创建缩略图
217
		    // 如果为非图片文件,可以不用调用此方法。
218
		    // thumbnailWidth x thumbnailHeight 为 100 x 100
219
		    uploader.makeThumb( file, function( error, src ) {
220
		        if ( error ) {
221
		            $img.replaceWith('<span>不能预览</span>');
222
		            return;
223
		        }
224
		        $img.attr( 'src', src );
225
		    }, 240, 240 );
226
		});
227
		
228
    	// 文件上传过程中创建进度条实时显示。
229
		uploader.on( 'uploadProgress', function( file, percentage ) {
230
		    var $li = $( '#'+file.id ),
231
		        $percent = $li.find('.progress span');
232

233
		    // 避免重复创建
234
		    if ( !$percent.length ) {
235
		        $percent = $('<p class="progress"><span></span></p>')
236
		                .appendTo( $li )
237
		                .find('span');
238
		    }
239

240
		   $percent.css( 'width', percentage * 100 + '%' );
241
		});		
242
		// 文件上传成功,给item添加成功class, 用样式标记上传成功。
243
		cacheImageKey=null;
244
		uploader.on( 'uploadSuccess', function(file,data) {
245
			cacheImageKey =data.data[0].cacheKey;
246
			console.log(cacheImageKey);
247
		   // $( '#'+file.id ).addClass('upload-state-done');
248
			$("#filePicker").hide();
249
		});
250

251
		
252
		
253
		
254
		
172 255
}
173 256
//资源信息 //
174 257
//资源详细页面
@ -185,13 +268,13 @@ function ResourceMessage() {
185 268
	PopHtml += '</tr>';		
186 269
	PopHtml += '<tr class="workmsgbox"><th></th><td><div class="resouinforcon"><div class="workmsg workmsg1"></div></div></td></tr>  ';
187 270
	PopHtml += '<tr class="respublisher"><th class="resouinfotype"  scope="row">资源发布者</th><td><div class="resouinforcon" id="professor" ></div></td></tr>';
271
	PopHtml += '<tr><th class="resouinfotype"  scope="row">可提供服务</th><td><div class="resouinforcon"><span  id="supportedServices"></span></div></td></tr>';
188 272
	PopHtml += '<tr class="workmsgbox"><th></th><td><div class="resouinforcon"><div class="workmsg workmsg3"></div></div></td></tr>  ';
189 273
	PopHtml += '<tr><th class="resouinfotype"  scope="row">学术领域</th><td><div class="resouinforcon"><span   id="subject"></span></div></td></tr>';
190 274
	PopHtml += '<tr><th class="resouinfotype"  scope="row">应用行业</th><td><div class="resouinforcon"><span id="industry"></span></div></td></tr>'; 
191 275
	PopHtml += '<tr><th class="resouinfotype"  scope="row">期望付款方式</th><td><div class="resouinforcon"><span id="hopePayMethod"></span></div></td></tr>';
192
	PopHtml += '<tr class="limitBox"><th class="resouinfotype"  scope="row">可提供服务</th><td class="limitwordbox"><div class="resouinforcon limitwords"><span  id="supportedServices"></span></div></td></tr>';
193
	PopHtml += '<tr class="limitBox"><th class="resouinfotype"  scope="row">详细描述</th><td class="limitwordbox" ><div class="resouinforcon limitwords"><span  id="descp"></span></div></td></tr>';
194
	PopHtml += '<tr class="limitBox"><th class="resouinfotype" scope="row">合作备注</th><td class="limitwordbox"><div class="resouinforcon limitwords"><span  id="cooperationNotes"></span></div></td></tr>';		
276
	PopHtml += '<tr><th class="resouinfotype"  scope="row">详细描述</th><td ><div class="resouinforcon"><span  id="descp"></span></div></td></tr>';
277
	PopHtml += '<tr><th class="resouinfotype" scope="row">合作备注</th><td><div class="resouinforcon"><span  id="cooperationNotes"></span></div></td></tr>';		
195 278
	PopHtml +='</table>';
196 279
	
197 280
	/////////////资源图片上传////////////////////
@ -199,7 +282,7 @@ function ResourceMessage() {
199 282
	PopHtml +='<div class="resouimgbox floatL">';
200 283
	PopHtml += '<div class="resouinforcon">';
201 284
	PopHtml += '<div class="resouimg" >';
202
	PopHtml += '<div class="resouimgshow"><img width="100%" height="85%" src="" class="resouImage" /></div></div>';
285
	PopHtml += '<div class="resouimgshow"><img width="100%" height="100%" src="" class="resouImage" /></div></div>';
203 286
	PopHtml += '</div></div>';
204 287
	PopHtml += '</div></form>';
205 288
	//关闭按钮
@ -686,7 +769,7 @@ function ConsultApply() {
686 769
		PopHtml += '<form class="resoufrm"><ul class="sendmsgcon">';
687 770
		PopHtml += '<li><span>*</span><label>主题</label><input type="text" id="consultTitle" class="frmtype"></li>';
688 771
		PopHtml += '<li><span>*</span><label>内容</label><textarea class="frmtype" id="consultContent"></textarea></li>';
689
		PopHtml += '<li class="rightline">请不要超过<span id="textCount">500</span>个字</li>';
772
		PopHtml += '<li class="rightline">请不要超过500个字</li>';
690 773
		PopHtml += '<li class="rightline"><input type="button" id="sendConsultBtn"class="frmtype frmbtn" value="发送"></li>';
691 774
		PopHtml += '</ul></form></div>';
692 775
		//关闭按钮
@ -741,8 +824,8 @@ function ConsultComment() {
741 824
		//星级评价
742 825
		PopHtml += '<tr><th class="resouinfotype" scope="row">总体评价</th><td><div class="resouinforcon"><div class="evastarbox2" id="evastarbox2"><span class="evastar2"></span><span class="evastar2"></span><span class="evastar2"></span><span class="evastar2"></span><span class="evastar2"></span></div></div></td></tr>';
743 826
		//评价内容
744
		PopHtml += '<tr> <th class="resouinfotype" scope="row">评价内容</th> <td><div class="resouinforcon"><textarea class="frmtype frmarea" id="assessCon" ></textarea></div></td></tr>';
745
		PopHtml += '<tr> <th class="resouinfotype" scope="row"></th><td><div class="resouinforcon"><div class="wordlimit">字数限制为<span id="textCount">5~200</span>个</div></div></td> </tr>';
827
		PopHtml += '<tr> <th class="resouinfotype" scope="row">评价内容</th> <td><div class="resouinforcon"><textarea class="frmtype frmarea"></textarea></div></td></tr>';
828
		PopHtml += '<tr> <th class="resouinfotype" scope="row"></th><td><div class="resouinforcon"><div class="wordlimit">字数限制为5~200个</div></div></td> </tr>';
746 829
		PopHtml += '</table>';
747 830
		//按钮
748 831
		PopHtml += '<table class="btntab"><tr><td>';
@ -753,7 +836,7 @@ function ConsultComment() {
753 836
		PopHtml += ' </div> </div>';
754 837
		
755 838
	   /////******感谢专家tab*/
756
		PopHtml += '<div class="overcomment displayNone" > ';
839
		PopHtml += '<div class="overcomment" > ';
757 840
		PopHtml += '<div class="resoutit">本次咨询已经结束</div> ';
758 841
		PopHtml += '<div class="commentbox2">  ';
759 842
		//按钮
@ -765,7 +848,7 @@ function ConsultComment() {
765 848
		PopHtml += '</table></div> </div>'
766 849
			
767 850
		PopHtml += '</form>';
768
		PopHtml += '<span class="workclose" id="closeAssessBtn"></span>';
851
		PopHtml += '<span class="workclose"></span>';
769 852
		PopHtml += '</div></div>';
770 853

771 854
	//必须先将html添加到body,再设置Css样式

+ 31 - 30
src/main/webapp/js/sciresource.js

@ -75,32 +75,19 @@ $(function(){
75 75
	function addDele(){
76 76
		$("#industryList").on("click",".removeNu",function(){					
77 77
			$(this).parent().remove();
78
			});
79
		
80
		
78
			});	
81 79
		$("#industryAdd").click(function(){
82
			if($.trim($("#industry").val())){
83 80
			var val=$("#industry").val();
84 81
			$("#industryList").append("<div class='deleteIndustry'>"+ val +"<span class='removeNu'><img src='images/move.png'></span></div>")							
85
			}else{
86
				$.MsgBox.Alert("消息","应用行业不能为空");
87
			}
88 82
			});
89 83
		$("#SubjectList").on("click",".removeNu",function(){					
90 84
			$(this).parent().remove();
91
			});					
92
			$("#subjectAdd").click(function(){
93
				if($.trim($("#subject").val())){
94
				var val=$("#subject").val();
95
				$("#SubjectList").append("<div class='deleteSubject'>"+ val +"<span class='removeNu'><img src='images/move.png'></span></div>")							
96
				}else{
97
					$.MsgBox.Alert("消息","学术领域不能为空");
98
				}
99
				});
100
		
101
		
85
			});	
86
		$("#subjectAdd").click(function(){				
87
			var val=$("#subject").val();
88
			$("#SubjectList").append("<div class='deleteSubject'>"+ val +"<span class='removeNu'><img src='images/move.png'></span></div>")							
89
			});
102 90
	}
103

104 91
//我的资源的删除,修改
105 92
	$("#workmysrc").on("click",".resoumag",function()
106 93
			{ 		
@ -188,9 +175,11 @@ $(function(){
188 175
								$data.cooperationNotes = $("#cooperationNotes").val();
189 176
								$data.subject=captiureSubInd("SubjectList .deleteSubject");
190 177
								$data.industry=captiureSubInd("industryList .deleteIndustry");
191
								$data.descp=$("#descp").val();
192
								$data.fn=cacheImageKey;
193
								
178
								$data.descp=$("#descp").val();								
179
								if(cacheImageKey){
180
									console.log(cacheImageKey);
181
									$data.fn=cacheImageKey;
182
								}
194 183
								if (resourceID) {
195 184
									
196 185
									$data.resourceId = resourceID;
@ -275,17 +264,29 @@ $(function(){
275 264
							add+='<tr class="worktabtit"><th width="20%" height="40">申请时间</th><th width="20%">需求方</th>'    
276 265
							add+='<th width="12%">联系人</th><th width="14%">交付时间</th>'        
277 266
							add+='<th width="20%">付款进程</th><th width="12%">状态/操作</th></tr></table><div class="tcdPageCode tcdPageCod'+i+'"></div></div>';
278
							$("#consd").append(add);
267
							$add = $(add);
268
							
269
							$("#consd").append($add);
279 270
							if(data.data[i].subject==undefined){
280 271
								$(".li1").eq(i).css({"display":"none"});
281
							}														
282
							$('.resoumag').eq(i+1).attr("resourceId",data.data[i].resourceId);
272
							}	
273
							
274
							$add.find('.resoumag').attr("resourceId",data.data[i].resourceId);
283 275
							
284
							$(".resourceImg").eq(i).attr("src","/images/resource/"+data.data[i].resourceId+".jpg");
285
							$(".resourceImg").load(function(){})
286
								.error(function(){
287
									$(this).attr("src","/images/default-resource.jpg");
288
								});	
276
							
277
							//$('.resoumag').eq(i+1).attr("resourceId",data.data[i].resourceId);
278
							if(data.data[i].images.length){
279
								$add.find(".resourceImg").attr("src","/images/resource/"+data.data[i].resourceId+".jpg");
280
							}
281
							else
282
							{
283
								$add.find(".resourceImg").attr("src","/images/default-resource.jpg");
284
							}
285
							
286
							
287
							
288
									
289
								
289 290
							
290 291
							//console.log($('.resoumag').eq(i+1).attr("resourceId"));
291 292
							//资源所对应的记录

+ 2 - 1
src/main/webapp/js/workspace.js

@ -40,7 +40,8 @@ function gatModule(){
40 40
	});
41 41
}
42 42
gatModule();
43
	$.ajax({
43

44
  $.ajax({
44 45
		"url":"workindex.html",
45 46
		"dataType":"html",
46 47
		"success":function(result){

+ 6 - 4
src/main/webapp/workspaces.html

@ -7,9 +7,9 @@
7 7
<title>科袖-我的工作台</title>
8 8
<style>			
9 9
#startbox .span,#evastarbox2 .addStar,#showAllAssess .addStar{
10
	background: url(../images/evastar.png) 0 1px no-repeat;
10
	background: url(../images/evastar.png) 0 0px no-repeat;
11 11
	}
12
	#commbox .span{background: url(../images/evastar.png) 0 1px no-repeat;}
12
	#commbox .span{background: url(../images/evastar.png) 0 0px no-repeat;}
13 13
	</style>	
14 14
<link type="text/css" href="css/bootstrap.min.css" rel="stylesheet">
15 15
<link type="text/css" href="css/reset.css" rel="stylesheet" />
@ -17,6 +17,7 @@
17 17
<link rel="stylesheet" href="//apps.bdimg.com/libs/jqueryui/1.10.4/css/jquery-ui.min.css">
18 18
<link type="text/css" href="css/workspace.css" rel="stylesheet">
19 19
<link type="text/css" href="css/popup.css" rel="stylesheet">
20
<link rel="stylesheet" type="text/css" href="css/webuploader/webuploader.css">
20 21
</head>
21 22

22 23
<body>
@ -126,15 +127,16 @@
126 127

127 128

128 129
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
129
<script src="//apps.bdimg.com/libs/jquery/1.10.2/jquery.min.js"></script>
130
<!-- <script src="//apps.bdimg.com/libs/jquery/1.10.2/jquery.min.js"></script> -->
130 131
<script src="//apps.bdimg.com/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
132
<script type="text/javascript" src="js/webuploader/webuploader.js"></script>
131 133

132 134
<script type="text/javascript" src="js/common.js"></script>
133 135

134 136
<!-- <script type="text/javascript" src="js/jquery.HeadP.js"> </script>
135 137
<script type="text/javascript" src="js/jquery.Jcrop.js"> </script>
136 138
<script type="text/javascript" src="js/basic.js"> </script> -->
137
<script type="text/javascript" src="/js/ajaxfileupload.js"></script>
139
<!-- <script type="text/javascript" src="/js/ajaxfileupload.js"></script> -->
138 140

139 141
 <script src="js/jquery.page.js"></script>
140 142
<script type="text/javascript"src="js/jquery.cookie.js"></script>