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

龙泉驿区建设局网站wordpress登陆不上

龙泉驿区建设局网站,wordpress登陆不上,公司宣传彩页设计模板,网站关键词优化推广哪家快安装插件 pnpm i identify --save图形验证码组件 templatediv classs-canvas!-- 图形验证码的宽和高都来自于父组件的传值#xff0c;若父组件没有传值#xff0c;那么就按当前子组件的默认值进行渲染 --canvas ids-canvastemplatediv classs-canvas!-- 图形验证码的宽和高都来自于父组件的传值若父组件没有传值那么就按当前子组件的默认值进行渲染 --canvas ids-canvas :widthprops.contentWidth :heightprops.contentHeight/canvas/div /templatescript setup import { onMounted, watch } from vue// 这里有很多属性值需要自定义什么值就在父组件传对应参数即可 const props defineProps({identifyCode: {type: String,default: 1234},fontSizeMin: {type: Number,default: 20},fontSizeMax: {type: Number,default: 35},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: 71},contentHeight: {type: Number,default: 28} })// 生成一个随机数 const randomNum (min, max) {return Math.floor(Math.random() * (max - min) min) }// 生成一个随机的颜色 const randomColor (min, max) {let r randomNum(min, max)let g randomNum(min, max)let b randomNum(min, max)return rgb( r , g , b ) }// 绘制干扰线 const drawLine (ctx) {for (let i 0; i 3; i) {ctx.strokeStyle randomColor(props.lineColorMin, props.lineColorMax)ctx.beginPath()ctx.moveTo(randomNum(0, props.contentWidth), randomNum(0, props.contentHeight))ctx.lineTo(randomNum(0, props.contentWidth), randomNum(0, props.contentHeight))ctx.stroke()} }const drawText (ctx, txt, i) {ctx.fillStyle randomColor(props.colorMin, props.colorMax)ctx.font randomNum(props.fontSizeMin, props.fontSizeMax) px SimHeilet x (i 1) * (props.contentWidth / (props.identifyCode.length 1))let y randomNum(props.fontSizeMax, props.contentHeight - 5)var deg randomNum(-45, 45)// 修改坐标原点和旋转角度ctx.translate(x, y)ctx.rotate((deg * Math.PI) / 180)ctx.fillText(txt, 0, 0)// 恢复坐标原点和旋转角度ctx.rotate((-deg * Math.PI) / 180)ctx.translate(-x, -y) }const drawDot (ctx) {// 绘制干扰点for (let i 0; i 30; i) {ctx.fillStyle randomColor(0, 255)ctx.beginPath()ctx.arc(randomNum(0, props.contentWidth), randomNum(0, props.contentHeight), 1, 0, 2 * Math.PI)ctx.fill()} }const drawPic () {let canvas document.getElementById(s-canvas)let ctx canvas.getContext(2d)ctx.textBaseline bottom// 绘制背景ctx.fillStyle randomColor(props.backgroundColorMin, props.backgroundColorMax)ctx.fillRect(0, 0, props.contentWidth, props.contentHeight)// 绘制文字for (let i 0; i props.identifyCode.length; i) {drawText(ctx, props.identifyCode[i], i)}drawLine(ctx)drawDot(ctx) }// newValue, oldValue watch(() props.identifyCode,() {drawPic()} )onMounted(() {drawPic() }) /script style scoped langscss .s-canvas {cursor: pointer; } /style 父组件中使用 html部分验证码输入框图形验证码提示 el-form-item proppasswordel-inputv-modelverificationCodeclasselinputplaceholder请输入验证码prefix-iconKey//el-form-itemdivstyletext-align: right;margin-top: -10px;margin-bottom: 10px;position: relative;height: 40px;clickrefreshCodediv styleposition: absolute; border-radius: 5px; left: 1pxrandomImage:identify-codeidentifyCode:content-width110:content-height40/randomImage/divdiv styleposition: absolute; left: 130px; bottom: -10pxp stylefont-size: 12px; color: #67c23a看不清点击图片可进行切换哦/p/div/divts部分引入组件对应参数定义登录验证 // 图形验证码 import randomImage from ./components/randomImage.vue // 验证码数字库 const identifyCodes 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ // 图形验证码图片中的验证码用于校验 const identifyCode ref() // 输入的验证码 const verificationCode ref()const randomNum (min: any, max: any) {return Math.floor(Math.random() * (max - min) min) }const makeCode (o: any, l: any) {for (let i 0; i l; i) {identifyCode.value o[randomNum(0, o.length)]} }const refreshCode () {identifyCode.value makeCode(identifyCodes, 4) }// 登录提交按钮所触发的事件;前端先校验无误后再走接口有错误则提示对应错误 const onSubmit (e: Event) {e.preventDefault()if (verificationCode.value identifyCode.value) {formRef.value?.validate((valid) {if (valid) {loading.value trueuserStore.login(form as any).then(() {ElMessage.success(登录成功)router.push(/workplace)}).finally(() {loading.value false})}})} else if (verificationCode.value ) {ElNotification({title: 小提示,message: 请输入验证码,type: warning})verificationCode.value refreshCode()} else {ElNotification({title: 小提示,message: 验证码输入错误请重新输入,type: error})verificationCode.value refreshCode()} }// 页面初始化时执行一次逻辑生成图形验证码 onMounted(() {identifyCode.value makeCode(identifyCodes, 4) })
http://www.w-s-a.com/news/402922/

相关文章:

  • 主题资源网站创建时 如何突出设计的特点阿里云是做网站的吗
  • 乌市建设工程质量监督站网站外资公司注册
  • 档案馆网站机房建设做游戏网站打鱼
  • 网站建设平台 创新模式搭建好ftp服务器 如何通过网站访问
  • 苏州集团网站制作设计网页制作软件ai
  • 网站建设新手教程视频教程手帐风格wordpress主题
  • 做投标网站条件网站更改指定字段
  • mvc5 网站开发之美做印刷网站公司
  • 医疗网站建设精英微信网站用什么制作的
  • 银川网站设计联系电话地推加人2元1个
  • 龙华网站 建设深圳信科北京知名的网站建设公司
  • 怎么做qq刷赞网站搜盘 资源网
  • 微网站怎么做的好名字吗陕西省医院网站建设管理
  • 泉州seo-泉州网站建设公司温州企业自助建站系统
  • 网站建设属于什么费网站建设网络推广
  • 德州网站开发人员网站怎么才能被百度收录
  • wordpress网站怎么加小游戏乐山网站制作公司
  • 企业购 网站建设做兼职有哪些网站
  • 湖州网站做等保费用大型网站建站
  • 优创智汇高端网站建设网站设计工作流程
  • 什么网站可以学做西餐个人网站怎么做支付功能
  • 千户微建站平台做网站需要切图吗
  • 织梦cms 学校网站模板网站建设中的问题
  • 山东济南网站建设公司制作wordpress模板教程视频教程
  • 档案网站的建设怎样更新网站内容
  • 网站开发项目规划房地产趋势与前景
  • 网上网站开发这个百度的网站怎么做的
  • 南昌市建设局官方网站网龙网络公司地址
  • 自助建站平台源码公司网站谁负责做
  • 旅游的网站怎么做网站流量的主要来源有