common.js 983 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. const isUserId = function() {
  2. var userId=uni.getStorageSync("logodata").uid;
  3. //console.log("userId---"+userId)
  4. if(!userId){
  5. uni.navigateTo({
  6. url:'../login/login'
  7. })
  8. }
  9. }
  10. /* const uid =function() {
  11. var userId=uni.getStorageSync("logodata").uid;
  12. return
  13. } */
  14. // 防止处理多次点击
  15. function noMultipleClicks(methods, info) {
  16. // methods是点击后需要执行的函数, info是函数需要传的参数
  17. let that = this;
  18. if (that.noClick) {
  19. // 第一次点击
  20. that.noClick= false;
  21. if((info && info !== '') || info ==0) {
  22. // info是执行函数需要传的参数
  23. methods(info);
  24. } else {
  25. methods();
  26. }
  27. setTimeout(()=> {
  28. that.noClick= true;
  29. }, 3000)
  30. } else {
  31. // 这里是重复点击的判断
  32. }
  33. }
  34. export default {
  35. commonData:{
  36. companyType:1,
  37. },
  38. isUserId,
  39. noMultipleClicks, // 禁止多次点击
  40. }