diff --git a/src/api/article_table.js b/src/api/article_table.js
index 5f0d4595..e56c58e3 100644
--- a/src/api/article_table.js
+++ b/src/api/article_table.js
@@ -1,48 +1,17 @@
import { fetch } from 'utils/fetch';
-import { param } from 'utils';
-
-// export function calendarsList(query) {
-// return fetch({
-// url: '/finfo/calendars?' + param(query),
-// method: 'get'
-// });
-// }
export function fetchList(query) {
return fetch({
url: '/article_table/list',
- method: 'get'
+ method: 'get',
+ params: query
});
}
-
-export function calendarCreate(data) {
+export function fetchPv(pv) {
return fetch({
- url: '/finfo/calendar/create',
- method: 'post',
- data
- });
-}
-
-export function calendarDelete(id) {
- return fetch({
- url: '/finfo/calendar/delete',
- method: 'post',
- data: { id }
- });
-}
-
-export function calendarUpdate(data) {
- return fetch({
- url: '/finfo/calendar/update',
- method: 'post',
- data
- });
-}
-
-export function calcountriesList() {
- return fetch({
- url: '/finfo/calcountries',
- method: 'get'
+ url: '/article_table/pv',
+ method: 'get',
+ params: { pv }
});
}
diff --git a/src/mock/article_table.js b/src/mock/article_table.js
index d82629b8..1cd886e6 100644
--- a/src/mock/article_table.js
+++ b/src/mock/article_table.js
@@ -2,7 +2,7 @@ import Mock from 'mockjs';
const List = [];
-const count = 50;
+const count = 100;
for (let i = 0; i < count; i++) {
List.push(Mock.mock({
@@ -12,34 +12,36 @@ for (let i = 0; i < count; i++) {
title: '@ctitle(10, 20)',
forecast: '@float(0, 100, 2, 2)',
importance: '@integer(1, 3)',
- 'calendar_type|1': ['FD', 'FE', 'BI', 'VN'],
- 'status|1': ['published', 'draft', 'deleted']
+ 'type|1': ['FD', 'FE', 'BI', 'VN'],
+ 'status|1': ['published', 'draft', 'deleted'],
+ pageviews: '@integer(300, 5000)'
}));
}
export default {
- getList: config =>
- // let {page, sortWay, startTime, endTime, userName, age} = config.params;
- // let mockUsers = _Users.filter(user => {
- // if (startTime && user.date < startTime) return false;
- // if (endTime && user.date > endTime) return false;
- // if (userName && user.name !== userName) return false;
- // if (age && user.age !== age) return false;
- // return true;
- // });
- // if (sortWay) {
- // let {order, prop} = sortWay;
- // mockUsers = mockUsers.sort((u1, u2) => order === 'ascending' ? u1[prop] - u2[prop] : u2[prop] - u1[prop]);
- // }
- // if (page === 0) page++;
- // mockUsers = mockUsers.filter((u, index) => index < 20 * page && index >= 20 * (page - 1));
- new Promise(resolve => {
- setTimeout(() => {
- resolve([200, {
- total: List.length,
- items: List
- }]);
- }, 100);
- })
-
+ getList: config => {
+ const { importance, type, title, page, limit } = config.params;
+ const mockList = List.filter(item => {
+ if (importance && item.importance !== importance) return false;
+ if (type && item.type !== type) return false;
+ if (title && item.title.indexOf(title) < 0) return false;
+ return true;
+ });
+ const pageList = mockList.filter((item, index) => index < limit * page && index >= limit * (page - 1));
+ return new Promise(resolve => {
+ setTimeout(() => {
+ resolve([200, {
+ total: mockList.length,
+ items: pageList
+ }]);
+ }, 100);
+ })
+ },
+ getPv: () => new Promise(resolve => {
+ setTimeout(() => {
+ resolve([200, {
+ pvData: [{ key: 'PC网站', pv: 1024 }, { key: 'mobile网站', pv: 1024 }, { key: 'ios', pv: 1024 }, { key: 'android', pv: 1024 }]
+ }]);
+ }, 100);
+ })
};
diff --git a/src/mock/index.js b/src/mock/index.js
index 081c2757..f1312f7b 100644
--- a/src/mock/index.js
+++ b/src/mock/index.js
@@ -19,6 +19,7 @@ mock.onGet('/article/list').reply(200, data);
mock.onGet('/article_table/list').reply(article_tableAPI.getList);
+mock.onGet('/article_table/pv').reply(article_tableAPI.getPv);
diff --git a/src/views/example/table.vue b/src/views/example/table.vue
index 197bb383..bf288937 100644
--- a/src/views/example/table.vue
+++ b/src/views/example/table.vue
@@ -4,16 +4,12 @@
-
-
-
-
+
@@ -40,7 +36,7 @@
{{scope.row.title}}
- {{scope.row.calendar_type | typeFilter}}
+ {{scope.row.type | typeFilter}}
@@ -57,6 +53,12 @@
+
+
+ {{scope.row.pageviews}}
+
+
+
{{scope.row.status}}
@@ -77,7 +79,7 @@
@@ -85,7 +87,7 @@
-
+
@@ -122,12 +124,23 @@
确 定
+
+
+
+
+
+
+
+
+