Browse Source

更新新聞信息

guhongwei 5 năm trước cách đây
mục cha
commit
f8e980920b

+ 2 - 2
src/layout/achievement/achievementsDetail.vue

@@ -4,8 +4,8 @@
       <el-col :span="24" class="info">
         <h3>{{ details.title }}</h3>
         <div>
-          <span>文章来源:{{ details.source }}</span>
-          <span>时间:{{ details.date }}</span>
+          <span>文章来源:{{ details.publish_unit }}</span>
+          <span>时间:{{ details.publish_time }}</span>
         </div>
         <p>{{ details.content }}</p>
       </el-col>

+ 3 - 7
src/layout/news/infoList.vue

@@ -12,7 +12,7 @@
             <el-col :span="24" class="oneList" @click.native="zixun(item)" v-for="(item, index) in oneList" :key="index">
               <span></span>
               <span class="textOver">{{ item.title }}</span>
-              <span>{{ item.date }}</span>
+              <span>{{ item.publish_time }}</span>
             </el-col>
           </el-col>
         </el-col>
@@ -26,7 +26,7 @@
             <el-col :span="24" class="oneList" @click.native="jishu(item)" v-for="(item, index) in twoList" :key="index">
               <span></span>
               <span class="textOver">{{ item.title }}</span>
-              <span>{{ item.date }}</span>
+              <span>{{ item.publish_time }}</span>
             </el-col>
           </el-col>
         </el-col>
@@ -40,7 +40,7 @@
             <el-col :span="24" class="oneList" @click.native="jobs(item)" v-for="(item, index) in threeList" :key="index">
               <span></span>
               <span class="textOver">{{ item.title }}</span>
-              <span>{{ item.date }}</span>
+              <span>{{ item.publish_time }}</span>
             </el-col>
           </el-col>
         </el-col>
@@ -68,12 +68,9 @@ export default {
       if (item.url) {
         window.open(item.url);
       } else {
-        console.log(item);
-
         this.$router.push({ path: '/news/listDetail', query: { col_name: '工作动态', id: item.id, display: '1' } });
       }
     },
-
     async zixun(item) {
       if (item.url) {
         window.open(item.url);
@@ -81,7 +78,6 @@ export default {
         this.$router.push({ path: '/news/listDetail', query: { col_name: '科技资讯', id: item.id, display: '1' } });
       }
     },
-
     async jishu(item) {
       if (item.url) {
         window.open(item.url);

+ 6 - 33
src/views/news/index.vue

@@ -50,36 +50,9 @@ export default {
   },
   data: function() {
     return {
-      oneList: [
-        {
-          title: '標題',
-          date: '2020-01-01',
-        },
-        {
-          title: '八条数据',
-          date: '2020-01-01',
-        },
-      ],
-      twoList: [
-        {
-          title: '標題',
-          date: '2020-01-01',
-        },
-        {
-          title: '八条数据',
-          date: '2020-01-01',
-        },
-      ],
-      threeList: [
-        {
-          title: '標題',
-          date: '2020-01-01',
-        },
-        {
-          title: '八条数据',
-          date: '2020-01-01',
-        },
-      ],
+      oneList: [],
+      twoList: [],
+      threeList: [],
     };
   },
   created() {
@@ -88,11 +61,11 @@ export default {
   methods: {
     ...news({ newsQuery: 'query', newsFetch: 'fetch' }),
     async search() {
-      let res = await this.newsQuery({ skip: 0, limit: 6, col_name: '科技资讯', status: 2 });
+      let res = await this.newsQuery({ skip: 0, limit: 8, col_name: '科技资讯', status: 2 });
       if (this.$checkRes(res)) this.$set(this, `oneList`, res.data);
-      res = await this.newsQuery({ skip: 0, limit: 6, col_name: '技术前沿', status: 2 });
+      res = await this.newsQuery({ skip: 0, limit: 8, col_name: '技术前沿', status: 2 });
       if (this.$checkRes(res)) this.$set(this, `twoList`, res.data);
-      res = await this.newsQuery({ skip: 0, limit: 6, col_name: '工作动态', status: 2 });
+      res = await this.newsQuery({ skip: 0, limit: 8, col_name: '工作动态', status: 2 });
       if (this.$checkRes(res)) this.$set(this, `threeList`, res.data);
     },
   },

+ 16 - 21
src/views/news/listDetail.vue

@@ -77,19 +77,10 @@ export default {
       columnName: '',
       displays: '0',
       // 列表
-      list: [
-        {
-          title: '标题',
-          date: '2020-02-02',
-        },
-        {
-          title: '十四数据',
-          date: '2020-02-02',
-        },
-      ],
+      list: [],
       // 总数
       total: 0,
-      limit: 1,
+      limit: 10,
       // 详情
       details: {
         title: '信息标题',
@@ -138,21 +129,25 @@ export default {
       this.menuIndex = index;
       this.columnName = name;
       let res = await this.newsQuery({ skip: 0, limit: 14, col_name: name, status: 2 });
-      if (this.$checkRes(res)) this.$set(this, `list`, res.data);
-      this.$set(this, `total`, res.total);
+      if (this.$checkRes(res)) {
+        console.log(res);
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      }
       this.menuColor = 'rgb(5,73,130)';
       this.$set(this, `displays`, 0);
     },
     async search({ skip, limit }) {
-      console.log(skip);
-      console.log(limit);
       let res = await this.newsQuery({ skip, limit: 14, col_name: this.columnName, status: 2 });
-      if (this.$checkRes(res)) this.$set(this, `list`, res.data);
+      if (this.$checkRes(res)) {
+        console.log(res);
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      }
     },
 
     // 点击详情
     async detailBtn(item) {
-      console.log(item);
       if (item.url) {
         window.open(item.url);
       } else {
@@ -161,16 +156,16 @@ export default {
         this.$set(this, `displays`, 1);
       }
     },
-
     async newsearch() {
-      console.log(this.id);
-
       if (this.id) {
         let res = await this.newsFetch(this.id);
         if (this.$checkRes(res)) this.$set(this, `details`, res.data);
       } else {
         let res = await this.newsQuery({ skip: 0, limit: 14, col_name: this.columnName, status: 2 });
-        if (this.$checkRes(res)) this.$set(this, `list`, res.data);
+        if (this.$checkRes(res)) {
+          this.$set(this, `list`, res.data);
+          this.$set(this, `total`, res.total);
+        }
       }
     },
     async detail() {

+ 1 - 1
src/views/news/parts/newsList.vue

@@ -5,7 +5,7 @@
         <el-col :span="24" class="list" @click.native="detailBtn(item)" v-for="(item, index) in list" :key="index">
           <span></span>
           <span class="textOver">{{ item.title }}</span>
-          <span>{{ item.date }}</span>
+          <span>{{ item.publish_time }}</span>
         </el-col>
         <el-col :span="24" class="page">
           <pagination v-on="$listeners" :total="total" :limit="limit" position="right"></pagination>