mirror of
https://github.com/201206030/novel-plus.git
synced 2025-04-26 17:20:52 +00:00
个人中心新增头像设置
This commit is contained in:
parent
48aff7cf37
commit
1a5122209a
@ -25,7 +25,14 @@
|
||||
<div class="my_info cf">
|
||||
<div class="my_info_txt">
|
||||
<ul class="mytab_list">
|
||||
<li><i class="tit">我的头像</i><a href="javascript:void(0);"><img id="imgLogo" class="user_img" alt="我的头像" src="/images/man.png" /></a></li>
|
||||
<li ><i class="tit">我的头像</i>
|
||||
<a style="position: relative" >
|
||||
<img id="imgLogo" class="user_img" alt="我的头像" src="/images/man.png" />
|
||||
<input class="opacity" onchange="picChange()" type="file" id="file0" name="file" title="点击上传图片" style="z-index: 100;cursor: pointer;left: 0px; top: -25px; width: 60px; height: 80px; opacity: 0; position: absolute; "/>
|
||||
|
||||
</a>
|
||||
|
||||
</li>
|
||||
<li><i class="tit">我的昵称</i><a href="/user/set_name.html" id="my_name"></a></li>
|
||||
<li style="display:none"><i class="tit">电子邮箱</i><a href="javascript:void(0);"></a></li>
|
||||
<li><i class="tit">我的性别</i><a href="/user/set_sex.html" id="my_sex"></a></li>
|
||||
@ -42,6 +49,7 @@
|
||||
</div>
|
||||
<div th:replace="common/js :: js"></div>
|
||||
<script src="/javascript/user.js" type="text/javascript"></script>
|
||||
<script src="/javascript/ajaxfileupload.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
//查询用户信息
|
||||
$.ajax({
|
||||
@ -82,6 +90,58 @@
|
||||
layer.alert('网络异常');
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
function picChange() {
|
||||
var file = $("#file0").val(); //文件名称
|
||||
if (file != "") {
|
||||
|
||||
$.ajaxFileUpload({
|
||||
url : "/file/upload", //用于文件上传的服务器端请求地址
|
||||
secureuri : false, //是否需要安全协议,一般设置为false
|
||||
fileElementId : "file0", //文件上传域的ID
|
||||
dataType : "json", //返回值类型 一般设置为json
|
||||
type : "post",
|
||||
success : function(data) { //服务器成功响应处理函数
|
||||
if (data.code == 200) {
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/user/updateUserInfo",
|
||||
data: {'userPhoto':data.data},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.code == 200) {
|
||||
window.location.href = '/user/setup.html';
|
||||
|
||||
} else if (data.code == 1001) {
|
||||
//未登录
|
||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
||||
|
||||
} else {
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
|
||||
},
|
||||
error: function () {
|
||||
layer.alert('网络异常');
|
||||
}
|
||||
})
|
||||
|
||||
}else {
|
||||
layer.alert('图片上传失败');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
} else {
|
||||
alert("请选择上传文件!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
x
Reference in New Issue
Block a user