saoCode.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. }
  17. },
  18. onLoad(option) {
  19. let self = this;
  20. if(option.q){
  21. let text = decodeURIComponent(option.q)
  22. let list = text.split("?")[1].split("&");
  23. for(let i=0;i<list.length;i++){
  24. let newList = list[i].split("=");
  25. if(newList[0] == 'code'){
  26. self.code = newList[1];
  27. }else if(newList[0] == 'type'){
  28. self.type = newList[1];
  29. }
  30. }
  31. if(!uni.getStorageSync('token')){
  32. uni.setStorageSync('saoCode',this.code);
  33. uni.setStorageSync('saoType',this.type);
  34. uni.redirectTo({
  35. url: '/pages/login',
  36. });
  37. }
  38. }else{
  39. this.code = uni.getStorageSync('saoCode');
  40. this.type = uni.getStorageSync('saoType');
  41. uni.removeStorageSync('saoCode');
  42. uni.removeStorageSync('saoType');
  43. }
  44. },
  45. mounted(){
  46. },
  47. methods:{
  48. },
  49. }
  50. </script>
  51. <style lang="stylus" scoped>
  52. #saoCode{
  53. overflow scroll
  54. }
  55. </style>