|
|
@@ -7,7 +7,9 @@
|
|
|
<h3>协作群组</h3>
|
|
|
<p>适用于云端工作团队共享、管理日报和工时统计等</p>
|
|
|
</section>
|
|
|
- <nuxt-link to="/group/create"><el-button type="primary">创建</el-button></nuxt-link>
|
|
|
+ <nuxt-link to="/group/create">
|
|
|
+ <el-button type="primary">创建</el-button>
|
|
|
+ </nuxt-link>
|
|
|
</section>
|
|
|
<section v-if="list" class="list">
|
|
|
<nuxt-link :to="`/group/${item.id}`" v-for="(item, index) of list" :key="index">
|
|
|
@@ -38,6 +40,14 @@
|
|
|
</section>
|
|
|
</nuxt-link>
|
|
|
</section>
|
|
|
+ <el-pagination
|
|
|
+ v-if="pageTotal"
|
|
|
+ background
|
|
|
+ layout="prev, pager, next"
|
|
|
+ :total="pageTotal"
|
|
|
+ :page-size="pageSize"
|
|
|
+ @current-change="changePage"
|
|
|
+ ></el-pagination>
|
|
|
</section>
|
|
|
</ws-page>
|
|
|
</template>
|
|
|
@@ -55,6 +65,9 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
list: null,
|
|
|
+ pageSize: 15,
|
|
|
+ pageTotal: 0,
|
|
|
+ currentPage: 1,
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
@@ -67,11 +80,16 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
async getList() {
|
|
|
- let res = await this.$post(`/api/group/list`)
|
|
|
+ let res = await this.$post(`/api/group/list`, { page: this.currentPage, page_size: this.pageSize })
|
|
|
if(res) {
|
|
|
console.log(res)
|
|
|
this.list = res.data.list
|
|
|
+ this.pageTotal = res.data.total
|
|
|
}
|
|
|
+ },
|
|
|
+ changePage(page) {
|
|
|
+ this.currentPage = page
|
|
|
+ this.getList()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -171,4 +189,8 @@ export default {
|
|
|
.count {
|
|
|
color: #999;
|
|
|
}
|
|
|
+.el-pagination {
|
|
|
+ margin-top: 20px;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
</style>
|