Commit b027e386 authored by lixin's avatar lixin

课程提问,分页

parent 8ffab53c
...@@ -82,11 +82,9 @@ export default { ...@@ -82,11 +82,9 @@ export default {
return { return {
columns: columns, columns: columns,
data: [], data: [],
searchPage: { pagination: {
pageIndex: 1, pageIndex: 1,
pageSize: 10, pageSize: 10,
},
pagination: {
showQuickJumper: true, showQuickJumper: true,
showSizeChanger: true, showSizeChanger: true,
}, },
...@@ -111,17 +109,15 @@ export default { ...@@ -111,17 +109,15 @@ export default {
}, },
// 创建完毕 // 创建完毕
created() { created() {
let questionId = this.$route.query.id; this.getAnswerList(this.pagination);
if (questionId) {
this.searchPage.questionId = questionId;
this.getAnswerList(this.searchPage);
}
}, },
// 即将更新渲染 // 即将更新渲染
beforeUpdate() {}, beforeUpdate() {},
methods: { methods: {
getAnswerList(query) { getAnswerList(query) {
this.loading = true; this.loading = true;
let questionId = this.$route.query.id;
query.questionId = questionId;
fetchAnswerList(query) fetchAnswerList(query)
.then((res) => { .then((res) => {
if (res.code == 200) { if (res.code == 200) {
...@@ -146,7 +142,7 @@ export default { ...@@ -146,7 +142,7 @@ export default {
.then((res) => { .then((res) => {
if (res.resp_code == 200) { if (res.resp_code == 200) {
this.$message.info("回复成功"); this.$message.info("回复成功");
this.getAnswerList(this.searchPage); this.getAnswerList(this.pagination);
} else { } else {
this.$message.info(res.resp_msg); this.$message.info(res.resp_msg);
} }
...@@ -176,11 +172,13 @@ export default { ...@@ -176,11 +172,13 @@ export default {
this.$refs.formModelRef.resetFields(); this.$refs.formModelRef.resetFields();
}, },
handleTableChange() { handleTableChange(pagination) {
let queryParam = { ...this.searchPage }; const pager = { ...this.pagination };
queryParam.pageIndex = pagination.current; pager.current = pagination.current;
queryParam.pageSize = pagination.pageSize; pager.pageIndex = pagination.current;
this.getList(queryParam); pager.pageSize = pagination.pageSize;
this.pagination = pager;
this.getAnswerList(this.pagination);
}, },
navigateIndexPage(row) { navigateIndexPage(row) {
let queryParam = { let queryParam = {
......
...@@ -158,8 +158,14 @@ export default { ...@@ -158,8 +158,14 @@ export default {
let queryParam = { ...this.searchPage }; let queryParam = { ...this.searchPage };
this.getList(queryParam); this.getList(queryParam);
}, },
handleTableChange() { handleTableChange(pagination) {
let queryParam = { ...this.searchPage }; let queryParam = { ...this.searchPage };
const pager = { ...this.pagination };
pager.current = pagination.current;
pager.pageIndex = pagination.current;
pager.pageSize = pagination.pageSize;
this.pagination = pager;
queryParam.pageIndex = pagination.current; queryParam.pageIndex = pagination.current;
queryParam.pageSize = pagination.pageSize; queryParam.pageSize = pagination.pageSize;
this.getList(queryParam); this.getList(queryParam);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment