|
@@ -3,10 +3,10 @@
|
|
|
<el-row style="background:#598bed;height:476px;">
|
|
|
<el-col :span="24" class="info">
|
|
|
<el-col :span="24" class="calendar">
|
|
|
- <el-calendar>
|
|
|
+ <el-calendar v-model="calendars">
|
|
|
<template #dateCell="{date, data}">
|
|
|
<el-row>
|
|
|
- <el-col :span="24" @click.native="search(data)">{{ date | getDay }}</el-col>
|
|
|
+ <el-col :span="24" @click.native="filter(data)" :class="hasJobfair(data)">{{ date | getDay(data) }}</el-col>
|
|
|
</el-row>
|
|
|
</template>
|
|
|
</el-calendar>
|
|
@@ -36,7 +36,7 @@
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="loginBtn">
|
|
|
<el-button type="primary">学生登录</el-button>
|
|
|
- <el-button type="success">企业登录</el-button>
|
|
|
+ <el-button type="success" @click="turnTo('corp')">企业登录</el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</div>
|
|
@@ -49,38 +49,41 @@ export default {
|
|
|
props: {},
|
|
|
components: {},
|
|
|
data: () => ({
|
|
|
- calendar: new Date(),
|
|
|
+ calendars: new Date(),
|
|
|
list: [],
|
|
|
loading: false,
|
|
|
infoList: [],
|
|
|
- info: {
|
|
|
- id: 1,
|
|
|
- title: '应届毕业生大型招聘会',
|
|
|
- organizer: '一汽大众大型招聘会',
|
|
|
- date: '2019-11-7',
|
|
|
- address: '长春会展中心',
|
|
|
- },
|
|
|
+ info: {},
|
|
|
}),
|
|
|
created() {
|
|
|
- // this.search();
|
|
|
+ this.search();
|
|
|
},
|
|
|
computed: {},
|
|
|
+ watch: {
|
|
|
+ calendars: 'search',
|
|
|
+ },
|
|
|
methods: {
|
|
|
- ...mapActions(['jobfairOperation']),
|
|
|
- async search(date) {
|
|
|
- let options = { date: date ? date.day : undefined };
|
|
|
- // 1直接拿着参数发送请求
|
|
|
- let result = await this.jobfairOperation({ type: 'list', data: { ...options } });
|
|
|
+ ...mapActions(['getJobfair']),
|
|
|
+ async search() {
|
|
|
+ let year = `${this.calendars.getFullYear()}`;
|
|
|
+ let month = this.calendars.getMonth() + 1 >= 10 ? this.calendars.getMonth() + 1 : `0${this.calendars.getMonth() + 1}`;
|
|
|
+ let options = { date: `${year}-${month}` };
|
|
|
+ let result = await this.getJobfair({ type: 'range', data: { ...options } });
|
|
|
if (`${result.errcode}` === '0') {
|
|
|
- //给this=>vue的实例下在中的list属性,赋予result。data的值
|
|
|
this.$set(this, `infoList`, result.data);
|
|
|
- if (result.data.length > 0) this.$set(this, `info`, result.data[0]);
|
|
|
- else this.$set(this, `info`, {});
|
|
|
} else {
|
|
|
this.$set(this, `info`, {});
|
|
|
this.$message.error(result.errmsg ? result.errmsg : 'error');
|
|
|
}
|
|
|
},
|
|
|
+ hasJobfair(data) {
|
|
|
+ let res = this.infoList.filter(fil => fil.date === data.day);
|
|
|
+ return res.length > 0 ? 'has' : '';
|
|
|
+ },
|
|
|
+ filter(data) {
|
|
|
+ let res = this.infoList.filter(fil => fil.date === data.day);
|
|
|
+ if (res.length > 0) this.$set(this, `info`, res[0]);
|
|
|
+ },
|
|
|
},
|
|
|
filters: {
|
|
|
getDay(data) {
|
|
@@ -209,4 +212,7 @@ p {
|
|
|
text-align: center;
|
|
|
padding: 19px 28px;
|
|
|
}
|
|
|
+.has {
|
|
|
+ background: red;
|
|
|
+}
|
|
|
</style>
|