menu.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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: "https://www.yesdev.cn/platform/guide"
  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. if (item.link == 'https://www.yesdev.cn/platform/guide') {
  80. window.open(item.link, '_target');
  81. } else {
  82. location.href = item.link;
  83. }
  84. },
  85. /**
  86. * 点击前往
  87. */
  88. async clickGo() {
  89. let type = this.homepageType === `1` ? `2` : `1`;
  90. let res = await this.$axios.$post(`/api/user/update_info`, {
  91. home_page_type: type || `1`
  92. });
  93. this.$message({
  94. message: `更新成功, 即将刷新`,
  95. type: `success`
  96. });
  97. setTimeout(() => {
  98. location.reload();
  99. }, 1500);
  100. }
  101. }
  102. };
  103. </script>
  104. <style scoped>
  105. .tech-menu {
  106. display: flex;
  107. flex-direction: column;
  108. align-items: center;
  109. width: 174px;
  110. height: 402px;
  111. background: white;
  112. }
  113. .menu-item-box {
  114. width: 100%;
  115. padding-top: 20px;
  116. }
  117. .menu-item {
  118. line-height: 40px;
  119. font-size: 15px;
  120. color: #333;
  121. padding-left: 40px;
  122. cursor: pointer;
  123. }
  124. .menu-item-selected {
  125. background: #f7f7f7;
  126. }
  127. .go-btn {
  128. width: 122px;
  129. height: 34px;
  130. background: #0093fd;
  131. color: white;
  132. border-radius: 17px;
  133. margin-top: 30px;
  134. }
  135. </style>