useragent识别访问设备

news2024/11/19 1:35:39

 背景需求

ruoyi框架,前后端分离。现在要在用户访问的时候根据不同的设备跳转到不同的登录页面。

教程

router/index.js

修改src/router/index.js,在这里增加自己的要跳转的页面

permission.js

在白名单中添加自己的登录页面

增加以下识别的代码

let flag = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)
      if (flag) {
        console.log('手机端');
        next(`/loginPhone?redirect=${to.fullPath}`)
      } else {
        console.log('pc端');
        next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
      }
      NProgress.done()

结束

-----华丽的分割线,以下是凑字数,大家不用花时间看,快去改代码-----

-----华丽的分割线,以下是凑字数,大家不用花时间看,快去改代码-----

-----华丽的分割线,以下是凑字数,大家不用花时间看,快去改代码-----

package cn.renkai721.bean.vo;
 
import lombok.extern.slf4j.Slf4j;
 
@Slf4j
public class MakeUpTheWordCount {
 
    private String make_up_the_word_count_column_999999999_1;
    private String make_up_the_word_count_column_999999999_2;
    private String make_up_the_word_count_column_999999999_3;
    private String make_up_the_word_count_column_999999999_4;
    private String make_up_the_word_count_column_999999999_5;
    private String make_up_the_word_count_column_999999999_6;
    private String make_up_the_word_count_column_999999999_7;
    private String make_up_the_word_count_column_999999999_8;
    private String make_up_the_word_count_column_999999999_9;
    private String make_up_the_word_count_column_999999999_10;
    private String make_up_the_word_count_column_999999999_11;
    private String make_up_the_word_count_column_999999999_12;
    private String make_up_the_word_count_column_999999999_13;
    private String make_up_the_word_count_column_999999999_14;
    private String make_up_the_word_count_column_999999999_15;
    private String make_up_the_word_count_column_999999999_16;
    private String make_up_the_word_count_column_999999999_17;
    private String make_up_the_word_count_column_999999999_18;
    private String make_up_the_word_count_column_999999999_19;
    private String make_up_the_word_count_column_999999999_20;
 
    public String getMake_up_the_word_count_column_999999999_1() {
        return make_up_the_word_count_column_999999999_1;
    }
 
    public void setMake_up_the_word_count_column_999999999_1(String make_up_the_word_count_column_999999999_1) {
        this.make_up_the_word_count_column_999999999_1 = make_up_the_word_count_column_999999999_1;
    }
 
    public String getMake_up_the_word_count_column_999999999_2() {
        return make_up_the_word_count_column_999999999_2;
    }
 
    public void setMake_up_the_word_count_column_999999999_2(String make_up_the_word_count_column_999999999_2) {
        this.make_up_the_word_count_column_999999999_2 = make_up_the_word_count_column_999999999_2;
    }
 
    public String getMake_up_the_word_count_column_999999999_3() {
        return make_up_the_word_count_column_999999999_3;
    }
 
    public void setMake_up_the_word_count_column_999999999_3(String make_up_the_word_count_column_999999999_3) {
        this.make_up_the_word_count_column_999999999_3 = make_up_the_word_count_column_999999999_3;
    }
 
    public String getMake_up_the_word_count_column_999999999_4() {
        return make_up_the_word_count_column_999999999_4;
    }
 
    public void setMake_up_the_word_count_column_999999999_4(String make_up_the_word_count_column_999999999_4) {
        this.make_up_the_word_count_column_999999999_4 = make_up_the_word_count_column_999999999_4;
    }
 
    public String getMake_up_the_word_count_column_999999999_5() {
        return make_up_the_word_count_column_999999999_5;
    }
 
    public void setMake_up_the_word_count_column_999999999_5(String make_up_the_word_count_column_999999999_5) {
        this.make_up_the_word_count_column_999999999_5 = make_up_the_word_count_column_999999999_5;
    }
 
    public String getMake_up_the_word_count_column_999999999_6() {
        return make_up_the_word_count_column_999999999_6;
    }
 
    public void setMake_up_the_word_count_column_999999999_6(String make_up_the_word_count_column_999999999_6) {
        this.make_up_the_word_count_column_999999999_6 = make_up_the_word_count_column_999999999_6;
    }
 
    public String getMake_up_the_word_count_column_999999999_7() {
        return make_up_the_word_count_column_999999999_7;
    }
 
    public void setMake_up_the_word_count_column_999999999_7(String make_up_the_word_count_column_999999999_7) {
        this.make_up_the_word_count_column_999999999_7 = make_up_the_word_count_column_999999999_7;
    }
 
    public String getMake_up_the_word_count_column_999999999_8() {
        return make_up_the_word_count_column_999999999_8;
    }
 
    public void setMake_up_the_word_count_column_999999999_8(String make_up_the_word_count_column_999999999_8) {
        this.make_up_the_word_count_column_999999999_8 = make_up_the_word_count_column_999999999_8;
    }
 
    public String getMake_up_the_word_count_column_999999999_9() {
        return make_up_the_word_count_column_999999999_9;
    }
 
    public void setMake_up_the_word_count_column_999999999_9(String make_up_the_word_count_column_999999999_9) {
        this.make_up_the_word_count_column_999999999_9 = make_up_the_word_count_column_999999999_9;
    }
 
    public String getMake_up_the_word_count_column_999999999_10() {
        return make_up_the_word_count_column_999999999_10;
    }
 
    public void setMake_up_the_word_count_column_999999999_10(String make_up_the_word_count_column_999999999_10) {
        this.make_up_the_word_count_column_999999999_10 = make_up_the_word_count_column_999999999_10;
    }
 
    public String getMake_up_the_word_count_column_999999999_11() {
        return make_up_the_word_count_column_999999999_11;
    }
 
    public void setMake_up_the_word_count_column_999999999_11(String make_up_the_word_count_column_999999999_11) {
        this.make_up_the_word_count_column_999999999_11 = make_up_the_word_count_column_999999999_11;
    }
 
    public String getMake_up_the_word_count_column_999999999_12() {
        return make_up_the_word_count_column_999999999_12;
    }
 
    public void setMake_up_the_word_count_column_999999999_12(String make_up_the_word_count_column_999999999_12) {
        this.make_up_the_word_count_column_999999999_12 = make_up_the_word_count_column_999999999_12;
    }
 
    public String getMake_up_the_word_count_column_999999999_13() {
        return make_up_the_word_count_column_999999999_13;
    }
 
    public void setMake_up_the_word_count_column_999999999_13(String make_up_the_word_count_column_999999999_13) {
        this.make_up_the_word_count_column_999999999_13 = make_up_the_word_count_column_999999999_13;
    }
 
    public String getMake_up_the_word_count_column_999999999_14() {
        return make_up_the_word_count_column_999999999_14;
    }
 
    public void setMake_up_the_word_count_column_999999999_14(String make_up_the_word_count_column_999999999_14) {
        this.make_up_the_word_count_column_999999999_14 = make_up_the_word_count_column_999999999_14;
    }
 
    public String getMake_up_the_word_count_column_999999999_15() {
        return make_up_the_word_count_column_999999999_15;
    }
 
    public void setMake_up_the_word_count_column_999999999_15(String make_up_the_word_count_column_999999999_15) {
        this.make_up_the_word_count_column_999999999_15 = make_up_the_word_count_column_999999999_15;
    }
 
    public String getMake_up_the_word_count_column_999999999_16() {
        return make_up_the_word_count_column_999999999_16;
    }
 
    public void setMake_up_the_word_count_column_999999999_16(String make_up_the_word_count_column_999999999_16) {
        this.make_up_the_word_count_column_999999999_16 = make_up_the_word_count_column_999999999_16;
    }
 
    public String getMake_up_the_word_count_column_999999999_17() {
        return make_up_the_word_count_column_999999999_17;
    }
 
    public void setMake_up_the_word_count_column_999999999_17(String make_up_the_word_count_column_999999999_17) {
        this.make_up_the_word_count_column_999999999_17 = make_up_the_word_count_column_999999999_17;
    }
 
    public String getMake_up_the_word_count_column_999999999_18() {
        return make_up_the_word_count_column_999999999_18;
    }
 
    public void setMake_up_the_word_count_column_999999999_18(String make_up_the_word_count_column_999999999_18) {
        this.make_up_the_word_count_column_999999999_18 = make_up_the_word_count_column_999999999_18;
    }
 
    public String getMake_up_the_word_count_column_999999999_19() {
        return make_up_the_word_count_column_999999999_19;
    }
 
    public void setMake_up_the_word_count_column_999999999_19(String make_up_the_word_count_column_999999999_19) {
        this.make_up_the_word_count_column_999999999_19 = make_up_the_word_count_column_999999999_19;
    }
 
    public String getMake_up_the_word_count_column_999999999_20() {
        return make_up_the_word_count_column_999999999_20;
    }
 
    public void setMake_up_the_word_count_column_999999999_20(String make_up_the_word_count_column_999999999_20) {
        this.make_up_the_word_count_column_999999999_20 = make_up_the_word_count_column_999999999_20;
    }
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1105855.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

F5负载均衡知多少?一文为你详细解读

在当今数字化时代,网络应用的可用性和性能对于企业的成功至关重要。而F5负载均衡技术则成为了许多企业实现高可用性和高性能的关键工具之一。那么什么是负载均衡,F5负载均衡有哪些强大的性能呢?跟上我的脚步一起来看看,充实你的知…

cbu和无cc的shiro反序列化

前置知识 学习CommonsBeanutils之前应该知道 javaBean,可以看《Java简单特性》也可以看这里有关BeanComparator的介绍TemplatesImpl gadget,前两个方法是public TemplatesImpl#getOutputProperties() -> TemplatesImpl#newTransformer() -> Tem…

用于细胞定位的指数距离变换图--Exponential Distance Transform Maps for Cell Localization

论文:Exponential Distance Transform Maps for Cell Localization Paper Link: Exponential Distance Transform Maps for Cell Localization Code(有EDT Map的生成方式): https://github.com/Boli-trainee/MHFAN 核…

2023.10.18 区别 对象 和 类对象

目录 对象 类对象 总结 对象 对象是类的实例化结果它是内存中的一块区域,包含了该类的属性和方法的具体值和实现对象具有唯一的标识、状态、行为通过创建类的实例,我们可以在程序中操作和处理具体的对象 简单实例 class Person {public int high 1…

ruoyi识别访问设备是pc端还是移动端跳转到对应的登录页面

背景需求 ruoyi框架,前后端分离。现在要在用户访问的时候根据不同的设备跳转到不同的登录页面。 教程 router/index.js 修改src/router/index.js,在这里增加自己的要跳转的页面 permission.js 在白名单中添加自己的登录页面 增加以下识别的代码 le…

6. 方法引用

我们在使用lambda时,如果方法体中只有一个方法的调用的话(包括构造方法),我们可以用方法引用进一步简化代码。 6.1 推荐用法 我们在使用lambda时不需要考虑什么时候用方法引用,用哪种方法引用,方法引用的格式是什么。…

java正则校验金额

整数位5位 小数位4位 public static boolean judgeTwoDecimalFour(Object obj) {boolean flag false;try {if (obj ! null) {String source obj.toString();// 判断是否是整数或者是携带一位或者两位的小数Pattern pattern Pattern.compile("^[]?([0-9]{1,5}(.[0-9]{1…

【数字人】4、RAD-NeRF | 通过解耦 audio-spatial 编码来实现基于 NeRF 的高效数字人合成

文章目录 一、背景二、方法2.1 问题定义2.2 Decomposed audio-spatial encoding module2.3 Pseudo-3D Deformable Module 用于控制 torso2.4 训练细节 三、效果3.1 实验设置3.2 对比 论文:Real-time Neural Radiance Talking Portrait Synthesis via Audio-spatial …

【前端学习】—变量类型和计算(五)

【前端学习】—变量类型和计算(五) 一、JS中使用typeof能得到哪些类型 字符串(String):表示文本数据,用单引号或双引号括起来。 数字(Number):表示数值数据,包括整数和浮点数。 布尔值(Boolean):表示真或假(true或false)的逻辑值。 空值(Null):表示一个空…

echarts的markline警标线(一条/多条)的使用

echarts之markLine(可以设置特定阈值线(警戒线)) 一条线写法 series: [{name: Fake Data,type: line,showSymbol: false,data: data,markLine: {symbol: [none, none], // 去掉箭头label: {show: false,position: start,formatter: {b}},data: [{name: 阈值,yAxis: 200}],line…

[备忘]WindowsLinux上查看端口被什么进程占用|端口占用

Windows上 查看端口占用&#xff1a; netstat -aon|findstr <端口号> 通过进程ID查询进程信息 tasklist | findstr <上一步查出来的进程号> 图例&#xff1a; Linux 上 查看端口占用&#xff1a; netstat -tuln | grep <端口号> lsof -i:<端口号&…

Canvas绘图学习笔记:画笔的路径与状态

beginPath beginPath表示开始一个路径&#xff0c;我们在上一章画弧的时候用到过好多次&#xff0c;他的API非常简单&#xff1a; context.beginPath(); 开始路径有2层意思&#xff0c;一个就是本次绘制的起点是新的&#xff08;不再是上次结束的点了&#xff09;&#xff0…

诈骗分子投递“大闸蟹礼品卡”,快递公司如何使用技术手段提前安全预警?

目录 快递公司能不能提前识别&#xff1f; 如何通过技术有效识别 为即将带来的双十一提供安全预警 金秋十月&#xff0c;正是品尝螃蟹的季节。中秋国庆长假也免不了走亲访友&#xff0c;大闸蟹更是成了热门礼品。10月7日&#xff0c;演员孙艺洲发布微博称&#xff0c;“收到…

优思学院|质量保证是什么?提高产品和服务质量的关键方法

在当今竞争激烈的市场中&#xff0c;企业需要确保他们的产品和服务能够满足客户的期望。质量保证是实现这一目标的关键。本文将探讨质量保证的重要性&#xff0c;以及提高产品和服务质量的方法。 1. 了解质量保证的概念 质量保证是指一系列的活动和措施&#xff0c;旨在确保产…

STM32 裸机编程 03

MCU 启动和向量表 当 STM32F429 MCU 启动时&#xff0c;它会从 flash 存储区最前面的位置读取一个叫作“向量表”的东西。“向量表”的概念所有 ARM MCU 都通用&#xff0c;它是一个包含 32 位中断处理程序地址的数组。对于所有 ARM MCU&#xff0c;向量表前 16 个地址由 ARM …

Databend 开源周报第 115 期

Databend 是一款现代云数仓。专为弹性和高效设计&#xff0c;为您的大规模分析需求保驾护航。自由且开源。即刻体验云服务&#xff1a;https://app.databend.cn 。 Whats On In Databend 探索 Databend 本周新进展&#xff0c;遇到更贴近你心意的 Databend 。 聚合索引 Data…

再现ORA-600 4000故障处理---惜分飞

有一个10g的库&#xff0c;由于redo损坏导致无法正常recover成功 正常途径无法open成功,尝试强制打开库 Wed Oct 18 11:23:25 2023 alter database open resetlogs Wed Oct 18 11:23:25 2023 RESETLOGS is being done without consistancy checks. This may result in a corr…

端到端测试(End-to-end tests)重试策略

作者&#xff5c;Giuseppe Donati&#xff0c;Trivago公司Web测试自动化工程师 整理&#xff5c;TesterHome 失败后重试&#xff0c;是好是坏&#xff1f; 为什么要在失败时重试所有测试&#xff1f;为什么不&#xff1f; 作为Trivago&#xff08;德国酒店搜索服务平台&…

Cesium Vue(四)— 物体(Entity)的添加与配置

1. 添加标签和广告牌 // 添加文字标签和广告牌var label viewer.entities.add({position: Cesium.Cartesian3.fromDegrees(113.3191, 23.109, 750),label: {text: "广州塔",font: "24px sans-serif",fillColor: Cesium.Color.WHITE,outlineColor: Cesium.…

什么是美颜SDK?解析主播直播美颜SDK的技术原理与应用

当下&#xff0c;越来越多的主播和内容创作者依赖直播平台来与观众互动、分享内容和实时传达信息。然而&#xff0c;为了在激烈的竞争中脱颖而出&#xff0c;许多主播需要借助美颜技术来提高他们的外貌吸引力。这就引入了主播直播美颜SDK&#xff0c;一个结合了技术原理与应用的…