Skip to content

Commit 6199280

Browse files
committed
v1.0
0 parents  commit 6199280

13 files changed

+7387
-0
lines changed

.babelrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"presets": [
3+
["env", { "modules": false }]
4+
]
5+
}

.gitignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.DS_Store
2+
node_modules/
3+
dist/
4+
npm-debug.log
5+
yarn-error.log
6+
7+
# Editor directories and files
8+
.idea
9+
*.suo
10+
*.ntvs*
11+
*.njsproj
12+
*.sln

README.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# smarttable
2+
3+
> A Vue.js project
4+
5+
## Build Setup
6+
7+
``` bash
8+
# install dependencies
9+
npm install
10+
11+
# serve with hot reload at localhost:8080
12+
npm run dev
13+
14+
# build for production with minification
15+
npm run build
16+
```
17+
18+
For detailed explanation on how things work, consult the [docs for vue-loader](http://vuejs.github.io/vue-loader).

index.html

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>smarttable</title>
6+
<link rel="stylesheet" href="/static/bootstrap.css" >
7+
</head>
8+
<body>
9+
<div id="app"></div>
10+
<script src="/dist/build.js"></script>
11+
</body>
12+
</html>

package.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "smarttable",
3+
"description": "A Vue.js project",
4+
"version": "1.0.0",
5+
"author": "FantasyGao <1136519360@qq.com>",
6+
"private": true,
7+
"scripts": {
8+
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
9+
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
10+
},
11+
"dependencies": {
12+
"axios": "^0.16.2",
13+
"bootstrap": "^3.3.7",
14+
"vue": "^2.3.3"
15+
},
16+
"devDependencies": {
17+
"babel-core": "^6.0.0",
18+
"babel-loader": "^6.0.0",
19+
"babel-preset-env": "^1.5.1",
20+
"cross-env": "^3.0.0",
21+
"css-loader": "^0.25.0",
22+
"file-loader": "^0.9.0",
23+
"node-sass": "^4.5.0",
24+
"sass-loader": "^5.0.1",
25+
"vue-loader": "^12.1.0",
26+
"vue-template-compiler": "^2.3.3",
27+
"webpack": "^2.6.1",
28+
"webpack-dev-server": "^2.4.5"
29+
}
30+
}

src/App.vue

+157
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
<template>
2+
<div id="index">
3+
<div class="myContent">
4+
<div class="searchItem">
5+
<div class="row">
6+
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
7+
<div class="input-group">
8+
<span class="input-group-btn">
9+
<button class="btn btn-default" type="button">标题</button>
10+
</span>
11+
<input v-model="title" type="text" class="form-control" placeholder="Search for...">
12+
</div><!-- /input-group -->
13+
</div><!-- /.col-lg-6 -->
14+
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
15+
<div class="input-group">
16+
<span class="input-group-btn">
17+
<button class="btn btn-default" type="button">类别</button>
18+
</span>
19+
<input v-model="classic" type="text" class="form-control" placeholder="Search for...">
20+
</div>
21+
</div>
22+
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
23+
<div class="input-group">
24+
<span class="input-group-btn">
25+
<button class="btn btn-default" type="button">标签</button>
26+
</span>
27+
<input v-model="tag" type="text" class="form-control" placeholder="Search for...">
28+
</div>
29+
</div>
30+
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1">
31+
<button class="searchBtn btn btn-info" @click = "search">查找</button>
32+
</div>
33+
</div>
34+
</div>
35+
<smartTable v-bind:get-message="tableData" v-on:receiveData="receiveData" ref="changeItem">
36+
<tr slot="thead">
37+
<th>标题</th>
38+
<th>类别</th>
39+
<th>标签</th>
40+
<th>日期</th>
41+
<th>作者</th>
42+
<th>状态</th>
43+
<th>浏览量</th>
44+
<th>评论数</th>
45+
<th>操作</th>
46+
</tr>
47+
<tr slot="tbody" v-for="item in Data">
48+
<td>{{item.title}}</td>
49+
<td>{{item.classic}}</td>
50+
<td>{{item.tags}}</td>
51+
<td>{{item.time}}</td>
52+
<td>{{item.author}}</td>
53+
<td v-if="item.show ==1" class="btn-success btn-xs">已发表</td>
54+
<td v-if="item.show ==0" class="btn-info btn-xs">撰写中</td>
55+
<td>{{item.pv}}</td>
56+
<td>{{item.markNum}}</td>
57+
<td>
58+
<button class="btn btn-info btn-xs" @click = "toArticle(item.id,1)">预览</button>
59+
<button class="btn btn-info btn-xs" v-if="item.show ==0" @click = "toArticle(item.id,2)">撰写</button>
60+
<button v-if="item.show ==1" @click = "downLine(item.id,item.title)" class="btn btn-warning btn-xs">下线</button>
61+
<button v-if="item.show ==0" @click = "upLine(item.id,item.title)" class="btn btn-success btn-xs">上线</button>
62+
<button class="btn btn-danger btn-xs" @click = "deleteArticle(item.id,item.title)">删除</button>
63+
</td>
64+
</tr>
65+
</smartTable>
66+
</div>
67+
</div>
68+
</template>
69+
70+
<script>
71+
import smartTable from './components/smartTable.vue'
72+
export default {
73+
data () {
74+
return {
75+
tableData: {
76+
'method': 'GET',
77+
'type': 'async',
78+
'url': './static/json.json',
79+
'query': {}
80+
},
81+
Data: [],
82+
cityList: [
83+
{
84+
id: 1,
85+
value: '全部'
86+
},
87+
{
88+
id: 2,
89+
value: '已发表'
90+
},
91+
{
92+
id: 3,
93+
value: '撰写中'
94+
}
95+
],
96+
status: 1,
97+
title: '',
98+
tag: '',
99+
classic: ''
100+
}
101+
},
102+
components: {
103+
smartTable
104+
},
105+
methods: {
106+
receiveData (data) {
107+
this.Data = data
108+
},
109+
search () {
110+
let paramsObj = {}
111+
if (this.title) {
112+
paramsObj.title = this.title
113+
}
114+
if (this.status) {
115+
paramsObj.show = this.show
116+
}
117+
if (this.tag) {
118+
paramsObj.tag = this.tag
119+
}
120+
if (this.classic) {
121+
paramsObj.classic = this.classic
122+
}
123+
this.$refs.changeItem.fetchData(paramsObj)
124+
}
125+
},
126+
mounted () {
127+
if (document.body.clientHeight < window.innerHeight) {
128+
document.getElementById('index').style.height = window.innerHeight + 'px'
129+
}
130+
}
131+
}
132+
</script>
133+
134+
<!-- Add "scoped" attribute to limit CSS to this component only -->
135+
<style scoped>
136+
#index{
137+
background-color: #f5f5d5;
138+
font-family: Georgia, serif;
139+
letter-spacing: -0.01em;
140+
word-spacing: 0.2em;
141+
width: 100%;
142+
height:100%;
143+
padding-top: 30px;
144+
}
145+
.myContent{
146+
width:90%;
147+
margin-left:5%;
148+
background:white;
149+
padding:50px;
150+
}
151+
.searchItem{
152+
height:50px;
153+
}
154+
.searchBtn{
155+
width:100%;
156+
}
157+
</style>

src/assets/logo.png

6.69 KB
Loading

0 commit comments

Comments
 (0)