Browse Source

列表页接口

reloaded 5 years ago
parent
commit
4ce6722f0d
4 changed files with 56 additions and 118 deletions
  1. 13 13
      src/store/index.js
  2. 2 4
      src/views/direct.vue
  3. 5 49
      src/views/dynamic/list.vue
  4. 36 52
      src/views/technical/list.vue

+ 13 - 13
src/store/index.js

@@ -1,16 +1,16 @@
-import Vue from "vue";
-import Vuex from "vuex";
-import login from "@common/store/login";
-import chat from "@common/store/live/chat";
-import roomchat from "@common/store/live/room-chat";
-import apply from "@common/store/live/apply";
-import dock from "@common/store/live/dock";
-import news from "@common/store/live/news";
-import market from "@common/store/market/market";
-import marketproduct from "@common/store/market/marketproduct";
-import talentExperts from "@common/store/market/talentExperts";
-import * as ustate from "@common/store/user/state";
-import * as umutations from "@common/store/user/mutations";
+import Vue from 'vue';
+import Vuex from 'vuex';
+import login from '@common/store/login';
+import chat from '@common/store/live/chat';
+import roomchat from '@common/store/live/room-chat';
+import apply from '@common/store/live/apply';
+import dock from '@common/store/live/dock';
+import news from '@common/store/live/news';
+import market from '@common/store/market/market';
+import marketproduct from '@common/store/market/marketproduct';
+import talentExperts from '@common/store/market/talentExperts';
+import * as ustate from '@common/store/user/state';
+import * as umutations from '@common/store/user/mutations';
 Vue.use(Vuex);
 
 export default new Vuex.Store({

+ 2 - 4
src/views/direct.vue

@@ -164,7 +164,6 @@
 
           <el-col :span="24" class="newimage2">
             <el-image :src="two" style="width:100%;height:100px;position:relative;"> </el-image>
-         
           </el-col>
 
           <el-col :span="24">
@@ -418,8 +417,7 @@ export default {
 <style lang="less" scoped>
 .w_1200 {
   margin: 0 auto;
-  width: 1200px
-  ;
+  width: 1200px;
 }
 
 .livetop {
@@ -721,7 +719,7 @@ p {
   float: left;
   width: 100%;
   border-bottom: 1px dashed #ff8500;
-     padding: 20px 0;
+  padding: 20px 0;
 }
 
 .jiabin .jiabinlist ul li:last-child {

+ 5 - 49
src/views/dynamic/list.vue

@@ -8,8 +8,8 @@
           <p @click="changeMenu(item.name, index)" :style="`color:${menuIndex == index ? menuColor : ''}`">{{ item.name }}</p>
         </el-col>
       </el-col>
-      <el-col v-if="menuIndex == '0'" :span="19" class="info">
-        <el-col class="leftInfo">
+      <el-col :span="19" class="info">
+        <el-col v-if="menuIndex == '0'" class="leftInfo">
           <el-col :span="24" class="leftTop">
             <span>|</span> <span>{{ menuName }}</span>
           </el-col>
@@ -20,21 +20,7 @@
             <el-table-column prop="buy_unit" label="采购单位" show-overflow-tooltip="true"> </el-table-column>
           </el-table>
         </el-col>
-        <el-col class="page">
-          <el-pagination
-            background
-            @size-change="handleSizeChange"
-            @current-change="handleCurrentChange"
-            :current-page.sync="currentPage"
-            :page-size="10"
-            layout="total,prev, pager, next, jumper"
-            :total="1000"
-          >
-          </el-pagination>
-        </el-col>
-      </el-col>
-      <el-col v-if="menuIndex == '1'" :span="19" class="info">
-        <el-col class="leftInfo">
+        <el-col v-if="menuIndex == '1'" class="leftInfo">
           <el-col :span="24" class="leftTop">
             <span>|</span> <span>{{ menuName }}</span>
           </el-col>
@@ -45,21 +31,7 @@
             <el-table-column prop="buy_unit" label="采购单位" show-overflow-tooltip="true"> </el-table-column>
           </el-table>
         </el-col>
-        <el-col class="page">
-          <el-pagination
-            background
-            @size-change="handleSizeChange"
-            @current-change="handleCurrentChange"
-            :current-page.sync="currentPage"
-            :page-size="10"
-            layout="total,prev, pager, next, jumper"
-            :total="1000"
-          >
-          </el-pagination>
-        </el-col>
-      </el-col>
-      <el-col v-if="menuIndex == '2'" :span="19" class="info">
-        <el-col class="leftInfo">
+        <el-col v-if="menuIndex == '2'" class="leftInfo">
           <el-col :span="24" class="leftTop">
             <span>|</span> <span>{{ menuName }}</span>
           </el-col>
@@ -70,21 +42,7 @@
             <el-table-column prop="buy_unit" label="采购单位" show-overflow-tooltip="true"> </el-table-column>
           </el-table>
         </el-col>
-        <el-col class="page">
-          <el-pagination
-            background
-            @size-change="handleSizeChange"
-            @current-change="handleCurrentChange"
-            :current-page.sync="currentPage"
-            :page-size="10"
-            layout="total,prev, pager, next, jumper"
-            :total="1000"
-          >
-          </el-pagination>
-        </el-col>
-      </el-col>
-      <el-col v-if="menuIndex == '3'" :span="19" class="info">
-        <el-col class="leftInfo">
+        <el-col v-if="menuIndex == '3'" class="leftInfo">
           <el-col :span="24" class="leftTop">
             <span>|</span> <span>{{ menuName }}</span>
           </el-col>
@@ -166,8 +124,6 @@ export default {
       }
     },
     changeMenu(name, index) {
-      console.log(name);
-      console.log(index);
       this.menuIndex = index;
       this.menuColor = 'rgb(254, 149, 14)';
       this.menuName = name;

+ 36 - 52
src/views/technical/list.vue

@@ -8,8 +8,8 @@
           <p @click="changeMenu(item.name, index)" :style="`color:${menuIndex == index ? menuColor : ''}`">{{ item.name }}</p>
         </el-col>
       </el-col>
-      <el-col v-if="menuIndex == '0'" :span="19" class="info">
-        <el-col class="leftInfo">
+      <el-col :span="19" class="info">
+        <el-col v-if="menuIndex == '0'" class="leftInfo">
           <el-col :span="24" class="leftTop">
             <span>|</span> <span>{{ menuName }}</span>
           </el-col>
@@ -21,21 +21,7 @@
             </p>
           </el-col>
         </el-col>
-        <el-col class="page">
-          <el-pagination
-            background
-            @size-change="handleSizeChange"
-            @current-change="handleCurrentChange"
-            :current-page.sync="currentPage"
-            :page-size="10"
-            layout="total,prev, pager, next, jumper"
-            :total="1000"
-          >
-          </el-pagination>
-        </el-col>
-      </el-col>
-      <el-col v-if="menuIndex == '1'" :span="19" class="info">
-        <el-col class="leftInfo">
+        <el-col v-if="menuIndex == '1'" class="leftInfo">
           <el-col :span="24" class="leftTop">
             <span>|</span> <span>{{ menuName }}</span>
           </el-col>
@@ -46,21 +32,7 @@
             </p>
           </el-col>
         </el-col>
-        <el-col class="page">
-          <el-pagination
-            background
-            @size-change="handleSizeChange"
-            @current-change="handleCurrentChange"
-            :current-page.sync="currentPage"
-            :page-size="10"
-            layout="total,prev, pager, next, jumper"
-            :total="1000"
-          >
-          </el-pagination>
-        </el-col>
-      </el-col>
-      <el-col v-if="menuIndex == '2'" :span="19" class="info">
-        <el-col class="leftInfo">
+        <el-col v-if="menuIndex == '2'" class="leftInfo">
           <el-col :span="24" class="leftTop">
             <span>|</span> <span>{{ menuName }}</span>
           </el-col>
@@ -71,21 +43,7 @@
             </p>
           </el-col>
         </el-col>
-        <el-col class="page">
-          <el-pagination
-            background
-            @size-change="handleSizeChange"
-            @current-change="handleCurrentChange"
-            :current-page.sync="currentPage"
-            :page-size="10"
-            layout="total,prev, pager, next, jumper"
-            :total="1000"
-          >
-          </el-pagination>
-        </el-col>
-      </el-col>
-      <el-col v-if="menuIndex == '3'" :span="19" class="info">
-        <el-col class="leftInfo">
+        <el-col v-if="menuIndex == '3'" class="leftInfo">
           <el-col :span="24" class="leftTop">
             <span>|</span> <span>{{ menuName }}</span>
           </el-col>
@@ -103,9 +61,9 @@
             @size-change="handleSizeChange"
             @current-change="handleCurrentChange"
             :current-page.sync="currentPage"
-            :page-size="10"
+            :page-size="pageSize"
             layout="total,prev, pager, next, jumper"
-            :total="1000"
+            :total="pageTotal"
           >
           </el-pagination>
         </el-col>
@@ -115,6 +73,9 @@
 </template>
 
 <script>
+import _ from 'lodash';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: news } = createNamespacedHelpers('news');
 export default {
   name: 'list',
   props: {},
@@ -126,6 +87,8 @@ export default {
     menuName: '专题研讨',
     menuColor: 'rgb(254, 149, 14)',
     currentPage: 1,
+    pageSize: 0,
+    pageTotal: 0,
     zhuantiList: [
       {
         publish_time: '2020-05-01',
@@ -183,6 +146,7 @@ export default {
   },
   computed: {},
   methods: {
+    ...news(['query']),
     async searchList({ skip = 0, limit = 10, ...info } = {}) {
       if (this.$route.query.column_name == '专题研讨') {
         this.changeMenu(this.$route.query.column_name, 0);
@@ -194,12 +158,32 @@ export default {
         this.changeMenu(this.$route.query.column_name, 3);
       }
     },
-    changeMenu(name, index) {
-      console.log(name);
-      console.log(index);
+    async changeMenu(name, index) {
       this.menuIndex = index;
       this.menuColor = 'rgb(254, 149, 14)';
       this.menuName = name;
+      console.log(name);
+      this.initList({ name });
+    },
+    async initList({ name, skip = 0, limit = 10, ...info } = {}) {
+      let res = [];
+      console.log(name);
+      if (name == '专题研讨') {
+        res = await this.query({ skip, limit, column_name: '专题研讨', ...info });
+        this.$set(this, `zhuantiList`, res.data);
+      } else if (name == '技术问答') {
+        res = await this.query({ skip, limit, column_name: '技术问答', ...info });
+        this.$set(this, `jishuList`, res.data);
+      } else if (name == '行业研究') {
+        res = await this.query({ skip, limit, column_name: '行业研究', ...info });
+        this.$set(this, `hangyeList`, res.data);
+      } else if (name == '教育培训') {
+        res = await this.query({ skip, limit, column_name: '教育培训', ...info });
+        this.$set(this, `jiaoyuList`, res.data);
+      }
+      console.log(res);
+
+      this.$set(this, `pageTotal`, res.total);
     },
     handleSizeChange(val) {
       console.log(`每页 ${val} 条`);