Bladeren bron

修改模块

lrf402788946 5 jaren geleden
bovenliggende
commit
9e2515e14c
3 gewijzigde bestanden met toevoegingen van 29 en 38 verwijderingen
  1. 6 7
      src/components/self-calendars.vue
  2. 19 27
      src/views/index/index.vue
  3. 4 4
      src/views/master/news/detail.vue

+ 6 - 7
src/components/self-calendars.vue

@@ -54,14 +54,15 @@ export default {
     calendar: new Date(),
     list: [],
     loading: false,
-    infoList: {
+    infoList: [],
+    info: {
+      id: 1,
       time: '9:00',
       organizer: '一汽大众大型招聘会',
       title: '应届毕业生大型招聘会',
       date: '2019-11-7',
       address: '长春会展中心',
     },
-    info: {},
   }),
   created() {
     this.search();
@@ -70,13 +71,11 @@ export default {
   methods: {
     ...mapActions(['jobfairOperation']),
     async search(date) {
-      console.log(date);
       let options = { date: date ? date.day : undefined };
       // 1直接拿着参数发送请求
       let result = await this.jobfairOperation({ type: 'list', data: { ...options } });
       if (`${result.errcode}` === '0') {
         //给this=>vue的实例下在中的list属性,赋予result。data的值
-        console.log(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`, {});
@@ -157,8 +156,8 @@ p {
   display: none;
 }
 /deep/.el-calendar-table td.is-today {
-  color: yellow;
-  background: #f8ab55;
+  color: #0066ff;
+  background: #54f77f;
   border-radius: 90px;
 }
 /deep/.el-calendar-table td.is-selected {
@@ -210,7 +209,7 @@ p {
   text-align: center;
   padding: 0px 25px;
 }
-.none{
+.none {
   font-size: 24px;
   color: #676767;
   text-align: center;

+ 19 - 27
src/views/index/index.vue

@@ -152,7 +152,7 @@ export default {
           this.$set(this, `site`, result.data);
         }
       } else {
-        console.log(JSON.parse(site));
+        // console.log(JSON.parse(site));
         this.$set(this, `site`, JSON.parse(site));
         let arr = this.site;
         if (arr.custom) {
@@ -218,37 +218,29 @@ export default {
     },
     //根据条件获取栏目
     async getColumn(item) {
-      // console.log(item);
-      // console.log(this.site);
-      if (!item.category.includes('self')) {
-        let res = await this.columnOperation({ type: 'list', data: { parent_id: item.id } });
-        if (`${res.errcode}` === '0') {
-          //组合path:res.data内容都为栏目.所以,点击这些栏目显示的列表应该是信息列表,需要用栏目的id作为查询信息的parten_id查出不同栏目的信息
-          for (const col of res.data) {
+      let res = await this.columnOperation({ type: 'list', data: { parent_id: item.id } });
+      //查詢模块下所有的栏目(因为修改关联方是:抓取栏目和正常栏目关联,栏目类型(type)为bugList.所以bugList需要用content_id再去查下面关联的信息
+      if (`${res.errcode}` === '0') {
+        for (const col of res.data) {
+          if (col.type === 'bugList') {
+            col.path = `/info/list/${col.content_id}`;
+            col.children = await this.getNewsList(col, '0');
+          } else if (col.type === 'column') {
             col.path = `/info/list/${col.id}`;
-            //再将栏目下的前几条数据查出来(暂定limit=6)
-            col.children = await this.getNews(col, '1');
+            col.children = await this.getNewsList(col, '1');
+          } else if (col.type === 'content') {
+            col.path = `/info/detail?id=${col.content_id}`;
           }
-          item.children = res.data;
-        }
-      } else if (this.site && this.site.bug_column) {
-        let selfUseList = JSON.parse(this.site.bug_column);
-        let res = selfUseList.filter(fil => {
-          if (fil) return fil.parent_id === item.id;
-        });
-        for (const col of res) {
-          col.id = col.column;
-          col.path = `/info/list/${col.id}`;
-          col.children = await this.getNews(col, '0');
         }
-        item.children = res;
+        item.children = res.data;
       }
       return item;
     },
     //根据条件获取信息
-    async getNews(item, news_type) {
-      //这个item是栏目列表,循环查每个栏目6条信息
-      let res = await this.newsOperation({ type: 'list', data: { parent_id: item.id, skip: 0, limit: 4, news_type: news_type } });
+    async getNewsList(item, news_type) {
+      let data = { skip: 0, limit: 4, news_type: news_type };
+      data.parent_id = news_type === '1' ? item.id : item.content_id;
+      let res = await this.newsOperation({ type: 'list', data: data });
       if (`${res.errcode}` === '0') {
         res.data.forEach(async val => {
           let result = await this.newsOperation({ type: 'search', data: { id: val.id } });
@@ -287,7 +279,7 @@ export default {
           }
         }
         let object = { ...JSON.parse(JSON.stringify(item)), infoList: arr, column: colObject };
-        console.log(object);
+        // console.log(object);
         this.$set(this, `notice`, object);
       } else if (item.category === 'self1') {
         this.$set(this, `self1List`, item.children);
@@ -360,7 +352,7 @@ export default {
       this.$set(this.master, `bannerinfo`, { banner: this.site.banner });
       //获取入驻企业
       let result = await this.corpListOperation();
-      console.log(result);
+      // console.log(result);
       if (`${result.errcode}` === '0') {
         this.$set(this, `corpList`, result.data);
       }

+ 4 - 4
src/views/master/news/detail.vue

@@ -1,6 +1,6 @@
 <template>
   <div id="detail">
-    <login-Detail
+    <detail-info
       v-loading="loading"
       :topinfo="site"
       :menulist="menu"
@@ -8,12 +8,12 @@
       :bannerinfo="master.bannerinfo"
       :noticedetail="info"
       :footinfo="site"
-    ></login-Detail>
+    ></detail-info>
   </div>
 </template>
 
 <script>
-import loginDetail from '@publics/src/views/master/news/detail.vue';
+import DetailInfo from '@publics/src/views/master/news/detail.vue';
 import { mapActions, mapState } from 'vuex';
 import { masterInfo } from '@/config/master-info';
 import _ from 'lodash';
@@ -22,7 +22,7 @@ export default {
   name: 'detail',
   props: {},
   components: {
-    loginDetail,
+    DetailInfo,
   },
   async created() {
     await this.getSite();