saoCode.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <!--扫描二维码页面-->
  2. <template>
  3. <view id="saoCode">
  4. <web-view :src="baseUrl+'admin/#/codeHtml?code='+code+'&type='+type"></web-view>
  5. </view>
  6. </template>
  7. <script>
  8. import { config } from '@/api/request/config.js'
  9. export default {
  10. name: "saoCode",
  11. data() {
  12. return {
  13. baseUrl:config.base_url,
  14. code:"",
  15. type:"",
  16. subId:"",
  17. pageType:2,
  18. }
  19. },
  20. onLoad(option) {
  21. let self = this;
  22. if(option.q){
  23. let text = decodeURIComponent(option.q)
  24. let list = text.split("?")[1].split("&");
  25. for(let i=0;i<list.length;i++){
  26. let newList = list[i].split("=");
  27. if(newList[0] == 'code'){
  28. self.code = newList[1];
  29. }else if(newList[0] == 'type'){
  30. self.type = newList[1];
  31. }else if(newList[0] == 'subId'){
  32. self.subId = newList[1];
  33. }
  34. }
  35. if(!uni.getStorageSync('token')){
  36. uni.setStorageSync('saoCode',this.code);
  37. uni.setStorageSync('saoType',this.type);
  38. uni.setStorageSync('saoSubId',this.subId);
  39. uni.redirectTo({
  40. url: '/pages/login',
  41. });
  42. }else{
  43. if(this.type==7){//培训课程
  44. uni.redirectTo({
  45. url: '/pages/pages_patrolInspector/courseQRcode?code='+this.code,
  46. });
  47. }else if(this.type==8){//化学品柜
  48. uni.redirectTo({
  49. url: '/pages/pages_patrolInspector/chemicalCabinetQRcode?code='+this.code,
  50. });
  51. }else if(this.type==9){//化学品
  52. uni.redirectTo({
  53. url: '/pages/pages_patrolInspector/chemicalDetail?code='+this.code,
  54. });
  55. }else if(this.type==11){//化学品身份识别验证
  56. uni.redirectTo({
  57. url: '/pages/pages_patrolInspector/identityVerify?code='+this.code+'&subId='+this.subId,
  58. });
  59. }
  60. }
  61. }else{
  62. this.code = uni.getStorageSync('saoCode');
  63. this.type = uni.getStorageSync('saoType');
  64. this.type = uni.getStorageSync('saoSubId');
  65. uni.removeStorageSync('saoCode');
  66. uni.removeStorageSync('saoType');
  67. uni.removeStorageSync('saoSubId');
  68. if(this.type==7){//培训课程
  69. uni.redirectTo({
  70. url: '/pages/pages_patrolInspector/courseQRcode?code='+this.code,
  71. });
  72. }else if(this.type==8){//化学品柜
  73. uni.redirectTo({
  74. url: '/pages/pages_patrolInspector/chemicalCabinetQRcode?code='+this.code,
  75. });
  76. }else if(this.type==9){//化学品
  77. uni.redirectTo({
  78. url: '/pages/pages_patrolInspector/chemicalDetail?code='+this.code,
  79. });
  80. }else if(this.type==11){//化学品身份识别验证
  81. uni.redirectTo({
  82. url: '/pages/pages_patrolInspector/identityVerify?code='+this.code+'&subId='+this.subId,
  83. });
  84. }
  85. }
  86. },
  87. mounted(){
  88. },
  89. methods:{
  90. },
  91. }
  92. </script>
  93. <style lang="stylus" scoped>
  94. #saoCode{
  95. overflow scroll
  96. }
  97. </style>