|
|
|
|
|
<!DOCTYPE html>
|
|
|
<html lang="en">
|
|
|
<head>
|
|
|
<meta charset="UTF-8">
|
|
|
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
|
|
|
<link rel="stylesheet" href="https://at.alicdn.com/t/font_750594_itt4qc4xfcg.css">
|
|
|
<link rel="stylesheet" href="https://at.alicdn.com/t/font_834805_0ml90wdq5hzm.css">
|
|
|
<link rel="stylesheet" href="__INDEX__/css/base.css">
|
|
|
<link rel="stylesheet" href="__INDEX__/css/editmateial.css">
|
|
|
<link rel="stylesheet" href="__INDEX__/css/swiper.min.css">
|
|
|
<script type="text/javascript" src="__INDEX__/js/base.js"></script>
|
|
|
<title>编辑资料</title>
|
|
|
<style>
|
|
|
#imghead{
|
|
|
width:100%;height:100%;
|
|
|
border-radius: 50%;
|
|
|
margin-top: 0;
|
|
|
}
|
|
|
#preview{
|
|
|
width:1.2rem;
|
|
|
margin: 0 auto;
|
|
|
height:1.2rem;
|
|
|
border-radius: 50%;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|
|
|
</head>
|
|
|
<body>
|
|
|
<div class="headwrap">
|
|
|
<div class="headpop">
|
|
|
|
|
|
<div id="preview">
|
|
|
<!--<img id="imghead" border="0" src="__INDEX__/img/head@2x.png" style="width:100%;height:100%" onclick="$('#previewImg').click();">-->
|
|
|
<p class="iconfont icon-xiangji" id="imghead" onclick="$('#previewImg').click();"></p>
|
|
|
</div>
|
|
|
<!--<img src="__INDEX__/img/delet.png" alt="" style="position:absolute;bottom:92px;left:46px" class="deleteimg"/>-->
|
|
|
<input type="file" onchange="previewImage(this)" style="display: none;" id="previewImg">
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="head">
|
|
|
<p class="head_img">
|
|
|
<img src="{$data.avatar}" alt="">
|
|
|
</p>
|
|
|
|
|
|
</div>
|
|
|
<div class="item">
|
|
|
<div class="material_name editname">
|
|
|
<p class="item_name">昵称</p>
|
|
|
<div class="list_item_name">
|
|
|
<p class="list_name">{$data.user_nickname}</p>
|
|
|
<p class="iconfont icon-jinru"></p>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="material_name edit_sex">
|
|
|
<p class="item_name">性别</p>
|
|
|
<div class="list_item_name">
|
|
|
<p class="list_name"><if condition="$data['sex'] eq '0'">男<else/>女</if></p>
|
|
|
<p class="iconfont icon-jinru"></p>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="material_name editphone" style="margin-top: 0.16rem">
|
|
|
<p class="item_name">绑定手机号</p>
|
|
|
<div class="list_item_name">
|
|
|
<p class="list_name">{$data.mobile}</p>
|
|
|
<p class="iconfont icon-jinru"></p>
|
|
|
</div>
|
|
|
</div>
|
|
|
</body>
|
|
|
<script src="__INDEX__/js/jquery.min.js"></script>
|
|
|
<script>
|
|
|
//编辑姓名
|
|
|
$(".editname").click(function(){
|
|
|
window.location.href="{:url('user/Center/editName')}"
|
|
|
})
|
|
|
//绑定手机号
|
|
|
$(".editphone").click(function(){
|
|
|
|
|
|
window.location.href="{:url('user/Center/editPhone')}"
|
|
|
})
|
|
|
|
|
|
//上传头像
|
|
|
function clacImgZoomParam(maxWidth, maxHeight, width, height) {
|
|
|
var param = {
|
|
|
top: 0,
|
|
|
left: 0,
|
|
|
width: width,
|
|
|
height: height
|
|
|
};
|
|
|
if(width > maxWidth || height > maxHeight) {
|
|
|
rateWidth = width / maxWidth;
|
|
|
rateHeight = height / maxHeight;
|
|
|
|
|
|
if(rateWidth > rateHeight) {
|
|
|
param.width = maxWidth;
|
|
|
param.height = Math.round(height / rateWidth);
|
|
|
} else {
|
|
|
param.width = Math.round(width / rateHeight);
|
|
|
param.height = maxHeight;
|
|
|
}
|
|
|
}
|
|
|
param.left = Math.round((maxWidth - param.width) / 2);
|
|
|
param.top = Math.round((maxHeight - param.height) / 2);
|
|
|
return param;
|
|
|
}
|
|
|
|
|
|
|
|
|
function previewImage(file) {
|
|
|
$(".head_img").css("display","none")
|
|
|
var MAXWIDTH =60;
|
|
|
var MAXHEIGHT =77;
|
|
|
var div = document.getElementById('preview');
|
|
|
if(file.files && file.files[0]) {
|
|
|
div.innerHTML = '<img id=imghead onclick=$("#previewImg").click()>';
|
|
|
var img = document.getElementById('imghead');
|
|
|
img.onload = function() {
|
|
|
var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight);
|
|
|
img.width = rect.width;
|
|
|
img.height = rect.height;
|
|
|
// img.style.marginLeft = rect.left+'px';
|
|
|
// img.style.marginTop = rect.top + 'px';
|
|
|
}
|
|
|
var reader = new FileReader();
|
|
|
reader.onload = function(evt) {
|
|
|
img.src = evt.target.result;
|
|
|
}
|
|
|
reader.readAsDataURL(file.files[0]);
|
|
|
} else //兼容IE
|
|
|
{
|
|
|
var sFilter = 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="';
|
|
|
file.select();
|
|
|
var src = document.selection.createRange().text;
|
|
|
div.innerHTML = '<img id=imghead>';
|
|
|
var img = document.getElementById('imghead');
|
|
|
img.filters.item('DXImageTransform.Microsoft.AlphaImageLoader').src = src;
|
|
|
// var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight);
|
|
|
// status = ('rect:' + rect.top + ',' + rect.left + ',' + rect.width + ',' + rect.height);
|
|
|
div.innerHTML = "<div id=divhead style='100%;height:100%;border-radius:50%" + sFilter + src + "\"'></div>";
|
|
|
}
|
|
|
// var formData = new FormData();
|
|
|
// var fileM = document.querySelector("#previewImg");
|
|
|
// var fileObj = fileM.files[0];
|
|
|
// formData.append("files", fileObj);
|
|
|
// $.ajax({
|
|
|
// url: 'http://hula.wx.bronet.cn/index.php/MyComment/upload',
|
|
|
// type: 'POST',
|
|
|
// data: formData,
|
|
|
// async: false,
|
|
|
// cache: false,
|
|
|
// contentType: false,
|
|
|
// processData: false,
|
|
|
// success: function(res) {
|
|
|
// console.log(res);
|
|
|
// pic = res.data;
|
|
|
// console.log(pic);
|
|
|
// imgurl.push(pic);
|
|
|
// console.log(imgurl)
|
|
|
// var text = '';
|
|
|
// text += '<div class="evaluate_pic_item" style="float:left">' +
|
|
|
// '<img src="' + pic + '" class="delimg"/>' +
|
|
|
// '<div class="icon">' +
|
|
|
// '<img src="__INDEX__/img/10拷贝2@2x_59.png" />' +
|
|
|
// '</div>' +
|
|
|
// '</div>'
|
|
|
// $(".addimg").append(text);
|
|
|
// if(imgurl.length == 3) {
|
|
|
// $(".imgone").css("display", "none");
|
|
|
// }
|
|
|
// $("#imghead").attr("src","__INDEX__/img/3@2x.png");
|
|
|
// },
|
|
|
// error: function() {
|
|
|
//
|
|
|
// }
|
|
|
// });
|
|
|
}
|
|
|
</script>
|
|
|
</html> |
...
|
...
|
|