main-layout.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. async checkBind() {
  55. //平台未审核/审核拒绝,只能进入基本信息去复审
  56. if (!(await this.getInfo())) {
  57. console.log('in function:');
  58. this.$message.error('您的企业还未通过审核,请检查您的信息');
  59. this.$router.push({ path: '/info/base/index' });
  60. return;
  61. }
  62. console.log('in function:else');
  63. if (!this.$isBindWx()) this.dialog = true;
  64. },
  65. toLogin() {
  66. let route = window.location.pathname;
  67. return route.includes('login') || route.includes('register');
  68. },
  69. },
  70. };
  71. </script>
  72. <style lang="less" scoped>
  73. .head {
  74. margin: 0;
  75. padding: 0;
  76. width: 100%;
  77. background: #fff;
  78. }
  79. .contain {
  80. height: 100%;
  81. margin: 2rem 3.5rem;
  82. border: 1px solid #a2a2b6;
  83. background: #eeeeee;
  84. }
  85. .side {
  86. margin: 0;
  87. padding: 0;
  88. width: 2rem;
  89. border-right: 1px solid #a2a2b6;
  90. background: #ffffff;
  91. }
  92. .main {
  93. margin: 0;
  94. padding: 0 2rem;
  95. background: #ffffff;
  96. }
  97. </style>