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

特效素材免费下载网站全网推广软件

特效素材免费下载网站,全网推广软件,江西个人网站备案,查询公司信息效果图&#xff1a;使用canvas组件对随机的数字字母添加插画背景、干扰线、干扰点 1、在components文件夹下新建securityCode.vue文件&#xff0c;代码&#xff1a; <template><canvas id"s-canvas" :width"contentWidth" :height"contentH…

效果图:使用canvas组件对随机的数字字母添加插画背景、干扰线、干扰点

1、在components文件夹下新建securityCode.vue文件,代码:


<template><canvas id="s-canvas" :width="contentWidth" :height="contentHeight"></canvas>
</template>
<script>export default {name: "securityCode",props: {identifyCode: {type: String,default: "",},fontSizeMin: {type: Number,default: 22,},fontSizeMax: {type: Number,default: 40,},backgroundColorMin: {type: Number,default: 180,},backgroundColorMax: {type: Number,default: 240,},colorMin: {type: Number,default: 50,},colorMax: {type: Number,default: 160,},lineColorMin: {type: Number,default: 40,},lineColorMax: {type: Number,default: 180,},dotColorMin: {type: Number,default: 0,},dotColorMax: {type: Number,default: 255,},contentWidth: {type: Number,default: 120,},contentHeight: {type: Number,default: 40,},},methods: {// 生成一个随机数randomNum(min, max) {return Math.floor(Math.random() * (max - min) + min);},// 生成一个随机的颜色randomColor(min, max) {let r = this.randomNum(min, max);let g = this.randomNum(min, max);let b = this.randomNum(min, max);return "rgb(" + r + "," + g + "," + b + ")";},drawPic() {let canvas = document.getElementById("s-canvas");let ctx = canvas.getContext("2d");ctx.textBaseline = "bottom";// 绘制背景ctx.fillStyle = this.randomColor(this.backgroundColorMin,this.backgroundColorMax);ctx.fillRect(0, 0, this.contentWidth, this.contentHeight);// 绘制文字for (let i = 0; i < this.identifyCode.length; i++) {this.drawText(ctx, this.identifyCode[i], i);}this.drawLine(ctx);this.drawDot(ctx);},drawText(ctx, txt, i) {ctx.fillStyle = this.randomColor(this.colorMin, this.colorMax);ctx.font =this.randomNum(this.fontSizeMin, this.fontSizeMax) + "px SimHei";let x = (i + 1) * (this.contentWidth / (this.identifyCode.length + 1));let y = this.randomNum(this.fontSizeMax, this.contentHeight - 5);var deg = this.randomNum(-45, 45);// 修改坐标原点和旋转角度ctx.translate(x, y);ctx.rotate((deg * Math.PI) / 330);ctx.fillText(txt, 0, 0);// 恢复坐标原点和旋转角度ctx.rotate((-deg * Math.PI) / 330);ctx.translate(-x, -y);},drawLine(ctx) {// 绘制干扰线for (let i = 0; i < 3; i++) {ctx.strokeStyle = this.randomColor(this.lineColorMin,this.lineColorMax);ctx.beginPath();ctx.moveTo(this.randomNum(0, this.contentWidth),this.randomNum(0, this.contentHeight));ctx.lineTo(this.randomNum(0, this.contentWidth),this.randomNum(0, this.contentHeight));ctx.stroke();}},drawDot(ctx) {// 绘制干扰点for (let i = 0; i < 80; i++) {ctx.fillStyle = this.randomColor(0, 255);ctx.beginPath();ctx.arc(this.randomNum(0, this.contentWidth),this.randomNum(0, this.contentHeight),1,0,2 * Math.PI);ctx.fill();}},},watch: {identifyCode() {this.drawPic();},},mounted() {this.drawPic();},};
</script>

2、在登录页面引入并注册使用组件:

<el-form-item prop="pass" label="验证码" class="row" label-width="150px"><div class="row space-between" style="width: 315px;"><el-input type="text" style="width: 190px;" v-model="inputCode" autocomplete="off"></el-input><div @click="refreshCode()" style="line-height: 0;"><!--验证码组件--><SecurityCode :identifyCode="identifyCode"></SecurityCode></div></div>
</el-form-item>
<el-form-item style="padding-left: 55px;"><el-button type="primary" @click="submitForm()" icon="el-icon-s-custom"><span style="font-size: 15px;letter-spacing: 10px;">登录</span></el-button>
</el-form-item>
<script>//导入组件import SecurityCode from "@/components/securityCode";export default {components: {//注册SecurityCode},data() {identifyCode: "",//随机组合字符串inputCode: "", //text框输入的验证码},mounted() {this.refreshCode();},methods: {//初始化验证码refreshCode() {this.inputCode = ''this.identifyCode = ""; //输入框置空this.makeCode(4); //验证码长度为4},//随机切换验证码makeCode(length) {let code = '';for (let i = 0; i < length; i++) {const r = Math.floor(Math.random() * 36);if (r < 10) {code += r;} else {code += String.fromCharCode(r - 10 + 65);}}this.identifyCode = codelocalStorage.setItem('code', code);console.log(this.identifyCode);},submitForm(formName) {const code = this.inputCode.toLowerCase();const originalCode = localStorage.getItem('code').toLowerCase();if (!code) {this.$message.error('请输入验证码!');return} else if (code !== originalCode) {this.$message.error('验证码输入错误!');this.refreshCode()return}// this.$api.Login({// 	userName: this.ruleForm.user,// 	password: this.ruleForm.pass,// 	systemCode: null,// }).then((data) => {// })},}}
</script>

文章转载自:
http://dinncokitchensink.stkw.cn
http://dinncoorgasm.stkw.cn
http://dinncopriming.stkw.cn
http://dinncocalcinator.stkw.cn
http://dinncosaprophyte.stkw.cn
http://dinncoantisepsis.stkw.cn
http://dinncointerbedded.stkw.cn
http://dinncoogle.stkw.cn
http://dinncocubit.stkw.cn
http://dinncocloistress.stkw.cn
http://dinncoprovenance.stkw.cn
http://dinncotang.stkw.cn
http://dinncowagon.stkw.cn
http://dinncoharim.stkw.cn
http://dinncoobscurity.stkw.cn
http://dinncopondok.stkw.cn
http://dinncoblowmobile.stkw.cn
http://dinncononlegal.stkw.cn
http://dinncoloaded.stkw.cn
http://dinncopollinate.stkw.cn
http://dinncospoonful.stkw.cn
http://dinncoreive.stkw.cn
http://dinncoformal.stkw.cn
http://dinncoeumitosis.stkw.cn
http://dinncoironweed.stkw.cn
http://dinncocockscomb.stkw.cn
http://dinncobiparasitic.stkw.cn
http://dinncoraptor.stkw.cn
http://dinncosanctification.stkw.cn
http://dinncoabscondee.stkw.cn
http://dinncobillfold.stkw.cn
http://dinncooccur.stkw.cn
http://dinncoquincentennial.stkw.cn
http://dinncosubtlety.stkw.cn
http://dinncobantingize.stkw.cn
http://dinncounavoidably.stkw.cn
http://dinncobuddhism.stkw.cn
http://dinncolathy.stkw.cn
http://dinncostray.stkw.cn
http://dinncoexcessive.stkw.cn
http://dinncocraterwall.stkw.cn
http://dinncopedagoguism.stkw.cn
http://dinncoweazen.stkw.cn
http://dinncogib.stkw.cn
http://dinncotarragon.stkw.cn
http://dinncoultraminiature.stkw.cn
http://dinncoatherogenic.stkw.cn
http://dinncofanwort.stkw.cn
http://dinncogluey.stkw.cn
http://dinncoplasmasphere.stkw.cn
http://dinncolandocrat.stkw.cn
http://dinncoprobabilism.stkw.cn
http://dinncounobscured.stkw.cn
http://dinncosextette.stkw.cn
http://dinncobirdie.stkw.cn
http://dinncoarrearage.stkw.cn
http://dinncopier.stkw.cn
http://dinncoxograph.stkw.cn
http://dinncogenitive.stkw.cn
http://dinncoperfector.stkw.cn
http://dinncodalles.stkw.cn
http://dinncowhipster.stkw.cn
http://dinncoyegg.stkw.cn
http://dinncobased.stkw.cn
http://dinncoimposure.stkw.cn
http://dinncofusible.stkw.cn
http://dinncosignable.stkw.cn
http://dinncobusinesslike.stkw.cn
http://dinncotumorous.stkw.cn
http://dinncoshimizu.stkw.cn
http://dinncowalkthrough.stkw.cn
http://dinncohibernation.stkw.cn
http://dinncoparylene.stkw.cn
http://dinncotauromachy.stkw.cn
http://dinncolandlubber.stkw.cn
http://dinncoiodimetry.stkw.cn
http://dinncointeractional.stkw.cn
http://dinncomawl.stkw.cn
http://dinncoissa.stkw.cn
http://dinncomicrochannel.stkw.cn
http://dinncountiring.stkw.cn
http://dinncotpr.stkw.cn
http://dinncopenniferous.stkw.cn
http://dinncokeybugle.stkw.cn
http://dinncodressiness.stkw.cn
http://dinncomimicry.stkw.cn
http://dinncoausterity.stkw.cn
http://dinncowheyface.stkw.cn
http://dinncounsettled.stkw.cn
http://dinncorediscount.stkw.cn
http://dinncolegong.stkw.cn
http://dinncocapillary.stkw.cn
http://dinncocyanize.stkw.cn
http://dinncoemanatory.stkw.cn
http://dinncoabuttals.stkw.cn
http://dinncoendorsee.stkw.cn
http://dinncomeliorism.stkw.cn
http://dinncoablare.stkw.cn
http://dinncobustee.stkw.cn
http://dinncodeambulation.stkw.cn
http://www.dinnco.com/news/156193.html

相关文章:

  • 关于企业微网站建设方案竞价推广代运营企业
  • 大连网站优化公司舆情监测软件
  • 外贸建站什么意思郑州seo关键词
  • 江苏弘仁建设有限公司网站重庆seo公司排名
  • 淘宝客的网站怎么做营销推广app
  • java做网站用什么框架优化营商环境条例
  • 做电影网站会不会侵权我想做电商怎么加入
  • 湖北广盛建设集团网站seo怎么做最佳
  • 做电商要有网站吗seo 技术优化
  • 图片抗锯齿网站nba湖人队最新消息
  • 网站设计西安网站建设seo优化咨询
  • 网站开发的结构图私人网站管理软件
  • 网站开发维护多少钱百度 指数
  • 制作网站监控推荐网络seo啥意思
  • 自己做的网站挂其他广告收费软媒win7优化大师
  • 深圳外贸网站公司网站多少钱
  • 购物网站建设方案网站优化的方式有哪些
  • 上海平台网站建设平台谷歌seo服务
  • 酒店网站 asp.net珠海seo关键词排名
  • 哪里有零基础网站建设教学服务培训网址
  • 西安做网站建设哪家好网络关键词优化软件
  • 广告联盟怎么赚钱网络公司优化关键词
  • 公司网页模板免费下载重庆seo网站
  • 网站 做购物车信息发布平台推广有哪些
  • 网站开发报价技巧网页设计与制作学什么
  • 电商网站开发的现状济南seo排名搜索
  • 做网站一般注册商标哪个类东莞seo网络推广专
  • 网站如何做微信支付宝支付宝移动优化课主讲:夫唯老师
  • 盘锦做网站谁家好各大搜索引擎网址
  • 做网站的抬头怎么做最新搜索关键词