基于ruoyi-app的手机短信登录(uniapp)
本篇用于记录h5的框架搭建
组件地址:短信验证码登陆,手机号,验证码倒计时 - DCloud 插件市场
调整后的表单组件代码:
<template><view class="login-view"><!-- <input type="tel" confirm-type="确认" class="input" v-model="phoneNum" placeholder="请输入手机号" /> --><!-- <view class="input-w-view"><input class="input-w" confirm-type="确认" type="number" v-model="smsCode" placeholder="请输入验证码" /><view @click="sendMsg" class="code-view">{{codeViewMsg}}</view></view> --><view class="input-item flex align-center"><view class="iconfont icon-user icon"></view><input v-model="phoneNum" class="input" type="text" placeholder="请输入手机号" maxlength="30" /></view><view class="input-item flex align-center" style="width: 60%;margin: 0px;"><view class="iconfont icon-code icon"></view><input v-model="smsCode" type="number" class="input" placeholder="请输入验证码" maxlength="10" /><view class="login-code"><view @click="sendMsg" class="login-code-btn">{{codeViewMsg}}</view></view></view><view class="action-btn"><button @click="userLogin" type="primary" :disabled="btnDisabled"class="login-btn cu-btn block bg-blue lg round">登录</button></view></view>
</template><script>export default {name: "jump-login",props: ['smsCall', 'loginCall'],data() {return {styles: {color: '#000000',borderColor: '#ffffff',backgroupColor: '#ffffff'},codeViewMsg: "获取验证码",countDown: 61,dbClick: false,btnDisabled: true,hasGetCode: false,phoneNum: '13488888888',smsCode: ''};},methods: {sendMsg() {const that = this;if (this.hasGetCode) returnif (this.phoneNum == '' || this.phoneNum == undefined) {uni.showToast({icon: 'none',title: "请先输入手机号"})return;}if (this.dbClick) return;this.dbClick = true;setTimeout(() => {this.dbClick = false;}, 500)if (!this.validatePhoneNumber(that.phoneNum)) {uni.showToast({icon: "none",title: "手机号码格式有误!"})return;}//短信发送this.$emit('smsCall', () => {that.countDown--;that.codeViewMsg = "重新获取(" + this.countDown + "s)"that.countDownData();});},userLogin() {const that = this;if (this.phoneNum == '' || this.phoneNum == undefined) {uni.showToast({icon: 'none',title: "手机号不能为空!"})return;}if (!this.validatePhoneNumber(that.phoneNum)) {uni.showToast({icon: "none",title: "手机号码格式有误!"})return;}const sD = {"phoneNum": that.phoneNum,"smsCode": that.smsCode};console.log(sD);this.$emit('loginCall', sD);},validatePhoneNumber(phoneNumber) {// 使用正则表达式匹配手机号码的格式var pattern = /^1[3456789]\d{9}$/;// 验证手机号码是否符合格式要求if (pattern.test(phoneNumber)) {return true; // 手机号码格式正确} else {return false; // 手机号码格式不正确}},countDownData() {this.btnDisabled = false;this.hasGetCode = truesetTimeout(() => {this.countDown--;this.codeViewMsg = "重新获取(" + this.countDown + "s)"if (this.countDown <= 0) {this.countDown = 61;this.codeViewMsg = "获取验证码";this.hasGetCode = falsereturn}this.countDownData();}, 1000)},}}
</script><style lang="scss">uni-input {box-sizing: unset;}.login-form-content {text-align: center;margin: 20px auto;margin-top: 15%;width: 80%;.input-item {margin: 20px auto;background-color: #f5f6f7;height: 45px;border-radius: 20px;.icon {font-size: 38rpx;margin-left: 10px;color: #999;}.input {width: 100%;font-size: 14px;line-height: 20px;text-align: left;padding-left: 15px;}}.login-btn {margin-top: 40px;height: 45px;}.reg {margin-top: 15px;}.xieyi {color: #333;margin-top: 20px;}.login-code {height: 38px;float: right;.login-code-btn {height: 38px;position: absolute;margin-left: 10px;width: 200rpx;display: flex;justify-content: center;align-items: center;background-color: #0c7bf3;color: #fff;border-radius: 20px}}}
</style>
登录页引用:
<template><view class="normal-login-container"><view class="logo-content align-center justify-center flex"><image style="width: 100rpx;height: 100rpx;" :src="globalConfig.appInfo.logo" mode="widthFix"></image><text class="title">若依移动端登录</text></view><view class="login-form-content"><jump-login @smsCall="smsCall" @loginCall="loginCall"></jump-login><view class="login-code"><image :src="codeUrl" @click="getCode" class="login-code-img"></image></view></view></view></template><script>import {getCodeImg} from '@/api/login'export default {data() {return {codeUrl: "",captchaEnabled: true,// 用户注册开关register: false,globalConfig: getApp().globalData.config,loginForm: {username: "admin",password: "admin123",phoneNum: '',code: "",uuid: ''}}},created() {this.getCode()},methods: {smsCall(opm) {//todo 发送短信console.log("发送短信验证码");opm();this.getCode()},loginCall(ops) {this.loginForm.phoneNum = ops.phoneNumthis.loginForm.code = ops.smsCodethis.handleLogin()console.log("登录", ops)},// 隐私协议handlePrivacy() {let site = this.globalConfig.appInfo.agreements[0]this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`)},// 用户协议handleUserAgrement() {let site = this.globalConfig.appInfo.agreements[1]this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`)},// 获取图形验证码getCode() {getCodeImg().then(res => {this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabledif (this.captchaEnabled) {this.codeUrl = 'data:image/gif;base64,' + res.imgthis.loginForm.uuid = res.uuid}})},// 登录方法async handleLogin() {if (this.loginForm.phoneNum === "") {this.$modal.msgError("请输入您的手机号")} else if (this.loginForm.username === "") {this.$modal.msgError("请输入您的账号")} else if (this.loginForm.password === "") {this.$modal.msgError("请输入您的密码")} else if (this.loginForm.code === "" && this.captchaEnabled) {this.$modal.msgError("请输入验证码")} else {this.$modal.loading("登录中,请耐心等待...")this.pwdLogin()}},// 密码登录async pwdLogin() {console.log('this.loginForm', this.loginForm)this.$store.dispatch('Login', this.loginForm).then(() => {this.$modal.closeLoading()this.loginSuccess()}).catch(() => {if (this.captchaEnabled) {this.getCode()}})},// 登录成功后,处理函数loginSuccess(result) {// 设置用户信息this.$store.dispatch('GetInfo').then(res => {this.$tab.reLaunch('/pages/index')})}}}
</script><style lang="scss">page {background-color: #ffffff;}.login-form-content {text-align: center;margin: 20px auto;margin-top: 15%;width: 80%;.input-item {margin: 20px auto;background-color: #f5f6f7;height: 45px;border-radius: 20px;.icon {font-size: 38rpx;margin-left: 10px;color: #999;}.input {width: 100%;font-size: 14px;line-height: 20px;text-align: left;padding-left: 15px;}}.login-btn {margin-top: 40px;height: 45px;}.reg {margin-top: 15px;}.xieyi {color: #333;margin-top: 20px;}}
</style>
相关文章:
基于ruoyi-app的手机短信登录(uniapp)
本篇用于记录h5的框架搭建 组件地址:短信验证码登陆,手机号,验证码倒计时 - DCloud 插件市场 调整后的表单组件代码: <template><view class"login-view"><!-- <input type"tel" confirm-type"确认"…...
机器学习环境搭建
前言 个人笔记,记录框架和小问题,没有太详细记载。。 1、Anaconda安装 下载地址: Free Download | Anaconda (慢) 国内镜像:https://link.csdn.net/?targethttp%3A%2F%2Fitcxy.xyz%2F241.html 下载…...
2095.删除链表的中间节点
给你一个链表的头节点 head 。删除链表的中间节点 ,并返回修改后的链表的头节点 head。 长度为 n 链表的中间节点是从头数起第 ⌊n / 2⌋ 个节点(下标从 0 开始),其中 ⌊x⌋ 表示小于或等于 x 的最大整数。 对于 n 1、2、3、4 和…...
Qt QML 坑
Qt QML 坑 QML Listview 1、不定高item 导致item重叠 ListView {id: _cityListViewproperty var _cityArray: [{ type:"A",cityArray:[]},{ type:"B",cityArray:[]},{ type:"C",cityArray:[]},{ type:"D",cityArray:[]}]model: List…...
Chrome浏览器web调试(js调试、css调试、篡改前置)
目录 1. 打开开发者工具(Dev Tool) 2. 打开命令菜单 截图 3. 面板介绍 4. CSS调试 右键检查快速到达元素处 查找DOM数 利用面板Console查找DOM节点 内置函数查找上一个选择点击的元素 5. 调试JS代码(Javascript调试) 日志调试 选择查看日志等级 眼睛观测变量 …...
【Java】Logbook优化接口调用日志输出,优雅!
logbook 简介 很多人可能没有接触过 logbook,但它的确是一个很好用的日志框架。引用官网的介绍 Logbook 是一个可扩展的 Java 库,可以为不同的客户端和服务器端技术启用完整的请求和响应日志记录。它通过以下方式满足了特殊需求: 允许 Web 应…...
LabVIEW电压电流实时监测系统
开发了一种基于LabVIEW和研华(Advantech)数据采集卡的电压电流实时监测系统,通过高效的数据采集和处理,为工业和科研用户提供高精度、实时的电压电流监测解决方案。系统采用研华USB-4711A数据采集卡,结合LabVIEW编程环…...
骁龙相机拍照流程分析
和你一起终身学习,这里是程序员Android 经典好文推荐,通过阅读本文,您将收获以下知识点: 1.deliverInputEvent 拍照点击事件处理 2.submitRequestList Camera 提交拍照请求 3.createCaptureRequest 拍照请求帧数 骁龙相机通过binder 数据传输…...
sql-语句
文章目录 SQL语句的学习sql是什么sql的内置命令sql的种类sql mode库,表属性介绍:字符集,存储引擎列的数据类型:数字,字符串,时间列的约束DDL: 数据定义语言库表 Online DDL(ALGORITHM) *DML :数据操纵语言资…...
解决Vue3项目中跨域问题的步骤
决Vue3项目中跨域问题的步骤可以按照以下方式清晰地分点表示和归纳: 1. 使用代理服务器(Proxy) 步骤: 在Vue项目的根目录下找到或创建vue.config.js文件。在vue.config.js中配置devServer的proxy选项。设定需要代理的接口前缀&a…...
macos scroll direction
If there is no Trackpad option, we can change it in the Mouse option. How to Change the Scroll Direction on a Mac: 2 Ways...
Websocket实现方式二——注解方式
添加Websocket依赖 <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-websocket</artifactId> </dependency>根据ServerEndpoint注解注册Websocket Configuration public class AgentWsConfig …...
零基础开始学习鸿蒙开发-页面导航栏布局设计
目录 1.设定初始页(Idex.ets) 2.自定义首页组件 3.自定义发现页面组件 4.自定义设置页面组件 总结:主要是运用 了Tabs组件对导航栏进行布局,然后运用BottomTabBarStyle组件嵌套图标和文字,完成导航栏的制作。 1.设定初始页(Idex.ets) import {find}…...
【Hive中常见的优化手段----数据采集!Join 优化!Hive索引!数据倾斜!mapreduce本地模式!map和reduce数量调整!】
前言: 💞💞大家好,我是书生♡,今天主要和大家分享一下Hive中常见的优化手段----数据采集!常见的Join 优化有哪几种!什么是Hive索引!数据怎么发生倾斜!什么是mapreduce的本…...
【面试系列】软件工程师高频面试题及详细解答
欢迎来到我的博客,很高兴能够在这里和您见面!欢迎订阅相关专栏: ⭐️ 全网最全IT互联网公司面试宝典:收集整理全网各大IT互联网公司技术、项目、HR面试真题. ⭐️ AIGC时代的创新与未来:详细讲解AIGC的概念、核心技术、…...
Qt开发 | Qt界面布局 | 水平布局 | 竖直布局 | 栅格布局 | 分裂器布局 | setLayout使用 | 添加右键菜单 | 布局切换与布局删除重构
文章目录 一、Qt界面布局二、Qt水平布局--QHBoxLayout三、Qt竖直布局四、Qt栅格布局五、分裂器布局代码实现六、setLayout使用说明七、布局切换与布局删除重构1.如何添加右键菜单2.布局切换与布局删除重构 一、Qt界面布局 Qt的界面布局类型可分为如下几种 水平布局(…...
LW-DETR: A Transformer Replacement to YOLO for Real-Time Detection
LW-DETR: A Transformer Replacement to YOLO for Real-Time Detection 论文链接:http://arxiv.org/abs/2406.03459 代码链接:https://github.com/Atten4Vis/LW-DETR 一、摘要 介绍了一种轻量级检测变换器LWDETR,它在实时物体检测方面超越…...
前端技术(二)——javasctipt 介绍
一、javascript基础 1. javascript简介 ⑴ javascript的起源 ⑵ javascript 简史 ⑶ javascript发展的时间线 ⑷ javascript的实现 ⑸ js第一个代码 <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><title>…...
FireFox 编译指南2024 Windows10篇-环境准备(一)
1. 引言 在开源浏览器项目中,Firefox因其高性能和灵活性而备受开发者青睐。为了在本地环境中编译和定制Firefox,开发者需要做好充分的环境准备工作。这不仅是编译成功的基础,也是后续调试、优化和二次开发的关键步骤。 编译Firefox是一个复…...
Spring Boot中的热部署配置
Spring Boot中的热部署配置 大家好,我是免费搭建查券返利机器人省钱赚佣金就用微赚淘客系统3.0的小编,也是冬天不穿秋裤,天冷也要风度的程序猿!今天我们将探讨如何在Spring Boot项目中实现热部署配置,提升开发效率和项…...
避开这3个坑,你的夜间灯光数据(NPP/VIIRS)ANLI计算结果才准确
避开这3个坑,你的夜间灯光数据(NPP/VIIRS)ANLI计算结果才准确 深夜的城市灯光如同流动的星河,而NPP/VIIRS卫星捕捉的这些光点正成为区域经济研究的"新货币"。但当我第一次用ArcGIS计算昆明各区县的平均灯光指数&#x…...
网盘下载提速终极指南:9大平台直链获取工具完整教程
网盘下载提速终极指南:9大平台直链获取工具完整教程 【免费下载链接】Online-disk-direct-link-download-assistant 一个基于 JavaScript 的网盘文件下载地址获取工具。基于【网盘直链下载助手】修改 ,支持 百度网盘 / 阿里云盘 / 中国移动云盘 / 天翼云…...
从桌面玩具到生产力工具:Dobot Magician机械臂的5个超实用项目实战(含代码)
从桌面玩具到生产力工具:Dobot Magician机械臂的5个超实用项目实战(含代码) 在创客圈里积灰的Dobot Magician机械臂,可能正等待一次真正的觉醒。这款被许多人当作"高级玩具"的六轴机械臂,实际上隐藏着足以改…...
Web 安全深入审计检查清单
一、审计准备与范围界定 适用于渗透测试、安全评估及合规审计(如等保、ISO 27001):检查项具体内容授权确认获取书面授权书(RoE),明确测试时间、IP/域名范围、测试深度资产梳理主站、子域、API 端点、CDN、W…...
DOIP认知
1,概述 DOIP(Diagnostic communication over Internet Protocol)是基于以太网传输诊断数据的协议,规范于ISO13400标准。其核心功能是在TCP/IP协议栈之上构建诊断通信层,实现外部测试设备与车载网络之间的连接。 在ISO七…...
嘉兴看牙哪家靠谱?2026年本地6家口腔机构实测排行榜(纯生活体验版)
问这个问题的人,多半是被坑过、排过队、或者被推销烦过。作为一个在嘉兴生活了快十年的普通市民,补牙、洗牙、带孩子看牙都经历过,我也踩过不少坑。这次花了两周时间,跑了南湖、秀洲、平湖几家口碑还行的口腔机构,纯从…...
5分钟掌握RePKG:Wallpaper Engine资源提取与格式转换的终极秘籍
5分钟掌握RePKG:Wallpaper Engine资源提取与格式转换的终极秘籍 【免费下载链接】repkg Wallpaper engine PKG extractor/TEX to image converter 项目地址: https://gitcode.com/gh_mirrors/re/repkg 你是否曾经面对Wallpaper Engine中的PKG资源包感到无从下…...
大模型推理优化:从 KV Cache 到长上下文加速
为什么大模型“读文件”会越来越慢 很多人在使用大模型时都会有一个明显感受: 普通聊天时回复很快;但一旦输入几十页文档、长代码仓库、长上下文 Prompt;模型往往会“思考很久”才吐出第一个字。 但奇怪的是: 一旦第一个 Token 出…...
手机市场饱和下的细分突围:从功能过剩到场景化专用设备
1. 市场饱和与行业焦虑的根源手机销量下滑,这已经不是新闻,而是悬在所有制造商头顶的一把达摩克利斯之剑。当全球73亿人口中,手机用户数达到惊人的68亿时,市场饱和的警钟就已经敲响。这不是一个简单的周期性波动,而是整…...
终极指南:boardgame.io v0.50重大更新,打造更强大的回合制游戏框架
终极指南:boardgame.io v0.50重大更新,打造更强大的回合制游戏框架 【免费下载链接】boardgame.io State Management and Multiplayer Networking for Turn-Based Games 项目地址: https://gitcode.com/gh_mirrors/bo/boardgame.io boardgame.io是…...
