Skip to content

Commit

Permalink
提交
Browse files Browse the repository at this point in the history
  • Loading branch information
frontHu committed Dec 12, 2018
1 parent c2e60b4 commit 849cec0
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 20 deletions.
1 change: 0 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

<style>
* {
box-sizing: border-box;
}
html, body {
Expand Down
8 changes: 8 additions & 0 deletions src/api/blog.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,12 @@ import fetch from './index'

export function saveBlogApi(data) {
return fetch('/blog/save', data)
}

export function getBlogList(data) {
return fetch('/blog/all', data)
}

export function deleteBlog(id) {
return fetch('/blog/delete', id)
}
1 change: 0 additions & 1 deletion src/api/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import axios from 'axios'
// import queryString from './../untils/querysting'

const base_url = process.env.NODE_ENV === 'production' ? '/api' : '/server'

Expand Down
7 changes: 7 additions & 0 deletions src/components/Slider/menulist.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ export default [
parent: -1,
icon: require('./../../assets/icon1.png'),
link: "/home/markdown",
childMenus: [{
id: "1",
menuName: "写一篇文章",
parent: -1,
icon: require('./../../assets/icon1.png'),
link: "/home/markdown",
}]
},
{
id: "2",
Expand Down
59 changes: 55 additions & 4 deletions src/page/Article/Article.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,64 @@
<template>
<div class="article"></div>
<div class="article">
<el-table
border
:data="tableData.list">
<el-table-column
label="序号"
type="index"
width="80px"></el-table-column>
<el-table-column label="标题" prop="title"></el-table-column>
<el-table-column label="创建时间" prop="createTime"></el-table-column>
<el-table-column label="描述" prop="desc"></el-table-column>
<el-table-column label="阅读人数" prop="seeNumber"></el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
@click="handleDelete(scope.row)"
type="danger"
size="mini">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</template>

<script>
import { getBlogList, deleteBlog } from './../../api/blog.api.js'
export default {
name: 'Article'
name: 'Article',
data() {
return {
tableData: {
list: [],
currentPage: 2,
pageSize: 10
}
}
},
created() {
this.getBlog()
},
methods: {
getBlog() {
let { currentPage, pageSize } = this.tableData;
let params = { currentPage, pageSize }
getBlogList(params).then(res => {
console.log(res, 'res')
this.tableData.list = res ? res.list.content : []
})
},
handleDelete(item) {
deleteBlog({_id: item._id}).then(res => {
this.getBlog()
})
}
}
}
</script>

<style>
<style lang="scss" scoped>
.article {
padding: 20px;
}
</style>
22 changes: 12 additions & 10 deletions src/page/Friend/Friend.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</template>

<script>
import { addFriend } from './../../api/friend.api.js'
// import { addFriend } from './../../api/friend.api.js'
export default {
name: 'Friend',
data() {
Expand All @@ -61,18 +61,20 @@ export default {
desc: '',
blog: '',
github: '',
imageUrl: ''
imageUrl: '',
searchText: '',
searchText1: ''
}
},
methods: {
uploadImg(e) {
let file = e.target.files[0]
let formData = new FormData()
formData.append('file', file)
addFriend(formData).then(res => {
console.log(res, 'res')
})
}
// uploadImg(e) {
// let file = e.target.files[0]
// let formData = new FormData()
// formData.append('file', file)
// addFriend(formData).then(res => {
// console.log(res, 'res')
// })
// }
}
}
</script>
Expand Down
13 changes: 10 additions & 3 deletions src/page/Login/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@
placeholder="admin"
>
<input
v-model="password"
@input="inputHandle($event,'password')"
v-model.number="password"
type="text"
class="password"
placeholder="password"
>
<button class="login-btn" @click="handleLogin">Login</button>
<span>{{password}}</span>
<button
class="login-btn"
@click="handleLogin"
>Login</button>
</div>
</div>
</template>
Expand All @@ -31,9 +34,13 @@ export default {
},
methods: {
handleLogin() {
console.log('tag', '')
},
inputHandle(e, type) {
this[type] = e.target.value
},
handleKey(e) {
console.log(e.keyCode)
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/router/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default new Router({
children: [
{path: '', component: Markdown},
{path: 'markdown', component: Markdown},
{path: 'article/:id', component: Article},
{path: 'article', component: Article},
{path: 'friends', component: Friend}
]
}
Expand Down

0 comments on commit 849cec0

Please sign in to comment.