...
|
...
|
@@ -444,7 +444,28 @@ |
|
|
<video width="100%" height="200" autoplay loop controls id="videos">
|
|
|
<source src="/static/login/New-jumbo.mp4" type="video/mp4">
|
|
|
</video>
|
|
|
<el-button class="btns" @click="screenshot">一键截屏</el-button>
|
|
|
<el-row>
|
|
|
<el-image
|
|
|
:src="imgBase64" width="200" height="200"
|
|
|
fit="fill"></el-image>
|
|
|
</el-row>
|
|
|
<el-button type="success" class="btns" @click="screenshot">一键截屏上传</el-button>
|
|
|
<!-- <el-upload-->
|
|
|
<!-- class="upload-demo"-->
|
|
|
<!-- drag-->
|
|
|
<!-- action=""-->
|
|
|
<!-- :headers="uploadHeaderObj"-->
|
|
|
<!-- :on-success="handleUploadSuccess"-->
|
|
|
<!-- :auto-upload="false"-->
|
|
|
<!-- :on-change="submitUpload"-->
|
|
|
<!-- ref="upload"-->
|
|
|
<!-- >-->
|
|
|
<!-- <i class="el-icon-upload avatar-uploader-icon"></i>-->
|
|
|
<!-- <div class="el-upload__text">将文件拖到此处,或<em>点击上传文件</em></div>-->
|
|
|
<!-- <div class="el-upload__tip" slot="tip">只能上传xml文件,且不超过2MB</div>-->
|
|
|
<!-- </el-upload>-->
|
|
|
<!-- <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>-->
|
|
|
|
|
|
</el-drawer>
|
|
|
</el-row>
|
|
|
</template>
|
...
|
...
|
@@ -461,6 +482,8 @@ |
|
|
import jsutil from "@/common/js/util";
|
|
|
import { getList as getCRMList } from '@/api/crm_api';
|
|
|
import { loginedUserInfo } from '@/api/user';
|
|
|
import html2canvas from 'html2canvas'
|
|
|
import {uploadPath,upfileWithPost} from "../../api/technological";
|
|
|
|
|
|
|
|
|
export default {
|
...
|
...
|
@@ -480,6 +503,12 @@ |
|
|
areaData:[],
|
|
|
locationData:[],
|
|
|
roles:[],
|
|
|
imgBase64:'',
|
|
|
imgUploadPath:uploadPath,
|
|
|
uploadFileList:[],
|
|
|
uploadHeaderObj: {
|
|
|
Authorization: window.sessionStorage.getItem("token"),
|
|
|
},
|
|
|
dialogMap: {
|
|
|
update: '编辑',
|
|
|
create: '新增'
|
...
|
...
|
@@ -830,6 +859,84 @@ |
|
|
};
|
|
|
},
|
|
|
screenshot(){
|
|
|
let video = document.getElementById('videos')
|
|
|
html2canvas(video, {
|
|
|
allowTaint: true,
|
|
|
useCORS: true
|
|
|
}).then((canvas) => {
|
|
|
// base64
|
|
|
this.imgBase64 = canvas.toDataURL('image/png')
|
|
|
// 下载方法1,浏览器弹出下载文件提示
|
|
|
const saveInfo = {
|
|
|
// 导出文件格式自己定义
|
|
|
'download': '文件名' + '.png',
|
|
|
'href': this.imgBase64
|
|
|
}
|
|
|
const element = document.createElement('a')
|
|
|
element.style.display = 'none'
|
|
|
for (const key in saveInfo) {
|
|
|
element.setAttribute(key, saveInfo[key])
|
|
|
}
|
|
|
document.body.appendChild(element)
|
|
|
// element.click()
|
|
|
setTimeout(() => {
|
|
|
document.body.removeChild(element)
|
|
|
}, 300)
|
|
|
this.uploadFile(this.imgBase64)
|
|
|
})
|
|
|
},
|
|
|
// 接口上传
|
|
|
uploadFile(imgBase64){
|
|
|
const base64List = imgBase64.split(',')[1]
|
|
|
const raw = window.atob(base64List)
|
|
|
const rawLength = raw.length
|
|
|
const uInt8Array = new Uint8Array(rawLength)
|
|
|
for (let i = 0; i < rawLength; ++i) {
|
|
|
uInt8Array[i] = raw.charCodeAt(i)
|
|
|
}
|
|
|
// 若需上传,将base64转为file文件
|
|
|
const blob = new Blob([uInt8Array], { type: 'image/png' })
|
|
|
let fileOfBlob = new File([blob], 'imgCaptureTest' + '.png')
|
|
|
// this.submitUpload(fileOfBlob);
|
|
|
var formData = new FormData()
|
|
|
formData.append('file', fileOfBlob)
|
|
|
this.submitUpload(formData);
|
|
|
},
|
|
|
//上传文件
|
|
|
handleUploadSuccess: function(response, file, fileList){
|
|
|
let res = response.data;
|
|
|
if (response.code !== '200') {
|
|
|
// 关闭加载
|
|
|
return this.$message.error(response.msg);
|
|
|
}
|
|
|
this.$message.success(res.msg);
|
|
|
this.addForm.picUrl = res.data.relativePath
|
|
|
|
|
|
},
|
|
|
submitUpload(formData){
|
|
|
let ld = this.$loading({
|
|
|
text:"图片数据上传中..."
|
|
|
})
|
|
|
const para = {
|
|
|
file:formData
|
|
|
}
|
|
|
upfileWithPost(formData).then((response)=>{
|
|
|
let res = response.data;
|
|
|
if (res.code !== '200') {
|
|
|
// 关闭加载
|
|
|
return this.$message.error(res.msg);
|
|
|
}
|
|
|
this.$message.success(res.msg);
|
|
|
this.addForm.picUrl = res.data.relativePath
|
|
|
}).finally(()=>{
|
|
|
ld.close()
|
|
|
})
|
|
|
// this.$refs.upload.submit();
|
|
|
},
|
|
|
trnSelectionChange(){
|
|
|
|
|
|
},
|
|
|
checkSelectable(){
|
|
|
|
|
|
}
|
|
|
},
|
...
|
...
|
|