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