Просмотр исходного кода

Merge branch 'master' of http://git.cc-lotus.info/guhongwei/web-center

guhongwei 5 лет назад
Родитель
Сommit
0f23490cfb

+ 26 - 20
src/layout/index/calendar.vue

@@ -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>

+ 0 - 1
src/layout/index/menuInfo.vue

@@ -7,7 +7,6 @@
             :default-active="activeIndex1"
             class="el-menu-demo"
             mode="horizontal"
-            @select="handleSelect"
             :style="`background-color:${backColor}`"
             text-color="#fff"
             active-text-color="#fff"

+ 1 - 1
src/layout/index/top.vue

@@ -6,7 +6,7 @@
           <el-image style="height:120px;" :src="info.logo"></el-image>
         </el-col>
         <el-col :span="12" class="right">
-          <p class="phone" :style="`color:${Color}`"><i class="el-icon-phone-outline"></i>{{ info.phone }}</p>
+          <p class="phone" :style="`color:${Color}`"><i class="el-icon-phone-outline"></i>{{ info.tel }}</p>
           <p class="day" :style="`color:${Color}`"><i class="el-icon-timer"></i>办公时间:周一至周五,法定假日不对外办公</p>
         </el-col>
       </el-col>

+ 2 - 0
src/store/index.js

@@ -8,6 +8,7 @@ import * as news from './news';
 import * as jobinfo from './jobinfo';
 import * as posts from './posts';
 import * as linkCor from './link-cor';
+import * as jobfair from './jobfair';
 
 Vue.use(Vuex);
 
@@ -24,5 +25,6 @@ export default new Vuex.Store({
     jobinfo: jobinfo,
     posts: posts,
     linkCor: linkCor,
+    jobfair: jobfair,
   },
 });

+ 33 - 0
src/store/jobfair.js

@@ -0,0 +1,33 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  range: `/api/jobs/fairs/date`,
+  list: `/api/jobs/fairs`,
+  fetch: id => `/api/jobs/fairs/${id}`,
+};
+export const state = () => ({});
+export const mutations = {};
+export const actions = {
+  async getJobfair({ state }, { type, data }) {
+    let { skip = 0, limit } = data;
+    let result;
+    if (type !== 'fetch') {
+      let { schid, date, ...searchInfo } = data;
+      result = await this.$axios.$get(_.get(api, type), {
+        schid: schid,
+        skip: skip,
+        limit: limit,
+        date: date,
+        status: '1',
+        ...searchInfo,
+      });
+    }
+    if (type === 'fetch') {
+      let { id } = data;
+      result = await this.$axios.$get(api.fetch(id));
+    }
+    return result;
+  },
+};

Разница между файлами не показана из-за своего большого размера
+ 2 - 1
src/views/aboutMe.vue


+ 7 - 0
vue.config.js

@@ -40,6 +40,13 @@ module.exports = {
         changeOrigin: true,
         ws: true,
       },
+      '/test': {
+        target: 'http://10.16.11.186:8103',
+        ws: true,
+        pathRewrite: {
+          '^/test': '/api',
+        },
+      },
     },
   },
 };