头像插件:
<!--上传头像的样式-->
<link href="../../libs/cropper/cropper.min.css" rel="stylesheet"/>
<link href="../../libs/cropper/sitelogo.css" rel="stylesheet"/>
<link href="../../libs/cropper/font-awesome.min.css" rel="stylesheet"/>
<!--以下为上传头像的插件-->
<script src="../../libs/cropper/cropper.js"></script>
<script src="../../libs/cropper/sitelogo.js"></script>
<script src="../../libs/cropper/html2canvas.min.js"></script>
1.使用link标签引入css文件的时候,rel属性必须写,否则就会出错
2.fonts文件夹,要放在与css文件所在文件夹同一级
3.传输的是base64图片
$(".avatar-save").on("click", function() {
var img_lg = document.getElementById('imageHead');
// 截图小的显示框内的内容
html2canvas(img_lg, {
allowTaint: true,
taintTest: false,
onrendered: function(canvas) {
canvas.id = "mycanvas";
//生成base64图片数据
var dataUrl = canvas.toDataURL("image/jpeg");
var newImg = document.createElement("img");
newImg.src = dataUrl;
imagesAjax(dataUrl)
}
});
})
function imagesAjax(src) {
var data = {};
$.ajax({
url:commonIp+"personCenter/savePersonPhoto",
data: {
info:src,
userId:userid,
},
type: "POST",
dataType: 'json',
success: function(Data) {
setInfo.userphoto=Data.data.userPhoto;
}
});
}
日历插件:
<input class="form-control f-left" id="d11" type="text" onClick="WdatePicker({maxDate:'%y-%M-%d'})" :placeholder="bir"/>
这一句是重点,再引入插件就可以了
<script src="../../libs/My97DatePicker/WdatePicker.js"></script>
<script src="../../libs/timeData.js"></script>