当前位置: 首页 > news >正文

自动发卡网站怎么做如何设计一个网页存放自己的作品

自动发卡网站怎么做,如何设计一个网页存放自己的作品,上海网站建设行业,找公司做网站要注意什么目录 第一章 效果展示 第二章 准备工作 2.1 使用的工具vue-sign 2.1.1 安装 2.1.2 了解 2.1.3 参数说明 第三章 源代码 第一章 效果展示 第二章 准备工作 2.1 使用的工具vue-esign 2.1.1 安装 npm install vue-esign --save 2.1.2 了解 兼容pc端和移动端有对应的参…

目录

第一章 效果展示

第二章 准备工作

2.1 使用的工具vue-sign

2.1.1 安装

2.1.2 了解

2.1.3 参数说明

第三章 源代码

第一章 效果展示

第二章 准备工作

2.1 使用的工具vue-esign

2.1.1 安装

npm install vue-esign --save

2.1.2 了解

  • 兼容pc端和移动端
  • 有对应的参数让我们自定义画布尺寸(导出图尺寸),画笔粗细、颜色,画布背景色
  • 能支持裁剪,在画布设定尺寸基础上裁掉四周空白部分

2.1.3 参数说明

属性类型默认值说明
widthNumber800画布宽度,即导出图片的宽度
heightNumber300画布高度,即导出图片的高度
lineWidthNumber4画笔粗细
lineColorString#000000画笔颜色
bgColorString画布背景色,为空时画布背景透明,
支持多种格式 '#ccc','#E5A1A1','rgb(229, 161, 161)','rgba(0,0,0,.6)','red'
isCropBooleanfalse是否裁剪,在画布设定尺寸基础上裁掉四周空白部分

第三章 源代码

  • 父组件
<el-col :span="13"><el-form-item label="被调查者签名" prop="respondentSign" :rules="[{type: 'string',required: true,message: '被调查者请签名',trigger: ['change']}]"><div @click="signreVisible=true" style="width: 400px;height: 150px;background-color: #d9d9d9;"><el-image :src="inputForm.respondentSign"style="width: 400px;height: 150px;display: flex;align-items: center;justify-content: center;color: #999;"><div slot="error" >点击签名</div></el-image></div></el-form-item>
</el-col>
<!--引用封装好的组件--->
<el-dialog title="被调查者签字" :visible.sync="signreVisible" width="700px"><sign @setsignin="setsignre"></sign>
</el-dialog>
<!---封装好的组件可以复用了-->
<el-dialog title="调查者签字" :visible.sync="signinVisible" width="700px"><sign @setsignin="setsignin"></sign>
</el-dialog>// 引入自定义封装的组件
import sign from './component/sign.vue'signreVisible: false,
inputForm:{respondentSign = ''
}// 被调查者签字图片,获取子组件传的值
setsignre (img) {this.inputForm.respondentSign = imgthis.signreVisible = false
},
  • 子组件
<template><div><el-card class="qianming-container" body-style="padding:0px"><!---vue-esign组件--><vue-esignref="esign":isCrop="isCrop":width="600":height="300":lineWidth="lineWidth":lineColor="lineColor":format="'image/png'":bgColor.sync="bgColor"></vue-esign><div class="contro-container"><el-button type="danger" @click="handleReset">清空画板</el-button><el-button type="primary" @click="handleGenerate">确认签名</el-button></div></el-card></div>
</template><script>
// 引入组件
import vueEsign from 'vue-esign'
// 这个是请求文件路径的接口
import fileService from '@/api/file/fileService.js'
export default {components: { vueEsign },name: 'sign',data () {return {lineWidth: 6,lineColor: '#000000',bgColor: '',resultImg: '',isCrop: false}},methods: {// 清空画板..handleReset () {this.$refs.esign.reset()this.resultImg = ''},// 生成签名图片..handleGenerate () {this.$refs['esign'].generate().then((res) => {this.resultImg = res // 得到了签字生成的base64图片// console.log('resultImg', this.resultImg)// 这里直接传base64到父组件,然后在父组件处理数据调用接口// this.$emit('setsignin', res)// 也可以转换成在线地址const bl = this.dataURLtoFile(res)let formData = new FormData()formData.append('file', bl, Date.now() + '.png')// console.log('file', formData.get('file'))// 接口请求fileService.upload(formData).then((result) => {// 向父组件传已经转好的地址this.$emit('setsignin', result.data)})}).catch((err) => {// 没有签名,点击生成图片时调用alert(err + ' 未签名!')})},// 将base64转成blob流dataURLtoFile (urlData) {const type = 'image/png'let bytes = nullif (urlData.split(',').length > 1) {bytes = window.atob(urlData.split(',')[1])} else {bytes = window.atob(urlData)}let ab = new ArrayBuffer(bytes.length)let ia = new Uint8Array(ab)for (let i = 0; i < bytes.length; i++) {ia[i] = bytes.charCodeAt(i)}return new Blob([ab], { type })}}
}
</script><style scoped>
button {height: 40px;
}
.contro-container {width: 600px;height: 50px;display: flex;flex-direction: row;align-items: center;justify-content: space-around;background-color: #d3d3d3;position: absolute;bottom: 0px;
}
.qianming-container {width: 600px;height: 350px;margin: 10px auto;position: relative;
}
.text {font-size: 14px;
}
.item {margin-bottom: 18px;
}
.clearfix:before,
.clearfix:after {display: table;content: '';
}
.clearfix:after {clear: both;
}
.box-card {width: 95%;margin-left: 2.5%;margin-top: 20px;
}
</style>

http://www.yayakq.cn/news/488777/

相关文章:

  • 在阿里国际站做的网站上海最近的新闻大事10条
  • 浙江做电缆桥架的公司网站网站设计维护内容
  • 织梦下载网站模板做自主外贸网站和后台费用多少
  • 深圳高端网站制作价格怎么用自己电脑做网站服务器吗
  • 自己做的网站 能收索么wordpress远程代码执行
  • 网站开发文档百度文库天津注册公司优惠政策
  • 漳州企业网站开发江西赣州网站
  • wordpress 神箭手网站改版seo方案
  • 素材网站设计模板海口模板建站平台
  • 天长网站seo老板办公室装修效果图
  • 网站类网站开发源代码网络舆情监测工作总结
  • 西部数码助手网站后台管理建站域名
  • 网站开发培训机构需要多少钱windows没有wordpress
  • 凡科建站源码成都旅游景点攻略自由行攻略
  • 网站如何提交给百度成都哪里好玩好吃
  • 网站建设与维护心得体会金融棋牌网站建设
  • 17一起做网站app去哪个网站做农产品推广
  • 网站管理程序北京外贸推广
  • 网页设计网站长沙温州建网站公司
  • 杭州网站建设(推荐乐云践新)制作企业网站要花多少钱
  • 湛江网站建设方案外包山西大同最新通告今天
  • 有没有免费的网站保定最大的网络公司
  • 网站建设与软件开发哪个好赚钱国际外贸网站建设
  • 网站模板下载地址ftps 网站怎么做
  • 网站开发大公司需要资格证吗html 路径 网站根路径
  • 如何做网站推广私人建设银行手机银行官方网站
  • 专业做房地产网站建设wordpress 生成目录
  • 建设一个私人视频网站个人网站做什么资源赚钱
  • 帝国cms添加网站地图企业年金退休后是一次性领取还是按月领取
  • 电脑做网站主机空间企业宣传网站建设模板