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


    背景需求

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

    教程

    router/index.js

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

    permission.js

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

    增加以下识别的代码

    1. 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)
    2. if (flag) {
    3. console.log('手机端');
    4. next(`/loginPhone?redirect=${to.fullPath}`)
    5. } else {
    6. console.log('pc端');
    7. next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
    8. }
    9. NProgress.done()

     

    结束

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

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

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

    1. package cn.renkai721.bean.vo;
    2. import lombok.extern.slf4j.Slf4j;
    3. @Slf4j
    4. public class MakeUpTheWordCount {
    5. private String make_up_the_word_count_column_999999999_1;
    6. private String make_up_the_word_count_column_999999999_2;
    7. private String make_up_the_word_count_column_999999999_3;
    8. private String make_up_the_word_count_column_999999999_4;
    9. private String make_up_the_word_count_column_999999999_5;
    10. private String make_up_the_word_count_column_999999999_6;
    11. private String make_up_the_word_count_column_999999999_7;
    12. private String make_up_the_word_count_column_999999999_8;
    13. private String make_up_the_word_count_column_999999999_9;
    14. private String make_up_the_word_count_column_999999999_10;
    15. private String make_up_the_word_count_column_999999999_11;
    16. private String make_up_the_word_count_column_999999999_12;
    17. private String make_up_the_word_count_column_999999999_13;
    18. private String make_up_the_word_count_column_999999999_14;
    19. private String make_up_the_word_count_column_999999999_15;
    20. private String make_up_the_word_count_column_999999999_16;
    21. private String make_up_the_word_count_column_999999999_17;
    22. private String make_up_the_word_count_column_999999999_18;
    23. private String make_up_the_word_count_column_999999999_19;
    24. private String make_up_the_word_count_column_999999999_20;
    25. public String getMake_up_the_word_count_column_999999999_1() {
    26. return make_up_the_word_count_column_999999999_1;
    27. }
    28. public void setMake_up_the_word_count_column_999999999_1(String make_up_the_word_count_column_999999999_1) {
    29. this.make_up_the_word_count_column_999999999_1 = make_up_the_word_count_column_999999999_1;
    30. }
    31. public String getMake_up_the_word_count_column_999999999_2() {
    32. return make_up_the_word_count_column_999999999_2;
    33. }
    34. public void setMake_up_the_word_count_column_999999999_2(String make_up_the_word_count_column_999999999_2) {
    35. this.make_up_the_word_count_column_999999999_2 = make_up_the_word_count_column_999999999_2;
    36. }
    37. public String getMake_up_the_word_count_column_999999999_3() {
    38. return make_up_the_word_count_column_999999999_3;
    39. }
    40. public void setMake_up_the_word_count_column_999999999_3(String make_up_the_word_count_column_999999999_3) {
    41. this.make_up_the_word_count_column_999999999_3 = make_up_the_word_count_column_999999999_3;
    42. }
    43. public String getMake_up_the_word_count_column_999999999_4() {
    44. return make_up_the_word_count_column_999999999_4;
    45. }
    46. public void setMake_up_the_word_count_column_999999999_4(String make_up_the_word_count_column_999999999_4) {
    47. this.make_up_the_word_count_column_999999999_4 = make_up_the_word_count_column_999999999_4;
    48. }
    49. public String getMake_up_the_word_count_column_999999999_5() {
    50. return make_up_the_word_count_column_999999999_5;
    51. }
    52. public void setMake_up_the_word_count_column_999999999_5(String make_up_the_word_count_column_999999999_5) {
    53. this.make_up_the_word_count_column_999999999_5 = make_up_the_word_count_column_999999999_5;
    54. }
    55. public String getMake_up_the_word_count_column_999999999_6() {
    56. return make_up_the_word_count_column_999999999_6;
    57. }
    58. public void setMake_up_the_word_count_column_999999999_6(String make_up_the_word_count_column_999999999_6) {
    59. this.make_up_the_word_count_column_999999999_6 = make_up_the_word_count_column_999999999_6;
    60. }
    61. public String getMake_up_the_word_count_column_999999999_7() {
    62. return make_up_the_word_count_column_999999999_7;
    63. }
    64. public void setMake_up_the_word_count_column_999999999_7(String make_up_the_word_count_column_999999999_7) {
    65. this.make_up_the_word_count_column_999999999_7 = make_up_the_word_count_column_999999999_7;
    66. }
    67. public String getMake_up_the_word_count_column_999999999_8() {
    68. return make_up_the_word_count_column_999999999_8;
    69. }
    70. public void setMake_up_the_word_count_column_999999999_8(String make_up_the_word_count_column_999999999_8) {
    71. this.make_up_the_word_count_column_999999999_8 = make_up_the_word_count_column_999999999_8;
    72. }
    73. public String getMake_up_the_word_count_column_999999999_9() {
    74. return make_up_the_word_count_column_999999999_9;
    75. }
    76. public void setMake_up_the_word_count_column_999999999_9(String make_up_the_word_count_column_999999999_9) {
    77. this.make_up_the_word_count_column_999999999_9 = make_up_the_word_count_column_999999999_9;
    78. }
    79. public String getMake_up_the_word_count_column_999999999_10() {
    80. return make_up_the_word_count_column_999999999_10;
    81. }
    82. public void setMake_up_the_word_count_column_999999999_10(String make_up_the_word_count_column_999999999_10) {
    83. this.make_up_the_word_count_column_999999999_10 = make_up_the_word_count_column_999999999_10;
    84. }
    85. public String getMake_up_the_word_count_column_999999999_11() {
    86. return make_up_the_word_count_column_999999999_11;
    87. }
    88. public void setMake_up_the_word_count_column_999999999_11(String make_up_the_word_count_column_999999999_11) {
    89. this.make_up_the_word_count_column_999999999_11 = make_up_the_word_count_column_999999999_11;
    90. }
    91. public String getMake_up_the_word_count_column_999999999_12() {
    92. return make_up_the_word_count_column_999999999_12;
    93. }
    94. public void setMake_up_the_word_count_column_999999999_12(String make_up_the_word_count_column_999999999_12) {
    95. this.make_up_the_word_count_column_999999999_12 = make_up_the_word_count_column_999999999_12;
    96. }
    97. public String getMake_up_the_word_count_column_999999999_13() {
    98. return make_up_the_word_count_column_999999999_13;
    99. }
    100. public void setMake_up_the_word_count_column_999999999_13(String make_up_the_word_count_column_999999999_13) {
    101. this.make_up_the_word_count_column_999999999_13 = make_up_the_word_count_column_999999999_13;
    102. }
    103. public String getMake_up_the_word_count_column_999999999_14() {
    104. return make_up_the_word_count_column_999999999_14;
    105. }
    106. public void setMake_up_the_word_count_column_999999999_14(String make_up_the_word_count_column_999999999_14) {
    107. this.make_up_the_word_count_column_999999999_14 = make_up_the_word_count_column_999999999_14;
    108. }
    109. public String getMake_up_the_word_count_column_999999999_15() {
    110. return make_up_the_word_count_column_999999999_15;
    111. }
    112. public void setMake_up_the_word_count_column_999999999_15(String make_up_the_word_count_column_999999999_15) {
    113. this.make_up_the_word_count_column_999999999_15 = make_up_the_word_count_column_999999999_15;
    114. }
    115. public String getMake_up_the_word_count_column_999999999_16() {
    116. return make_up_the_word_count_column_999999999_16;
    117. }
    118. public void setMake_up_the_word_count_column_999999999_16(String make_up_the_word_count_column_999999999_16) {
    119. this.make_up_the_word_count_column_999999999_16 = make_up_the_word_count_column_999999999_16;
    120. }
    121. public String getMake_up_the_word_count_column_999999999_17() {
    122. return make_up_the_word_count_column_999999999_17;
    123. }
    124. public void setMake_up_the_word_count_column_999999999_17(String make_up_the_word_count_column_999999999_17) {
    125. this.make_up_the_word_count_column_999999999_17 = make_up_the_word_count_column_999999999_17;
    126. }
    127. public String getMake_up_the_word_count_column_999999999_18() {
    128. return make_up_the_word_count_column_999999999_18;
    129. }
    130. public void setMake_up_the_word_count_column_999999999_18(String make_up_the_word_count_column_999999999_18) {
    131. this.make_up_the_word_count_column_999999999_18 = make_up_the_word_count_column_999999999_18;
    132. }
    133. public String getMake_up_the_word_count_column_999999999_19() {
    134. return make_up_the_word_count_column_999999999_19;
    135. }
    136. public void setMake_up_the_word_count_column_999999999_19(String make_up_the_word_count_column_999999999_19) {
    137. this.make_up_the_word_count_column_999999999_19 = make_up_the_word_count_column_999999999_19;
    138. }
    139. public String getMake_up_the_word_count_column_999999999_20() {
    140. return make_up_the_word_count_column_999999999_20;
    141. }
    142. public void setMake_up_the_word_count_column_999999999_20(String make_up_the_word_count_column_999999999_20) {
    143. this.make_up_the_word_count_column_999999999_20 = make_up_the_word_count_column_999999999_20;
    144. }
    145. }

  • 相关阅读:
    二、怎么简单使用vuex
    【一起学Rust · 项目实战】命令行IO项目minigrep——接收命令行参数与读取文件内容
    Android 8.1 persisten 应用通过安装方式更新升级
    笔记本电脑怎么写日记
    高级数据结构——AVL树
    SCConv:用于特征冗余的空间和通道重构卷积
    LeetCode-22. 括号生成【字符串 动态规划 回溯】
    区块链软件开发中的虚拟机(virtual machine)
    13.1 使用DirectX9绘图引擎
    WPF中Popup控件的使用
  • 原文地址:https://blog.csdn.net/renkai721/article/details/133910072