leader-home.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <div>
  3. <!-- tabber -->
  4. <div v-if="show">
  5. <van-nav-bar title="领导信箱" left-arrow @click-left="onClickLeft" />
  6. </div>
  7. <!-- 列表 -->
  8. <ul class="leader-home">
  9. <!-- 提交信件 -->
  10. <li @click="leader_home_list1">
  11. <img
  12. src="../../../assets/images/leader-mailbox/领导信箱图标1.png"
  13. alt=""
  14. />
  15. <p>提交信件</p>
  16. </li>
  17. <!-- 查看信箱 -->
  18. <li @click="leader_home_list2">
  19. <img
  20. src="../../../assets/images/leader-mailbox/领导信箱图标2.png"
  21. alt=""
  22. />
  23. <p>查看信箱</p>
  24. </li>
  25. <!-- 我的提交 -->
  26. <li @click="leader_home_list3">
  27. <img
  28. src="../../../assets/images/leader-mailbox/领导信箱图标3.png"
  29. alt=""
  30. />
  31. <p>我的提交</p>
  32. </li>
  33. </ul>
  34. </div>
  35. </template>
  36. <script>
  37. import { getAllUrlParams } from "../plugins/admin/url-encapsulation.js"; //获取url上的token和tabber
  38. export default {
  39. data() {
  40. return {
  41. token: sessionStorage.getItem("mytoken")
  42. ? sessionStorage.getItem("mytoken")
  43. : "", //token值保存在本地,有的话取值,没有为空
  44. show: false, //tabber是否显示
  45. gettoken: "", //从url获取到token值
  46. };
  47. },
  48. methods: {
  49. //提交信件
  50. leader_home_list1() {
  51. this.$router.push(
  52. `/xixuanzhongxin/leader-mailbox/leader-mailbox?token=${this.token}`
  53. );
  54. },
  55. //查看信箱
  56. leader_home_list2() {
  57. this.$http
  58. .post(
  59. "http://xixuan.nxjiewei.com:8011/api/workbench/leader_mailbox/check"
  60. )
  61. .then((res) => {
  62. //获取是否为领导
  63. this.leader = res.data.data;
  64. if (this.leader == true) {
  65. this.$router.push(
  66. `/xixuanzhongxin/leader-mailbox/leader-mailbox-list2?token=${this.token}`
  67. );
  68. } else {
  69. this.$dialog.alert({
  70. message: "暂无权限",
  71. theme: "round-button",
  72. });
  73. }
  74. });
  75. },
  76. //我的提交
  77. leader_home_list3() {
  78. this.$router.push(
  79. `/xixuanzhongxin/leader-mailbox/leader-mailbox-reply?token=${this.token}`
  80. );
  81. },
  82. //tabber返回按钮
  83. onClickLeft() {
  84. window.history.back();
  85. },
  86. },
  87. mounted() {
  88. document.body.style.backgroundColor = "#fff"; //背景色
  89. this.gettoken =getAllUrlParams(window.location.href).token;
  90. this.token = `Bearer ${this.gettoken}`; //获取token值
  91. sessionStorage.setItem("mytoken", this.token); //存入token值
  92. this.show = Boolean(getAllUrlParams(window.location.href).tabber); //获取tabber
  93. },
  94. };
  95. </script>
  96. <style scoped>
  97. .leader-home {
  98. width: 90%;
  99. margin: 0 auto;
  100. display: flex;
  101. justify-content: space-around;
  102. }
  103. .leader-home li {
  104. width: 33%;
  105. text-align: center;
  106. }
  107. .leader-home li img {
  108. width: 100%;
  109. }
  110. .van-nav-bar {
  111. background: #39f;
  112. }
  113. >>> .van-nav-bar__title {
  114. color: #fff;
  115. }
  116. >>> .van-nav-bar .van-icon {
  117. color: #fff;
  118. }
  119. [class*="van-hairline"]:after {
  120. border: none;
  121. }
  122. </style>