detail.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <div id="detail">
  3. <recruitdetail-layout :needRight="false">
  4. <template v-slot:mainInfoTop>
  5. <el-row>
  6. <el-col :span="24">
  7. <el-breadcrumb separator-class="el-icon-arrow-right">
  8. <el-breadcrumb-item :to="{ path: '/' }">
  9. <i class="el-icon-s-home"></i>
  10. <span>网站首页</span>
  11. </el-breadcrumb-item>
  12. <el-breadcrumb-item><span>招聘会</span></el-breadcrumb-item>
  13. <el-breadcrumb-item class="webDetail">详情</el-breadcrumb-item>
  14. </el-breadcrumb>
  15. </el-col>
  16. </el-row>
  17. <share></share>
  18. </template>
  19. <template v-slot:mainLeft>
  20. <jobfair-head title="招聘会信息" :info="info" @getTicket="getTicket"></jobfair-head>
  21. <jobfair-context title="招聘会说明" :info="info"></jobfair-context>
  22. <user-defined title="招聘会相关">
  23. <el-tabs v-model="tabs" type="card">
  24. <el-tab-pane label="企业列表" name="corp">
  25. <el-table :data="corpList" style="width: 100%" stripe :show-header="false">
  26. <el-table-column label="企业" prop="corpname">
  27. <template v-slot="scoped">
  28. <el-link @click="$router.push({ path: '/corp/detail', query: { id: scoped.row.corpid } })">{{ scoped.row.corpname }}</el-link>
  29. </template>
  30. </el-table-column>
  31. </el-table>
  32. </el-tab-pane>
  33. <el-tab-pane label="招聘职位" name="jobs">
  34. <web-jobs :info="jobList" type="2" :origin="info.id" @search="searchJobs"> </web-jobs>
  35. </el-tab-pane>
  36. </el-tabs>
  37. </user-defined>
  38. </template>
  39. </recruitdetail-layout>
  40. <toLogin :display="loginDialog" @close="loginDialog = false" title="请登录"></toLogin>
  41. </div>
  42. </template>
  43. <script>
  44. import userDefined from '@/layout/detail/user-defined.vue';
  45. import toLogin from '@/components/to-login.vue';
  46. import recruitdetailLayout from '@/layout/recruitdetail-layout.vue';
  47. import jobfairHead from '@/layout/detail/jobfair/head.vue';
  48. import jobfairContext from '@/layout/detail/jobfair/context.vue';
  49. import webJobs from '@/layout/detail/web-jobs.vue';
  50. import share from '@/layout/share.vue';
  51. import { mapActions, mapState } from 'vuex';
  52. export default {
  53. name: 'detail',
  54. props: {},
  55. components: {
  56. recruitdetailLayout,
  57. jobfairHead,
  58. jobfairContext,
  59. webJobs,
  60. share,
  61. toLogin,
  62. userDefined,
  63. },
  64. data: () => ({
  65. url2: 'http://yun-campus-res.oss-cn-shenzhen.aliyuncs.com/company/1536028846-7488.jpg',
  66. info: {},
  67. jobList: [],
  68. corpList: [],
  69. tabs: 'corp',
  70. loginDialog: false,
  71. }),
  72. created() {
  73. this.search();
  74. },
  75. computed: {
  76. ...mapState(['user']),
  77. },
  78. methods: {
  79. ...mapActions(['jobfairOperation', 'userOperation', 'ticketsOperation', 'fairInfoOperation', 'postOperation']),
  80. async search() {
  81. //1直接拿着参数发送请求
  82. let result = await this.jobfairOperation({ type: 'search', data: { id: this.$route.query.id } });
  83. if (`${result.errcode}` === '0') {
  84. //给this=>vue的实例下在中的list属性,赋予result.data的值
  85. this.$set(this, `info`, result.data);
  86. this.searchCorps();
  87. } else {
  88. this.$message.error(result.errmsg ? result.errmsg : 'error');
  89. }
  90. },
  91. async searchCorps() {
  92. let result = await this.fairInfoOperation({ type: 'searchCorp', data: { fairid: this.$route.query.id, skip: 0, limit: this.$limit } });
  93. if (`${result.errcode}` === '0') {
  94. this.$set(this, `corpList`, result.data);
  95. this.searchJobs();
  96. }
  97. },
  98. async searchJobs() {
  99. let jobsList = [];
  100. if (this.corpList.length > 0) {
  101. for (const item of this.corpList) {
  102. let result = await this.fairInfoOperation({ type: `searchJobs`, data: { id: item.id } });
  103. if (`${result.errcode}` === '0') {
  104. result.data.map(item => jobsList.push(item));
  105. }
  106. }
  107. this.$set(this, `jobList`, jobsList);
  108. }
  109. },
  110. async getTicket() {
  111. if (!this.user.id) {
  112. this.loginDialog = true;
  113. return false;
  114. }
  115. let query = {};
  116. query.is_talk = `0`;
  117. query.studid = this.user.id;
  118. query.fairid = this.info.id;
  119. query.schid = this.info.schid;
  120. let result = await this.userOperation({ type: 'search', data: { studid: this.user.id } });
  121. let info = result.data.info;
  122. let body = {};
  123. body.schid = info.schid;
  124. body.year = info.year;
  125. body.xm = info.xm;
  126. body.xb = info.xb;
  127. body.yx = info.yx;
  128. body.zy = info.zy;
  129. body.xl = info.xl;
  130. body.syszd = info.syszd;
  131. body.zzmm = info.zzmm;
  132. result = await this.ticketsOperation({ type: 'add', data: { query: query, body: body } });
  133. this.$message({
  134. type: `${result.errcode}` === '0' ? 'success' : 'error',
  135. message: `${result.errcode}` === '0' ? '成功领到门票' : result.errmsg === '数据已存在' ? '已领取过门票,不能重复领取' : result.errmsg,
  136. });
  137. },
  138. },
  139. };
  140. </script>
  141. <style lang="less" scoped></style>