addWord
This commit is contained in:
parent
ab96880772
commit
46629a064c
|
@ -0,0 +1,8 @@
|
||||||
|
import request from '@/utils/request'
|
||||||
|
export function faceLogin(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/facelogin/',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
|
@ -103,6 +103,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
activeName: "",
|
||||||
loading: false,
|
loading: false,
|
||||||
passwordType: "password",
|
passwordType: "password",
|
||||||
redirect: undefined,
|
redirect: undefined,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-card>
|
<el-card>
|
||||||
|
|
||||||
<el-descriptions title="子工序详情" :column="2" border>
|
<el-descriptions title="子工序详情" :column="2" border>
|
||||||
<el-descriptions-item label="工序名称" label-class-name="my-label" content-class-name="my-content">{{step.name}}</el-descriptions-item>
|
<el-descriptions-item label="工序名称" label-class-name="my-label" content-class-name="my-content">{{step.name}}</el-descriptions-item>
|
||||||
<el-descriptions-item label="步骤编号" label-class-name="my-label" content-class-name="my-content">{{step.number}}</el-descriptions-item>
|
<el-descriptions-item label="步骤编号" label-class-name="my-label" content-class-name="my-content">{{step.number}}</el-descriptions-item>
|
||||||
|
@ -12,13 +11,11 @@
|
||||||
:value="item.number">{{item.name}}</el-tag>
|
:value="item.number">{{item.name}}</el-tag>
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="指导书内容" label-class-name="my-label" :contentStyle="{'text-align': 'left'}">{{step.instruction_content}}</el-descriptions-item>
|
<el-descriptions-item label="指导书内容" label-class-name="my-label" :contentStyle="{'text-align': 'left'}">{{step.instruction_content}}</el-descriptions-item>
|
||||||
</el-descriptions>
|
</el-descriptions>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card>
|
<el-card>
|
||||||
|
|
||||||
<el-tabs type="border-card">
|
<el-tabs type="border-card">
|
||||||
<el-tab-pane label="过程记录">
|
<el-tab-pane label="过程记录">
|
||||||
|
|
||||||
<el-row :gutter="24">
|
<el-row :gutter="24">
|
||||||
<el-col :span="6" >
|
<el-col :span="6" >
|
||||||
<el-card style="margin-top: 10px">
|
<el-card style="margin-top: 10px">
|
||||||
|
@ -74,7 +71,6 @@
|
||||||
label-width="80px"
|
label-width="80px"
|
||||||
label-position="right"
|
label-position="right"
|
||||||
>
|
>
|
||||||
|
|
||||||
<el-form-item label="表格名称" prop="name">
|
<el-form-item label="表格名称" prop="name">
|
||||||
<el-input v-model="recordform.name" placeholder="表格名称" />
|
<el-input v-model="recordform.name" placeholder="表格名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -105,7 +101,6 @@
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="handlefieldCreate"
|
<el-button type="primary" icon="el-icon-plus" @click="handlefieldCreate"
|
||||||
>新增</el-button>
|
>新增</el-button>
|
||||||
<el-table
|
<el-table
|
||||||
|
|
||||||
:data="fieldList.results"
|
:data="fieldList.results"
|
||||||
border
|
border
|
||||||
fit
|
fit
|
||||||
|
@ -113,9 +108,7 @@
|
||||||
highlight-current-row
|
highlight-current-row
|
||||||
height="100"
|
height="100"
|
||||||
v-el-height-adaptive-table="{bottomOffset: 50}"
|
v-el-height-adaptive-table="{bottomOffset: 50}"
|
||||||
|
|
||||||
>
|
>
|
||||||
|
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column label="字段类型">
|
<el-table-column label="字段类型">
|
||||||
<template slot-scope="scope">{{ options_[scope.row.field_type] }}</template>
|
<template slot-scope="scope">{{ options_[scope.row.field_type] }}</template>
|
||||||
|
@ -134,45 +127,28 @@
|
||||||
<el-table-column label="选项显示名">
|
<el-table-column label="选项显示名">
|
||||||
<template slot-scope="scope">{{ scope.row.field_choice }}</template>
|
<template slot-scope="scope">{{ scope.row.field_choice }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
align="center"
|
align="center"
|
||||||
label="操作"
|
label="操作"
|
||||||
|
|
||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
|
||||||
<el-link
|
<el-link
|
||||||
v-if="checkPermission(['material_update'])"
|
v-if="checkPermission(['material_update'])"
|
||||||
@click="handlefieldEdit(scope)"
|
@click="handlefieldEdit(scope)"
|
||||||
>编辑</el-link
|
>编辑</el-link>
|
||||||
>
|
|
||||||
<el-link
|
<el-link
|
||||||
v-if="checkPermission(['material_delete'])"
|
v-if="checkPermission(['material_delete'])"
|
||||||
type="danger"
|
type="danger"
|
||||||
@click="handlefieldDelete(scope)"
|
@click="handlefieldDelete(scope)"
|
||||||
>删除</el-link
|
>删除</el-link>
|
||||||
>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-dialog
|
<el-dialog :visible.sync="dialogVisible1" :title="dialogType1 === 'edit' ? '编辑表格字段' : '新增表格字段'">
|
||||||
:visible.sync="dialogVisible1"
|
<el-form ref="Form" :model="field" label-width="80px" label-position="right">
|
||||||
:title="dialogType1 === 'edit' ? '编辑表格字段' : '新增表格字段'"
|
|
||||||
>
|
|
||||||
<el-form
|
|
||||||
ref="Form"
|
|
||||||
:model="field"
|
|
||||||
label-width="80px"
|
|
||||||
label-position="right"
|
|
||||||
>
|
|
||||||
|
|
||||||
<el-form-item label="字段类型" prop="field_type">
|
<el-form-item label="字段类型" prop="field_type">
|
||||||
<el-select style="width: 100%" v-model="field.field_type" placeholder="请选择">
|
<el-select style="width: 100%" v-model="field.field_type" placeholder="请选择">
|
||||||
<el-option
|
<el-option
|
||||||
|
@ -184,36 +160,28 @@
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="字段标识" prop="field_key">
|
<el-form-item label="字段标识" prop="field_key">
|
||||||
<el-input v-model="field.field_key" placeholder="字段标识" />
|
<el-input v-model="field.field_key" placeholder="字段标识" onkeyup="value=value.replace(/[^A-Za-z_\/]/ig,'')"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="字段名称" prop="field_name">
|
<el-form-item label="字段名称" prop="field_name">
|
||||||
<el-input v-model="field.field_name" placeholder="字段名称" />
|
<el-input v-model="field.field_name" placeholder="字段名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="布尔类型显示名" prop="boolean_field_display">
|
<el-form-item label="选项" v-show="field.field_type=='radio'||field.field_type=='checkbox'||field.field_type=='select'||field.field_type=='selects'">
|
||||||
<vue-json-editor
|
<el-button @click.prevent="addDomain('1')" style="border: none;">
|
||||||
v-model="field.boolean_field_display"
|
<i class="el-icon-circle-plus-outline"></i>
|
||||||
:showBtns="false"
|
<span style="font-size:14px;">添加</span>
|
||||||
:mode="'code'"
|
</el-button>
|
||||||
lang="zh"
|
<el-row v-for="(domain, $index) in options" :key=domain+$index style="margin-bottom: 10px">
|
||||||
|
<el-col :span="20">
|
||||||
/>
|
<el-input v-model="options[$index]" auto-complete="off"></el-input>
|
||||||
</el-form-item>
|
</el-col>
|
||||||
<el-form-item label="选项" prop="field_choice">
|
<el-col :span="3" style="text-align: center" v-if="$index!==0">
|
||||||
|
<i class="el-icon-remove-outline" @click.prevent="removeDomain($index,'1')" style="color: red;font-size: 16px;"></i>
|
||||||
<vue-json-editor
|
</el-col>
|
||||||
v-model="field.field_choice"
|
</el-row>
|
||||||
:showBtns="false"
|
|
||||||
:mode="'code'"
|
|
||||||
lang="zh"
|
|
||||||
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="排序" prop="sort">
|
<el-form-item label="排序" prop="sort">
|
||||||
<el-input v-model="field.sort" placeholder="排序" />
|
<el-input-number v-model="field.sort" :min="1" placeholder="排序"></el-input-number>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<div style="text-align: right">
|
<div style="text-align: right">
|
||||||
<el-button type="danger" @click="dialogVisible1 = false">取消</el-button>
|
<el-button type="danger" @click="dialogVisible1 = false">取消</el-button>
|
||||||
|
@ -221,17 +189,14 @@
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
|
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getStep,getrecordformList,createrecordform,updaterecordform,deleterecordform,getrffieldList,createrffield,updaterffield,
|
import { getStep,getrecordformList,createrecordform,updaterecordform,deleterecordform,getrffieldList,createrffield,updaterffield,
|
||||||
deleterffield} from "@/api/mtm";
|
deleterffield} from "@/api/mtm";
|
||||||
|
// import vueJsonEditor from 'vue-json-editor'
|
||||||
import vueJsonEditor from 'vue-json-editor'
|
|
||||||
import checkPermission from "@/utils/permission";
|
import checkPermission from "@/utils/permission";
|
||||||
const defaultrecordform = {
|
const defaultrecordform = {
|
||||||
|
|
||||||
|
@ -240,12 +205,23 @@ const defaultfield = {
|
||||||
|
|
||||||
};
|
};
|
||||||
export default {
|
export default {
|
||||||
components: { vueJsonEditor },
|
name:'stepdo',
|
||||||
|
// components: { vueJsonEditor },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
step:"",
|
step:"",
|
||||||
recordform: defaultrecordform,
|
recordform: defaultrecordform,
|
||||||
field: defaultfield,
|
field: {
|
||||||
|
field_type:'',
|
||||||
|
field_key:'',
|
||||||
|
field_name:'',
|
||||||
|
sort:'',
|
||||||
|
field_choice:[],
|
||||||
|
},
|
||||||
|
date:'',
|
||||||
|
datetime:'',
|
||||||
|
time:'',
|
||||||
|
options:[''],
|
||||||
dialogType: "new",
|
dialogType: "new",
|
||||||
dialogVisible:false,
|
dialogVisible:false,
|
||||||
dialogType1: "new",
|
dialogType1: "new",
|
||||||
|
@ -266,36 +242,30 @@ export default {
|
||||||
},
|
},
|
||||||
options_: {
|
options_: {
|
||||||
'string':'字符串',
|
'string':'字符串',
|
||||||
'int':'整型',
|
'number':'数字',
|
||||||
'float': '浮点',
|
|
||||||
'boolean':'布尔',
|
|
||||||
'date': '日期',
|
'date': '日期',
|
||||||
'datetime': '日期时间',
|
'datetime': '日期时间',
|
||||||
'radio': '单选',
|
'radio': '单选',
|
||||||
'checkbox': '多选',
|
'checkbox': '多选',
|
||||||
'select': '单选下拉',
|
// 'select': '单选下拉',
|
||||||
'selects': '多选下拉',
|
// 'selects': '多选下拉',
|
||||||
'textarea': '文本域'
|
// 'textarea': '文本域'
|
||||||
},
|
},
|
||||||
fieldtypeoptions: [{
|
fieldtypeoptions: [{
|
||||||
value: 'string',
|
value: 'string',
|
||||||
label: '字符串'
|
label: '文字'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'int',
|
value: 'number',
|
||||||
label: '整型'
|
label: '数字'
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'float',
|
|
||||||
label: '浮点'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'boolean',
|
|
||||||
label: '布尔'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'date',
|
value: 'date',
|
||||||
label: '日期'
|
label: '日期'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'time',
|
||||||
|
label: '时间'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'datetime',
|
value: 'datetime',
|
||||||
|
@ -308,37 +278,31 @@ export default {
|
||||||
{
|
{
|
||||||
value: 'checkbox',
|
value: 'checkbox',
|
||||||
label: '多选'
|
label: '多选'
|
||||||
},
|
}
|
||||||
{
|
],
|
||||||
value: 'select',
|
|
||||||
label: '单选下拉'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'selects',
|
|
||||||
label: '多选下拉'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'textarea',
|
|
||||||
label: '文本域'
|
|
||||||
}],
|
|
||||||
typeoptions: [{
|
typeoptions: [{
|
||||||
value: 1,
|
value: 1,
|
||||||
label: '生产记录'
|
label: '生产记录'
|
||||||
}],
|
}]
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {},
|
computed: {},
|
||||||
watch: {},
|
watch: {},
|
||||||
created() {
|
created() {
|
||||||
|
|
||||||
this.getStepD();
|
this.getStepD();
|
||||||
this.recordformLists();
|
this.recordformLists();
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
//添加
|
||||||
|
addDomain() {
|
||||||
|
this.options.push('')
|
||||||
|
},
|
||||||
|
//删除
|
||||||
|
removeDomain(index){
|
||||||
|
this.options.splice(index, 1)
|
||||||
|
},
|
||||||
checkPermission,
|
checkPermission,
|
||||||
getStepD()
|
getStepD(){
|
||||||
{
|
|
||||||
getStep(this.$route.params.id).then((response) => {
|
getStep(this.$route.params.id).then((response) => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
this.step = response.data;
|
this.step = response.data;
|
||||||
|
@ -479,11 +443,11 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.field.form=this.formID
|
this.field.form=this.formID;
|
||||||
|
this.field.field_choice = this.options;
|
||||||
createrffield(this.field).then((res) => {
|
createrffield(this.field).then((res) => {
|
||||||
if (res.code >= 200) {
|
if (res.code >= 200) {
|
||||||
this.fieldLists()
|
this.fieldLists();
|
||||||
this.dialogVisible1 = false;
|
this.dialogVisible1 = false;
|
||||||
this.$message.success("成功");
|
this.$message.success("成功");
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {faceLogin} from "@/api/testModel";
|
||||||
// import "tracking/build/data/face-min.js";
|
// import "tracking/build/data/face-min.js";
|
||||||
// import "tracking/build/data/mouth-min.js";
|
// import "tracking/build/data/mouth-min.js";
|
||||||
// import "tracking/build/data/tracking-min.js";
|
// import "tracking/build/data/tracking-min.js";
|
||||||
|
@ -64,10 +65,19 @@
|
||||||
let canvas = document.getElementById("myCanvas");
|
let canvas = document.getElementById("myCanvas");
|
||||||
let context = canvas.getContext('2d');
|
let context = canvas.getContext('2d');
|
||||||
var video = document.getElementById("myVideo");
|
var video = document.getElementById("myVideo");
|
||||||
context.drawImage(video,0,0,this.videoWidth,this.videoHeight);
|
context.drawImage(video,0,0,90,68);
|
||||||
var image = new Image();
|
var image = new Image();
|
||||||
image = canvas.toDataURL('image/png');
|
image = canvas.toDataURL('image/png');
|
||||||
document.getElementById('res').innerHTML = '<img style="border: 1px solid #666666;" src="'+image+'">';
|
document.getElementById('res').innerHTML = '<img style="border: 1px solid #666666;" src="'+image+'">';
|
||||||
|
console.log(image);
|
||||||
|
debugger;
|
||||||
|
let imgData = {base64:image};
|
||||||
|
faceLogin(imgData).then((res) => {
|
||||||
|
if (res.code >= 200) {
|
||||||
|
debugger;
|
||||||
|
this.$message.success("成功");
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
// 关闭摄像头
|
// 关闭摄像头
|
||||||
closeCamera () {
|
closeCamera () {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<button @click="back()">回退</button>
|
<button @click="back()">回退</button>
|
||||||
<button @click="saveTu()">保存</button>
|
<button @click="saveTu()">保存</button>
|
||||||
<hr>
|
<hr>
|
||||||
<!--<img src="./../../assets/404_images/404.png">-->
|
<img id="canvasImg" src="./../../assets/404_images/404.png" style="display: none">
|
||||||
<div style="position: relative;">
|
<div style="position: relative;">
|
||||||
<canvas id="canvas" width="700" height="500" >
|
<canvas id="canvas" width="700" height="500" >
|
||||||
您的浏览器不支持绘图,请升级或更换浏览器!
|
您的浏览器不支持绘图,请升级或更换浏览器!
|
||||||
|
@ -22,6 +22,7 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
let preDrawAry = [];
|
let preDrawAry = [];
|
||||||
|
let img = new Image();
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -38,19 +39,45 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted(){
|
mounted(){
|
||||||
|
let _this=this;
|
||||||
|
preDrawAry = [];
|
||||||
|
let canvas = document.getElementById('canvas');
|
||||||
this.canvas = document.getElementById('canvas');
|
this.canvas = document.getElementById('canvas');
|
||||||
this.ctx = this.canvas.getContext('2d');
|
this.ctx = canvas.getContext('2d');
|
||||||
this.myCanvas_rect = this.canvas.getBoundingClientRect();
|
this.myCanvas_rect = this.canvas.getBoundingClientRect();
|
||||||
this.Txt = document.getElementById('txt');
|
this.Txt = document.getElementById('txt');
|
||||||
this.word = document.getElementById('word');
|
this.word = document.getElementById('word');
|
||||||
this.widths = this.myCanvas_rect.width;
|
this.widths = this.myCanvas_rect.width;
|
||||||
this.heights = this.myCanvas_rect.height;
|
this.heights = this.myCanvas_rect.height;
|
||||||
|
setTimeout(function(){
|
||||||
|
_this.draw();
|
||||||
|
},1000)
|
||||||
|
/*
|
||||||
|
this.ctx .clearRect(0, 0, 700, 500);
|
||||||
let imgs = new Image();
|
let imgs = new Image();
|
||||||
imgs.src = "./../../assets/404_images/404.png";
|
imgs.src ="./../../assets/404_images/404.png";
|
||||||
this.ctx.drawImage(imgs,0,0,this.widths,this.heights);
|
setTimeout(function(){
|
||||||
preDrawAry = [];
|
this.draw();
|
||||||
|
this.ctx.drawImage(imgs,0,0,700,500);
|
||||||
|
},1000)*/
|
||||||
|
/* imgs.onload=function(){
|
||||||
|
this.ctx.drawImage(imgs,0,0,700,500);
|
||||||
|
this.ctx.closePath();
|
||||||
|
|
||||||
|
let pattern=this.ctx.createPattern(imgs,"no-repeat")//不加;号
|
||||||
|
this.ctx.fillStyle=pattern;
|
||||||
|
this.ctx.fillRect(0,0,700,500);
|
||||||
|
}*/
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
draw(){
|
||||||
|
debugger;
|
||||||
|
let canvasImg = document.getElementById("canvasImg");
|
||||||
|
canvasImg.style.width = '700px';
|
||||||
|
canvasImg.style.height = '500px';
|
||||||
|
this.ctx.drawImage(canvasImg,0,0,700,500);
|
||||||
|
},
|
||||||
// 叉号
|
// 叉号
|
||||||
error1(){
|
error1(){
|
||||||
let canvas1 = document.getElementById('canvas');
|
let canvas1 = document.getElementById('canvas');
|
||||||
|
@ -58,7 +85,7 @@
|
||||||
this.Txt.style.display="none";
|
this.Txt.style.display="none";
|
||||||
this.word.style.display="none";
|
this.word.style.display="none";
|
||||||
ctx1.closePath();
|
ctx1.closePath();
|
||||||
this.canvas.onmousedown=function () {
|
canvas1.onmousedown=function () {
|
||||||
this.imgData= ctx1.getImageData(0,0,canvas1.width,canvas1.height);
|
this.imgData= ctx1.getImageData(0,0,canvas1.width,canvas1.height);
|
||||||
preDrawAry.push(this.imgData);
|
preDrawAry.push(this.imgData);
|
||||||
ctx1.beginPath();
|
ctx1.beginPath();
|
||||||
|
@ -67,7 +94,7 @@
|
||||||
ctx1.lineJoin="round";
|
ctx1.lineJoin="round";
|
||||||
};
|
};
|
||||||
//鼠标按下的位置
|
//鼠标按下的位置
|
||||||
this.canvas.onmouseup=function (ev) {
|
canvas1.onmouseup=function (ev) {
|
||||||
let oldX = ev.offsetX;
|
let oldX = ev.offsetX;
|
||||||
let oldY = ev.offsetY;
|
let oldY = ev.offsetY;
|
||||||
ctx1.moveTo(oldX,oldY);
|
ctx1.moveTo(oldX,oldY);
|
||||||
|
@ -139,9 +166,6 @@
|
||||||
preDrawAry.push(img);
|
preDrawAry.push(img);
|
||||||
ctx3.moveTo(oldX,oldY);
|
ctx3.moveTo(oldX,oldY);
|
||||||
ctx3.fillStyle="#e42343";
|
ctx3.fillStyle="#e42343";
|
||||||
// ctx3.fillText(v,oldX,oldY+10);
|
|
||||||
// this.canvasTextAutoLine(v,canvas3,oldX,oldY,20);
|
|
||||||
|
|
||||||
let lineWidth = 0;
|
let lineWidth = 0;
|
||||||
let canvasWidth = canvas3.width;
|
let canvasWidth = canvas3.width;
|
||||||
let lastSubStrIndex= 0;
|
let lastSubStrIndex= 0;
|
||||||
|
@ -198,7 +222,6 @@
|
||||||
this.word.style.display="none";
|
this.word.style.display="none";
|
||||||
this.Txt.style.display="none";
|
this.Txt.style.display="none";
|
||||||
if(preDrawAry.length>0) {
|
if(preDrawAry.length>0) {
|
||||||
// console.log(this.preDrawAry)
|
|
||||||
var popData = preDrawAry.pop();
|
var popData = preDrawAry.pop();
|
||||||
this.ctx.putImageData(popData, 0, 0);
|
this.ctx.putImageData(popData, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -211,9 +234,40 @@
|
||||||
|
|
||||||
//保存
|
//保存
|
||||||
saveTu(){
|
saveTu(){
|
||||||
|
let canvas = document.getElementById('canvas');
|
||||||
var image = new Image();
|
var image = new Image();
|
||||||
image = this.canvas.toDataURL('image/png');
|
image = canvas.toDataURL('image/png');
|
||||||
document.getElementById('res').innerHTML = '<img style="border: 1px solid #666666;" src="'+image+'">';
|
document.getElementById('res').innerHTML = '<img style="border: 1px solid #666666;" src="'+image+'">';
|
||||||
|
console.log(image);
|
||||||
|
debugger;
|
||||||
|
/*img.setAttribute('crossOrigin', 'Anonymous') ;// 解决某些图片跨域(有些图片仍不可使用)
|
||||||
|
img.src = 'url';
|
||||||
|
img.onload = (imgs) => {
|
||||||
|
let base64 = this.setBase64(imgs);
|
||||||
|
var arr = base64.split(',');
|
||||||
|
var mime = arr[0].match(/:(.*?);/)[1] ;// 获取图片的类型 (image/jpg)
|
||||||
|
var bstr = atob(arr[1]); // 将base64转码
|
||||||
|
var n = bstr.length ;// 获得转码长度
|
||||||
|
var u8arr = new Uint8Array(n); // 获得length个为0的数组
|
||||||
|
while (n--) {
|
||||||
|
u8arr[n] = bstr.charCodeAt(n) // 获得unicode码
|
||||||
|
}
|
||||||
|
this.file = new File([u8arr], 'faceImg', { type: mime }); // 生成文件
|
||||||
|
console.log(this.file);
|
||||||
|
this.url = base64
|
||||||
|
}*/
|
||||||
|
},
|
||||||
|
setBase64(img) {
|
||||||
|
let ctx = document.createElement('canvas');
|
||||||
|
const c = ctx.getContext('2d');
|
||||||
|
ctx.width = img.path[0].width;
|
||||||
|
ctx.height = img.path[0].height;
|
||||||
|
c.drawImage(img.path[0], 0, 0, img.path[0].width, img.path[0].height);
|
||||||
|
let ext = img.src
|
||||||
|
.substring(img.src.lastIndexOf('.') + 1)
|
||||||
|
.toLowerCase(); // 获取图片后缀
|
||||||
|
let url = ctx.toDataURL(`image/${ext}`);
|
||||||
|
return url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue