|
@@ -2,8 +2,11 @@ import { getBlock, getBlockRow, getRowItem, setBlockRow, addBlockRow, setRowItem
|
|
|
|
|
|
const state = {
|
|
const state = {
|
|
getBlockData: [],
|
|
getBlockData: [],
|
|
|
|
+ getBlockDataLength: 0,
|
|
getBlockRowData: [],
|
|
getBlockRowData: [],
|
|
|
|
+ getBlockRowDataLength: 0,
|
|
getRowItemData: [],
|
|
getRowItemData: [],
|
|
|
|
+ getRowItemDataLength: 0,
|
|
getTempateData: []
|
|
getTempateData: []
|
|
}
|
|
}
|
|
|
|
|
|
@@ -11,12 +14,21 @@ const mutations = {
|
|
GET_BLOCK: (state, data) => {
|
|
GET_BLOCK: (state, data) => {
|
|
state.getBlockData = data
|
|
state.getBlockData = data
|
|
},
|
|
},
|
|
|
|
+ GET_BLOCK_LENGTH: (state, length) => {
|
|
|
|
+ state.getBlockDataLength = length
|
|
|
|
+ },
|
|
GET_BLOCK_ROW: (state, data) => {
|
|
GET_BLOCK_ROW: (state, data) => {
|
|
state.getBlockRowData = data
|
|
state.getBlockRowData = data
|
|
},
|
|
},
|
|
|
|
+ BLOCK_ROW_LENGTH: (state, length) => {
|
|
|
|
+ state.getBlockRowDataLength = length
|
|
|
|
+ },
|
|
GET_ROW_ITEM: (state, data) => {
|
|
GET_ROW_ITEM: (state, data) => {
|
|
state.getRowItemData = data
|
|
state.getRowItemData = data
|
|
},
|
|
},
|
|
|
|
+ ROW_ITEM__LENGTH: (state, length) => {
|
|
|
|
+ state.getRowItemDataLength = length
|
|
|
|
+ },
|
|
GET_TEMPATE: (state, data) => {
|
|
GET_TEMPATE: (state, data) => {
|
|
state.getTempateData = data
|
|
state.getTempateData = data
|
|
}
|
|
}
|
|
@@ -24,11 +36,13 @@ const mutations = {
|
|
|
|
|
|
const actions = {
|
|
const actions = {
|
|
// 获取课程表列表
|
|
// 获取课程表列表
|
|
- getBlockList({ commit, state }) {
|
|
|
|
|
|
+ getBlockList({ commit, state }, obj) {
|
|
|
|
+ const page = (obj.page - 1) * 10
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
getBlock().then((res) => {
|
|
getBlock().then((res) => {
|
|
const list = res.data
|
|
const list = res.data
|
|
- commit('GET_BLOCK', list)
|
|
|
|
|
|
+ commit('GET_BLOCK_LENGTH', list.length)
|
|
|
|
+ commit('GET_BLOCK', list.splice(page, 10))
|
|
resolve()
|
|
resolve()
|
|
}).catch(error => {
|
|
}).catch(error => {
|
|
reject(error)
|
|
reject(error)
|
|
@@ -38,11 +52,13 @@ const actions = {
|
|
// 获取课程表行列表
|
|
// 获取课程表行列表
|
|
getBlockRowList({ commit, state }, obj) {
|
|
getBlockRowList({ commit, state }, obj) {
|
|
const id = obj.id
|
|
const id = obj.id
|
|
|
|
+ const page = (obj.page - 1) * 10
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
getBlockRow(id).then((res) => {
|
|
getBlockRow(id).then((res) => {
|
|
console.log(res)
|
|
console.log(res)
|
|
const list = res.data
|
|
const list = res.data
|
|
- commit('GET_BLOCK_ROW', list)
|
|
|
|
|
|
+ commit('BLOCK_ROW_LENGTH', list.length)
|
|
|
|
+ commit('GET_BLOCK_ROW', list.splice(page, 10))
|
|
resolve()
|
|
resolve()
|
|
}).catch(error => {
|
|
}).catch(error => {
|
|
reject(error)
|
|
reject(error)
|
|
@@ -52,11 +68,13 @@ const actions = {
|
|
// 获取首页项列表
|
|
// 获取首页项列表
|
|
getRowItemList({ commit, state }, obj) {
|
|
getRowItemList({ commit, state }, obj) {
|
|
const id = obj.id
|
|
const id = obj.id
|
|
|
|
+ const page = (obj.page - 1) * 10
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
getRowItem(id).then((res) => {
|
|
getRowItem(id).then((res) => {
|
|
console.log(res)
|
|
console.log(res)
|
|
const list = res.data
|
|
const list = res.data
|
|
- commit('GET_ROW_ITEM', list)
|
|
|
|
|
|
+ commit('ROW_ITEM__LENGTH', list.length)
|
|
|
|
+ commit('GET_ROW_ITEM', list.splice(page, 10))
|
|
resolve()
|
|
resolve()
|
|
}).catch(error => {
|
|
}).catch(error => {
|
|
reject(error)
|
|
reject(error)
|