to_soap_tape.vue 990 B

123456789101112131415161718192021222324252627282930313233343536
  1. <template>
  2. <view class="">
  3. </view>
  4. </template>
  5. <script>
  6. export default {
  7. data() {
  8. return {}
  9. },
  10. onLoad(option) {
  11. // const a = 'http://localhost:8084/gzh/?code=0513sQ000lWFRP1PH7000Df1YV03sQ0B&state=STATE#/pages/to_soap_tape/to_soap_tape?type=1'
  12. let wxcode = this.getUrlParam('code')
  13. if (wxcode) {
  14. const url = `http://soap.cliu.cc/#/pages/index/index?type=${option.type}&wxcode=${wxcode}`
  15. window.location.href = url
  16. }
  17. },
  18. methods: {
  19. //获取code值方法
  20. getUrlParam(name) {
  21. console.log(window.location, 'location');
  22. console.log(window.location.href, 'href');
  23. var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); //构造一个含有目标参数的正则表达式对象
  24. var r = window.location.search.substr(1).match(reg); //匹配目标参数
  25. if (r != null) return decodeURIComponent(r[2]);
  26. // return null; //返回参数值
  27. return ''; //返回参数值
  28. },
  29. }
  30. }
  31. </script>
  32. <style>
  33. </style>