main-layout.vue 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <div id="main-layout">
  3. <div @click="checkBind()" v-if="!toLogin()">
  4. <el-container style="background:#e7e8eb;">
  5. <el-header height="4rem" class="head">
  6. <heads></heads>
  7. </el-header>
  8. <el-container class="contain">
  9. <el-aside width="13rem" class="side">
  10. <menus></menus>
  11. </el-aside>
  12. <el-main class="main">
  13. <router-view />
  14. </el-main>
  15. </el-container>
  16. </el-container>
  17. <bind :display="dialog" v-if="!$isBindWx()">
  18. <el-col :span="24" style="text-align:center;font-size:1.25rem;padding-top:1rem;">
  19. 绑定微信,开始您的招聘!
  20. </el-col>
  21. </bind>
  22. </div>
  23. <div v-else>
  24. <router-view />
  25. </div>
  26. </div>
  27. </template>
  28. <script>
  29. import bind from '@/components/bind.vue';
  30. import heads from '@/layout/layout-part/heads.vue';
  31. import menus from '@/layout/layout-part/menus.vue';
  32. import { mapActions, mapState } from 'vuex';
  33. export default {
  34. name: 'main-layout',
  35. props: {},
  36. components: {
  37. menus,
  38. heads,
  39. bind,
  40. },
  41. data: () => ({
  42. dialog: false,
  43. }),
  44. created() {},
  45. computed: {
  46. ...mapState(['user']),
  47. },
  48. methods: {
  49. ...mapActions(['corpOperation']),
  50. async getInfo() {
  51. let { base } = await this.corpOperation({ type: 'search', data: { corpid: this.user.corpid } });
  52. if (base.state === '已认证') return true;
  53. },
  54. checkBind() {
  55. //平台未审核/审核拒绝,只能进入基本信息去复审
  56. if (!this.getInfo()) {
  57. this.$message.error('您的企业还未通过审核,请检查您的信息');
  58. this.$router.push({ path: '/info/base/index' });
  59. return;
  60. }
  61. if (!this.$isBindWx()) this.dialog = true;
  62. },
  63. toLogin() {
  64. let route = window.location.pathname;
  65. return route.includes('login') || route.includes('register');
  66. },
  67. },
  68. };
  69. </script>
  70. <style lang="less" scoped>
  71. .head {
  72. margin: 0;
  73. padding: 0;
  74. width: 100%;
  75. background: #fff;
  76. }
  77. .contain {
  78. height: 100%;
  79. margin: 2rem 3.5rem;
  80. border: 1px solid #a2a2b6;
  81. background: #eeeeee;
  82. }
  83. .side {
  84. margin: 0;
  85. padding: 0;
  86. width: 2rem;
  87. border-right: 1px solid #a2a2b6;
  88. background: #ffffff;
  89. }
  90. .main {
  91. margin: 0;
  92. padding: 0 2rem;
  93. background: #ffffff;
  94. }
  95. </style>