Skip to content

Commit a7b09a2

Browse files
committed
add && remove
1 parent 3e3819c commit a7b09a2

File tree

18 files changed

+421
-20169
lines changed

18 files changed

+421
-20169
lines changed

src/api/article.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,11 @@ export function getList() {
66
method: 'get'
77
});
88
}
9+
10+
export function getArticle() {
11+
return fetch({
12+
url: '/article/detail',
13+
method: 'get'
14+
});
15+
}
16+

src/api/remoteSearch.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { fetch } from 'utils/fetch';
2+
3+
export function userSearch(name) {
4+
return fetch({
5+
url: '/search/user',
6+
method: 'get',
7+
params: { name }
8+
});
9+
}

src/components/Tinymce/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
// language_url: '/static/tinymce/langs/zh_CN.js',
7676
toolbar: this.toolbar,
7777
menubar: this.menubar,
78-
plugins: 'advlist,autolink,code,powerpaste,textcolor, colorpicker,fullscreen,link,lists,media,wordcount, imagetools,watermark',
78+
plugins: 'advlist,autolink,code,paste,textcolor, colorpicker,fullscreen,link,lists,media,wordcount, imagetools,watermark',
7979
end_container_on_empty_block: true,
8080
powerpaste_word_import: 'clean',
8181
code_dialog_height: 450,

src/mock/article.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import Mock from 'mockjs';
2+
3+
4+
const List = [];
5+
const count = 20;
6+
7+
8+
for (let i = 0; i < count; i++) {
9+
List.push(Mock.mock({
10+
id: '@id',
11+
title: '@ctitle(10, 20)',
12+
'status|1': ['published', 'draft'],
13+
author: '@cname',
14+
display_time: '@datetime',
15+
pageviews: '@integer(300, 5000)'
16+
}));
17+
}
18+
19+
export default {
20+
getList: () => new Promise(resolve => {
21+
setTimeout(() => {
22+
resolve([200, {
23+
data: List
24+
}]);
25+
}, 100);
26+
}),
27+
getArticle: () => new Promise(resolve => {
28+
setTimeout(() => {
29+
resolve([200, {
30+
data: {
31+
id: 120000000001,
32+
author: { key: 'mockPan' },
33+
source_name: '原创作者',
34+
category_item: [{ key: 'global', name: '全球' }],
35+
comment_disabled: false,
36+
content: '<p>我是测试数据我是测试数据</p><p><img class="wscnph" src="https://wpimg.wallstcn.com/4c69009c-0fd4-4153-b112-6cb53d1cf943" data-wscntype="image" data-wscnh="300" data-wscnw="400" data-mce-src="https://wpimg.wallstcn.com/4c69009c-0fd4-4153-b112-6cb53d1cf943"></p>"',
37+
content_short: '我是测试数据',
38+
display_time: +new Date(),
39+
image_uri: 'https://wpimg.wallstcn.com/e4558086-631c-425c-9430-56ffb46e70b3',
40+
platforms: ['a-platform'],
41+
source_uri: 'https://github.com/PanJiaChen/vue-element-admin',
42+
status: 'published',
43+
tags: [],
44+
title: ''
45+
}
46+
}]);
47+
}, 100);
48+
})
49+
};

src/mock/index.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,19 @@
11
import axios from 'axios';
2-
import Mock from 'mockjs';
32
import MockAdapter from 'axios-mock-adapter';
4-
import article_tableAPI from './article_table'
3+
import articleAPI from './article';
4+
import article_tableAPI from './article_table';
5+
import remoteSearchAPI from './remoteSearch';
56
const mock = new MockAdapter(axios);
67

7-
const articleList = {
8-
'data|20': [{
9-
id: '@id',
10-
title: '@ctitle(10, 20)',
11-
'status|1': ['published', 'draft'],
12-
author: '@cname',
13-
display_time: '@datetime',
14-
pageviews: '@integer(300, 5000)'
15-
}]
16-
}
17-
const data = JSON.stringify(Mock.mock(articleList))
18-
mock.onGet('/article/list').reply(200, data);
198

9+
mock.onGet('/article/list').reply(articleAPI.getList);
10+
mock.onGet('/article/detail').reply(articleAPI.getArticle);
2011

2112
mock.onGet('/article_table/list').reply(article_tableAPI.getList);
2213
mock.onGet('/article_table/pv').reply(article_tableAPI.getPv);
2314

2415

16+
mock.onGet('/search/user').reply(remoteSearchAPI.searchUser);
17+
2518

2619
export default mock;

src/mock/remoteSearch.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import Mock from 'mockjs';
2+
3+
const NameList = [];
4+
const count = 100;
5+
6+
for (let i = 0; i < count; i++) {
7+
NameList.push(Mock.mock({
8+
name: '@first'
9+
}));
10+
}
11+
NameList.push({ name: 'mockPan' })
12+
13+
export default {
14+
searchUser: config => {
15+
const { name } = config.params;
16+
const mockNameList = NameList.filter(item => {
17+
const lowerCaseName = item.name.toLowerCase()
18+
if (name && lowerCaseName.indexOf(name.toLowerCase()) < 0) return false;
19+
return true;
20+
});
21+
return new Promise(resolve => {
22+
setTimeout(() => {
23+
resolve([200, {
24+
items: mockNameList
25+
}]);
26+
}, 100);
27+
})
28+
}
29+
};

src/router/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ const Theme = resolve => require(['../views/theme/index'], resolve);
5151
/* example*/
5252
const DynamicTable = resolve => require(['../views/example/dynamictable'], resolve);
5353
const Table = resolve => require(['../views/example/table'], resolve);
54+
const Form1 = resolve => require(['../views/example/form1'], resolve);
55+
const Form2 = resolve => require(['../views/example/form2'], resolve);
5456

5557

5658
/* admin*/
@@ -170,7 +172,9 @@ export default new Router({
170172
icon: 'zonghe',
171173
children: [
172174
{ path: 'dynamictable', component: DynamicTable, name: '动态table' },
173-
{ path: 'table', component: Table, name: '综合table' }
175+
{ path: 'table', component: Table, name: '综合table' },
176+
{ path: 'form1', component: Form1, name: '综合form1' }
177+
// { path: 'form2', component: Form2, name: '综合form2' }
174178
]
175179
},
176180
// {

src/styles/element-ui.scss

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,25 @@
5959
margin: 0 auto;
6060
}
6161

62+
63+
//文章页textarea修改样式
64+
.article-textarea {
65+
textarea {
66+
padding-right: 40px;
67+
resize: none;
68+
border: none;
69+
border-radius: 0px;
70+
border-bottom: 1px solid #bfcbd9;
71+
}
72+
}
73+
74+
//element ui upload
75+
.upload-container {
76+
.el-upload {
77+
width: 100%;
78+
.el-upload-dragger {
79+
width: 100%;
80+
height: 200px;
81+
}
82+
}
83+
}

0 commit comments

Comments
 (0)