index.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <view class="content">
  3. <view class="group">
  4. <button class="page" v-if="true" @click="onHandleClick(0)">
  5. <uni-icons type="list" size="40" />
  6. <view>项目列表</view>
  7. </button>
  8. <button class="page" v-if="true" @click="onHandleClick(1)">
  9. <uni-icons type="checkmarkempty" size="40" />
  10. <view>项目审核</view>
  11. </button>
  12. <button class="page" v-if="true" @click="onHandleClick(2)">
  13. <uni-icons type="calendar" size="40" />
  14. <view>工时上报</view>
  15. </button>
  16. <button class="page" v-if="true" @click="onHandleClick(3)">
  17. <uni-icons type="auth" size="40" />
  18. <view>工时审批</view>
  19. </button>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import { queryUser } from "@/services/index";
  25. export default {
  26. data() {
  27. return { user: {} };
  28. },
  29. onShow() {
  30. this.getCurrentUser();
  31. },
  32. computed: {
  33. permission() {
  34. let permission = {};
  35. this.user?.Permissions.forEach((item) => {
  36. permission = {
  37. ...permission,
  38. ...item.Menus,
  39. };
  40. });
  41. return permission;
  42. },
  43. },
  44. methods: {
  45. onHandleClick(index) {
  46. switch (index) {
  47. case 0:
  48. uni.navigateTo({
  49. url: "../Project/list",
  50. });
  51. break;
  52. case 1:
  53. uni.navigateTo({
  54. url: "../Project/auth",
  55. });
  56. break;
  57. case 2:
  58. uni.navigateTo({
  59. url: "../WorkingHours/index",
  60. });
  61. break;
  62. case 3:
  63. uni.navigateTo({
  64. url: "../WorkingHours/audit",
  65. });
  66. break;
  67. }
  68. },
  69. async getCurrentUser() {
  70. let res = {};
  71. res = await queryUser();
  72. this.user = res.data;
  73. },
  74. },
  75. };
  76. </script>
  77. <style lang="less" scoped>
  78. .content {
  79. display: flex;
  80. justify-content: center;
  81. }
  82. .group {
  83. width: 90%;
  84. padding: 10%;
  85. display: flex;
  86. justify-content: center;
  87. flex-wrap: wrap;
  88. background-color: #ffffff;
  89. }
  90. .page {
  91. width: 40%;
  92. margin: 5%;
  93. }
  94. </style>