common.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //import request from '@/utils/request.js'
  2. // 防止处理多次点击
  3. function noMultipleClicks(methods, info) {
  4. // methods是点击后需要执行的函数, info是函数需要传的参数
  5. let that = this;
  6. if (that.noClick) {
  7. // 第一次点击
  8. that.noClick= false;
  9. if((info && info !== '') || info ==0) {
  10. // info是执行函数需要传的参数
  11. methods(info);
  12. } else {
  13. methods();
  14. }
  15. setTimeout(()=> {
  16. that.noClick= true;
  17. }, 3000)
  18. } else {
  19. // 这里是重复点击的判断
  20. }
  21. }
  22. const getHashQuery = function(query) {
  23. //console.log(location.hash)
  24. if (location.hash.indexOf(query) > -1) {
  25. const cur = location.hash.slice(location.hash.indexOf(query) + query.length + 1, location.hash.length)
  26. if (cur.indexOf('&') > -1) {
  27. return cur.slice(0, cur.indexOf('&'))
  28. } else {
  29. return cur
  30. }
  31. } else {
  32. return false
  33. }
  34. }
  35. export default {
  36. commonData:{
  37. companyType:1,
  38. },
  39. noMultipleClicks, // 禁止多次点击
  40. getHashQuery,
  41. }