Explorar el Código

修改资源详细页面资源图片,个人修改页头像可修改上传

lipengtao %!s(int64=8) %!d(string=hace) años
padre
commit
eb0de6f978

+ 3 - 2
app/html/proinforupdate.html

@ -22,7 +22,7 @@
22 22
				<div class="maincon personinfo">
23 23
					<div class="headbox">
24 24
				        <a href="javascript:;">
25
				        	<img class="headimg headRadius" src="../images/default-photo.jpg" />
25
				        	<img class="headimg headRadius" src="../images/default-photo.jpg" id="userimg"/>
26 26
				        	<div class="pinfor">点击更换头像</div>
27 27
				        </a>
28 28
			        </div>
@ -154,7 +154,8 @@
154 154
		
155 155
		<script src="../js/public/mui.min.js"></script>
156 156
		<script src="../js/public/base.js"></script>
157
		<script type="text/javascript" src="../js/proinforupdate.js"></script>	
157
		<script src="../js/public/upload-avatar.js"></script>
158
		<script type="text/javascript" src="../js/proinforupdate.js"></script>		
158 159
	</body>
159 160
160 161
</html>

+ 4 - 1
app/js/myaccount.js

@ -39,7 +39,10 @@ mui.ready(function() {
39 39
			loginStatus();
40 40
			userInformation();
41 41
		});
42

42
		//在修改上传图片触发的事件
43
		window.addEventListener('photoUser', function(event) {			
44
			userInformation();
45
		});
43 46
		function loginStatus() {
44 47
			console.log(userId);
45 48
			if(userId && userId != "null" && userId != null) {

+ 22 - 8
app/js/picture-upload.js

@ -20,13 +20,28 @@ mui.plusReady(function() {
20 20
			success: function(data) {
21 21
				console.log(JSON.stringify(data));
22 22
				console.log(data.success);
23
				plus.nativeUI.toast("图片上传成功", toastStyle);
24
				mui.currentWebview.close();
25
				mui.back();
26
				var fPage = plus.webview.getWebviewById('../html/fillinfo.html');
27
				mui.fire(fPage, 'closePage', {
28
					id: imgfh
29
				});
23
				if(data.success) {
24
					plus.nativeUI.toast("图片上传成功", toastStyle);
25
					mui.currentWebview.close();
26
					mui.back();
27
					var flag = list.flag;
28
					if(flag == 0) {
29
						var Page = plus.webview.getWebviewById('html/proinforupdate.html');
30
						mui.fire(Page, 'newId');
31
						var Pa = plus.webview.getWebviewById('html/myaccount.html');
32
						mui.fire(Pa, 'photoUser');
33
						
34
					} else {
35
						var fPage = plus.webview.getWebviewById('../html/fillinfo.html');
36
						mui.fire(fPage, 'closePage', {
37
							id: imgfh
38
						});
39
					}
40
				} else {
41
					plus.nativeUI.toast("图片上传失败", toastStyle);
42

43
				}
44

30 45
			},
31 46
			error: function(data) {
32 47
				plus.nativeUI.toast("服务器链接超时", toastStyle);
@ -36,7 +51,6 @@ mui.plusReady(function() {
36 51
	})
37 52
})
38 53

39

40 54
//获取手机屏幕宽高
41 55
var c_w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
42 56
var c_h = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;

+ 4 - 4
app/js/proinforupdate.js

@ -9,8 +9,8 @@ mui.ready(function() {
9 9
			personalMaterial[2].parentNode.style.display = "block";
10 10
			personalMaterial[3].parentNode.style.display = "block";
11 11
			personalMaterial[4].parentNode.style.display = "block";
12
			personalMaterial[5].parentNode.style.display = "block";
13
			personalMessage();						
12
			personalMaterial[5].parentNode.style.display = "block";			
13
			personalMessage();
14 14
		})
15 15
		
16 16
		//查询学术领域
@ -116,8 +116,8 @@ mui.ready(function() {
116 116
					var $data = data.data;
117 117
					personalMaterial[0].innerText = $data.name;
118 118
					//头像					
119
					if($data.hasHeadImage) {
120
						oImg.src = baseUrl + "/images/head/" + $data.id + "_l.jpg";
119
					if($data.hasHeadImage) {						
120
						oImg.src = baseUrl + "/images/head/" + $data.id + "_l.jpg";						
121 121
					}
122 122
					//基本信息
123 123
					if(!$data.authentication) {

+ 10 - 3
app/js/public/upload-avatar.js

@ -1,6 +1,6 @@
1 1
/*头像上传*/
2 2
var userimg = document.getElementById("userimg");
3

3
var flag;
4 4
window.addEventListener('closePage', function(event) {
5 5
	bimg = event.detail.id;
6 6
	var imgvar='<img src="'+bimg+'" style="width:100%"/>';  
@ -8,7 +8,11 @@ window.addEventListener('closePage', function(event) {
8 8
});
9 9

10 10
mui.plusReady(function() {
11

11
	var ws=plus.webview.currentWebview();
12
	var web=plus.webview.getWebviewById("html/proinforupdate.html");
13
	if(ws==web) {
14
		flag=0;
15
	}
12 16
	userimg.addEventListener("tap", function() {
13 17
		if(mui.os.plus) {
14 18
			var a = [{
@ -42,6 +46,7 @@ mui.plusReady(function() {
42 46
		var c = plus.camera.getCamera();
43 47
		c.captureImage(function(e) {
44 48
			plus.io.resolveLocalFileSystemURL(e, function(entry) {
49
				
45 50
				mui.openWindow({
46 51
					url: '../html/picture-upload.html',
47 52
					id: 'html/picture-upload.html',
@ -50,6 +55,7 @@ mui.plusReady(function() {
50 55
					},
51 56
					extras: {
52 57
						imgurl: entry.toLocalURL(),
58
						flag:flag
53 59
					}
54 60
				});
55 61
			}, function(e) {
@ -80,10 +86,11 @@ mui.plusReady(function() {
80 86
				url: '../html/picture-upload.html',
81 87
				id: 'html/picture-upload.html',
82 88
				show: {
83
					aniShow: "slide-in-right"
89
					aniShow: "slide-in-right"					
84 90
				},
85 91
				extras: {
86 92
					imgurl: entry.toLocalURL(),
93
					flag:flag
87 94
				}
88 95
			});
89 96
		});

+ 8 - 2
app/js/resinforbrow.js

@ -36,7 +36,7 @@ function ziyuaninfo(resourceId) {
36 36
			timeout: 10000, //超时时间设置为10秒;
37 37
			success: function(data) {
38 38
				if(data.success) {
39
					console.log(data);
39
					console.log(JSON.stringify(data));
40 40
					
41 41
					var mydata = data.data;
42 42
					//资源名称
@ -69,7 +69,13 @@ function ziyuaninfo(resourceId) {
69 69
					: oproimg.setAttribute('src',baseUrl+'/images/head/'+mydata['professor']['id']+'_m.jpg');
70 70
					
71 71
					//资源基本信息
72
					(mydata['images']['imageSrc']) ? oziyuanimg.setAttribute('src', mydata['images']['imageSrc']): oziyuanimg.setAttribute('src', '../images/default-resource.jpg'); //资源图片
72
					//(mydata['images']['imageSrc']) ? oziyuanimg.setAttribute('src', mydata['images']['imageSrc']): oziyuanimg.setAttribute('src', '../images/default-resource.jpg'); //资源图片
73
					
74
					if(mydata['images'].length) {						
75
						oziyuanimg.setAttribute('src', mydata['images'][0]['imageSrc'])
76
					} else {						
77
						oziyuanimg.setAttribute('src', '../images/default-resource.jpg')
78
					}
73 79
					(mydata['supportedServices']) ? oyongtu.innerHTML = mydata['supportedServices']: oyongtu.innerHTML = ''; //应用用途
74 80
	
75 81
					//学术领域