Refactor Login.vue.

pull/9/head
ruibaby 2019-05-01 12:08:08 +08:00
parent 0b130907d7
commit 4e6a6b9fc0
3 changed files with 97 additions and 55 deletions

View File

@ -61,18 +61,6 @@
<a-icon type="down" /> <a-icon type="down" />
</a-button> </a-button>
</a-dropdown> </a-dropdown>
<a-button
type="primary"
icon="message"
v-if="tableListMode"
@click="toggleTableMode"
>会话模式</a-button>
<a-button
type="primary"
icon="ordered-list"
v-else
@click="toggleTableMode"
>列表模式</a-button>
</div> </div>
<div style="margin-top:15px"> <div style="margin-top:15px">
<a-table <a-table
@ -103,15 +91,39 @@
slot="action" slot="action"
slot-scope="text, record" slot-scope="text, record"
> >
<a <a-popconfirm
href="javascript:;" :title="'你确定要通过该评论?'"
@click="handleEditComment(record.id)" @confirm="handleEditStatusClick(record.id,'RECYCLE')"
>通过</a> okText="确定"
cancelText="取消"
v-if="record.status === 'AUDITING'"
>
<a href="javascript:;">通过</a>
</a-popconfirm>
<a href="javascript:;" v-if="record.status === 'PUBLISHED'"></a>
<a-divider type="vertical" /> <a-divider type="vertical" />
<a
href="javascript:;" <a-popconfirm
@click="handleDeleteComment(record.id)" :title="'你确定要将该评论移到回收站?'"
>删除</a> @confirm="handleEditStatusClick(record.id,'RECYCLE')"
okText="确定"
cancelText="取消"
v-if="record.status === 'PUBLISHED' || record.status === 'AUDITING'"
>
<a href="javascript:;">回收站</a>
</a-popconfirm>
<a-popconfirm
:title="'你确定要永久删除该评论?'"
@confirm="handleDeleteComment(record.id)"
okText="确定"
cancelText="取消"
v-else-if="record.status === 'RECYCLE'"
>
<a href="javascript:;">删除</a>
</a-popconfirm>
</span> </span>
</a-table> </a-table>
<div class="page-wrapper"> <div class="page-wrapper">
@ -139,7 +151,8 @@ const columns = [
}, },
{ {
title: '内容', title: '内容',
dataIndex: 'content' dataIndex: 'content',
scopedSlots: { customRender: 'content' }
}, },
{ {
title: '状态', title: '状态',
@ -188,7 +201,6 @@ export default {
selectedRows: [], selectedRows: [],
comments: [], comments: [],
commentsLoading: false, commentsLoading: false,
tableListMode: true,
commentStatus: commentApi.commentStatus commentStatus: commentApi.commentStatus
} }
}, },
@ -213,15 +225,11 @@ export default {
if (isSearch) { if (isSearch) {
this.queryParam.page = 0 this.queryParam.page = 0
} }
if (this.tableListMode) { commentApi.query(this.queryParam).then(response => {
commentApi.query(this.queryParam).then(response => { this.comments = response.data.data.content
this.comments = response.data.data.content this.pagination.total = response.data.data.total
this.pagination.total = response.data.data.total this.commentsLoading = false
this.commentsLoading = false })
})
} else {
// TODO tree view
}
}, },
handleEditComment(id) { handleEditComment(id) {
this.$message.success('编辑') this.$message.success('编辑')
@ -239,10 +247,6 @@ export default {
this.queryParam.keyword = null this.queryParam.keyword = null
this.queryParam.status = null this.queryParam.status = null
this.loadComments() this.loadComments()
},
toggleTableMode() {
this.tableListMode = !this.tableListMode
this.loadComments()
} }
} }
} }

View File

@ -12,7 +12,6 @@
:loading="postLoading" :loading="postLoading"
:bordered="false" :bordered="false"
title="最新文章" title="最新文章"
:bodyStyle="{ padding: '0px' }"
> >
最新文章 最新文章
</a-card> </a-card>
@ -28,9 +27,47 @@
:loading="commentLoading" :loading="commentLoading"
:bordered="false" :bordered="false"
title="最新评论" title="最新评论"
:bodyStyle="{ padding: '0px' }"
> >
最新评论 <a-comment>
<span slot="actions">Reply to</span>
<a slot="author">Han Solo</a>
<a-avatar
slot="avatar"
src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"
alt="Han Solo"
/>
<p slot="content">We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure).</p>
<a-comment>
<span slot="actions">Reply to</span>
<a slot="author">Han Solo</a>
<a-avatar
slot="avatar"
src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"
alt="Han Solo"
/>
<p slot="content">We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure).</p>
<a-comment>
<span slot="actions">Reply to</span>
<a slot="author">Han Solo</a>
<a-avatar
slot="avatar"
src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"
alt="Han Solo"
/>
<p slot="content">We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure).</p>
</a-comment>
<a-comment>
<span slot="actions">Reply to</span>
<a slot="author">Han Solo</a>
<a-avatar
slot="avatar"
src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"
alt="Han Solo"
/>
<p slot="content">We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure).</p>
</a-comment>
</a-comment>
</a-comment>
</a-card> </a-card>
</a-col> </a-col>
<a-col <a-col
@ -44,7 +81,6 @@
:loading="commentLoading" :loading="commentLoading"
:bordered="false" :bordered="false"
title="最新日志" title="最新日志"
:bodyStyle="{ padding: '0px' }"
> >
最新日志 最新日志
</a-card> </a-card>

View File

@ -39,16 +39,15 @@
/> />
</a-input> </a-input>
</a-form-item> </a-form-item>
<a-form-item <a-row>
class="animated fadeInUp"
:style="{'animation-delay': '0.3s'}"
>
<a-button <a-button
type="primary" type="primary"
:block="true" :block="true"
@click="handleLogin" @click="handleLogin"
class="animated fadeInUp"
:style="{'animation-delay': '0.3s'}"
>登录</a-button> >登录</a-button>
</a-form-item> </a-row>
</a-form> </a-form>
</div> </div>
</div> </div>
@ -101,11 +100,15 @@ export default {
</script> </script>
<style> <style>
body { body {
background-color: #f5f5f5; height: 100%;
background-color: #f8f8f8;
} }
* { * {
outline: 0; outline: 0;
} }
.ant-form-item {
margin-bottom: 24px;
}
.container { .container {
padding-right: 15px; padding-right: 15px;
padding-left: 15px; padding-left: 15px;
@ -113,21 +116,20 @@ body {
margin-left: auto; margin-left: auto;
} }
.loginForm { .loginForm {
max-width: 380px; position: absolute;
margin-top: 10%; top: 45%;
left: 50%;
margin: -160px 0 0 -160px;
width: 320px;
padding: 32px;
box-shadow: 0px 0px 20px 0px rgba(76, 50, 50, 0.08);
} }
.loginLogo { .loginLogo {
font-size: 56px; font-size: 32px;
text-align: center; text-align: center;
margin-bottom: 25px; margin-bottom: 24px;
font-weight: 500; font-weight: 500;
color: #444; color: #444;
text-shadow: #b2baba 0.1em 0.1em 0.2em; text-shadow: #b2baba 0.1em 0.1em 0.2em;
} }
.loginBody {
padding: 20px;
background-color: #fff;
-o-box-shadow: -4px 7px 46px 2px rgba(0, 0, 0, 0.1);
box-shadow: -4px 7px 46px 2px rgba(0, 0, 0, 0.1);
}
</style> </style>