Commit 514a378f authored by zhoujun's avatar zhoujun

Merge branch 'test' of http://gitlab.cccwangluo.com/zhoujun/uc_card into test

parents b2cc8745 0762ec65
......@@ -117,7 +117,7 @@
@if($userImgStatus == -1) <img src="{{ asset('postcard/images/img_add.jpg') }}" class="img img-add" alt="">
<input type="file" id="file"> @endif
@if($userImgStatus == 0) <img src="{{ asset('postcard/images/img_sh.jpg') }}" class="img img-sh" alt=""> @endif
@if($userImgStatus == 1) <img src="{{ $userImg }}" class="img img-sh" alt=""> @endif
@if($userImgStatus == 1) <img src="{{ $userImg }}?t=129094392478" class="img img-sh" alt=""> @endif
@if($userImgStatus == 2) <img src="{{ asset('postcard/images/sh_fail.jpg') }}" class="img img-sh" alt="">
<input type="file" id="file"> @endif
</div>
......@@ -182,6 +182,7 @@
var file = $("#file")[0].files[0];
var acceptFileTypes = /^image\/(gif|jpe?g|png)$/i;
var roleId = getQueryString('roleId');
var serverId = getQueryString('serverId');
//文件类型判断
if (file.type.length && !acceptFileTypes.test(file.type)) {
alert('请上传gif、jpg、jpeg或png格式的文件');
......@@ -194,6 +195,7 @@
}
formData.append("imgFile", file);
formData.append("roleId", roleId);
formData.append("serverId", serverId);
formData.append("_token", "{{ csrf_token() }}")
$.ajax({
url: "/upload/img",
......@@ -216,13 +218,14 @@
function baseImageUrl() {
setTimeout(function () {
html2canvas(document.querySelector("#test"), { //关键在于new
useCORS: true,
removeContainer: true,
allowTaint: false,
width: window.screen.availWidth,
windowWidth: document.body.scrollWidth,
x: 0,
y: 0,
useCORS: true,
logging:true
}).then(canvas => {
var image = canvas.toDataURL('image/jpeg', 1.0);
var img = '<img src="' + image + '">';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment