menu.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <section class="tech-menu">
  3. <ul class="menu-item-box">
  4. <li
  5. class="menu-item"
  6. :class="{'menu-item-selected': index === menuIndex}"
  7. v-for="(item, index) of items"
  8. :key="item + index"
  9. @click="clickItem(item, index)"
  10. >{{item.label}}</li>
  11. </ul>
  12. <button class="go-btn" @click="clickGo">{{goTitle}}</button>
  13. </section>
  14. </template>
  15. <script>
  16. import Cookies from 'js-cookie'
  17. export default {
  18. props: {
  19. menuIndex: {
  20. type: Number,
  21. default() {
  22. return 0;
  23. }
  24. }
  25. },
  26. data() {
  27. return {
  28. ///wo/work_todo
  29. items: [
  30. {
  31. label: "我的工作",
  32. link: "/wo/work_todo"
  33. },
  34. {
  35. label: "协作群组",
  36. link: "/group"
  37. },
  38. // {
  39. // label: "财务详情new",
  40. // link: "/paysdetail"
  41. // },
  42. {
  43. label: "资金账户",
  44. link: "/wo/account"
  45. },
  46. {
  47. label: "信息设置",
  48. link: "/setting"
  49. },
  50. {
  51. label: "更多服务",
  52. link: "/wo/services"
  53. },
  54. {
  55. label: "代码托管GitInn",
  56. link: "https://www.gitinn.com/proginn/login?token=" + Cookies.get('x_access_token')
  57. },
  58. {
  59. label: "其他",
  60. link: "/wo/other"
  61. }
  62. ],
  63. homepageType: null
  64. };
  65. },
  66. computed: {
  67. goTitle() {
  68. if (this.homepageType)
  69. return this.homepageType === `1` ? `前往个人版` : `前往企业版`;
  70. else return ``;
  71. }
  72. },
  73. mounted() {
  74. this.homepageType = this.userinfo.home_page_type;
  75. },
  76. methods: {
  77. clickItem(item, index) {
  78. console.log(item.link);
  79. location.href = item.link;
  80. },
  81. /**
  82. * 点击前往
  83. */
  84. async clickGo() {
  85. let type = this.homepageType === `1` ? `2` : `1`;
  86. let res = await this.$axios.$post(`/api/user/update_info`, {
  87. home_page_type: type || `1`
  88. });
  89. this.$message({
  90. message: `更新成功, 即将刷新`,
  91. type: `success`
  92. });
  93. setTimeout(() => {
  94. location.reload();
  95. }, 1500);
  96. }
  97. }
  98. };
  99. </script>
  100. <style scoped>
  101. .tech-menu {
  102. display: flex;
  103. flex-direction: column;
  104. align-items: center;
  105. width: 174px;
  106. height: 402px;
  107. background: white;
  108. }
  109. .menu-item-box {
  110. width: 100%;
  111. padding-top: 20px;
  112. }
  113. .menu-item {
  114. line-height: 40px;
  115. font-size: 15px;
  116. color: #333;
  117. padding-left: 40px;
  118. cursor: pointer;
  119. }
  120. .menu-item-selected {
  121. background: #f7f7f7;
  122. }
  123. .go-btn {
  124. width: 122px;
  125. height: 34px;
  126. background: #0093fd;
  127. color: white;
  128. border-radius: 17px;
  129. margin-top: 30px;
  130. }
  131. </style>