util.sjs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. var antmove_export = {};
  2. function indexOf(array, appointmentAuth, checkAuth, serivceAuth) {
  3. // var userMsg= wx.getStorageSync('userMsg')
  4. // 1预约权限;2审核权限;3会议服务权限
  5. if (array) {
  6. if (array.length == 2 && (appointmentAuth || checkAuth)) {
  7. return true;
  8. }
  9. if (array.indexOf(1) > -1) {
  10. if (appointmentAuth) {
  11. return true;
  12. } else {
  13. return false;
  14. }
  15. }
  16. if (array.indexOf(2) > -1) {
  17. if (checkAuth) {
  18. return true;
  19. } else {
  20. return false;
  21. }
  22. }
  23. if (array.indexOf(3) > -1) {
  24. if (serivceAuth) {
  25. return true
  26. } else {
  27. return false
  28. }
  29. }
  30. }
  31. }
  32. function indexOf1(array, value) {
  33. if (array) {
  34. if (array.indexOf(value) < 0) {
  35. return false;
  36. } else {
  37. return true;
  38. }
  39. }
  40. }
  41. function indexOf2(array, name, status, continueMeeting) {
  42. if (array) {
  43. if (array.indexOf(status) < 0) {
  44. return false;
  45. } else {
  46. var isTrue = true
  47. if (name == '会议续约') {
  48. continueMeeting ? isTrue = true : isTrue = false
  49. }
  50. return isTrue
  51. }
  52. }
  53. }
  54. function getVehicleType(id) {
  55. var drivingModelList = [{
  56. id: 1,
  57. name: 'A1'
  58. }, {
  59. id: 2,
  60. name: 'A2'
  61. }, {
  62. id: 3,
  63. name: 'A3'
  64. }, {
  65. id: 4,
  66. name: 'B1'
  67. }, {
  68. id: 5,
  69. name: 'B2'
  70. }, {
  71. id: 6,
  72. name: 'C1'
  73. }, {
  74. id: 7,
  75. name: 'C2'
  76. }, {
  77. id: 8,
  78. name: 'C3'
  79. }, {
  80. id: 9,
  81. name: 'C4'
  82. }, {
  83. id: 10,
  84. name: 'C5'
  85. }, {
  86. id: 11,
  87. name: 'D'
  88. }];
  89. var name = '';
  90. drivingModelList.forEach(function (item) {
  91. if (item.id == id) {
  92. name = item.name;
  93. }
  94. });
  95. return name;
  96. }
  97. function desensitization(string = "", start, end) {
  98. var star = '';
  99. function makeStar(number) {
  100. if (number > 0) {
  101. star += '*';
  102. return makeStar(--number);
  103. } else {
  104. return star;
  105. }
  106. }
  107. ;
  108. return string.substring(0, start) + makeStar(end - start) + string.substring(end);
  109. }
  110. antmove_export = {
  111. indexOf: indexOf,
  112. indexOf1: indexOf1,
  113. getVehicleType: getVehicleType,
  114. desensitization: desensitization,
  115. indexOf2: indexOf2,
  116. };
  117. export default antmove_export;