import model from "../tools/model.js" import tools from '@/tools/tools.js' // Action 包含异步操作(请求API方法)、回调函数提交mutaions更改state数据状态,使之可以异步 export default { // 用户信息 getUserInfo({ commit }, account) { return model.getUserInfo(account).then(res => { console.log("用户信息", res.data) if (res.code != 0) { that.$tools.msg(res.msg) return } commit('changeUser', res.data) }); }, // 成员列表 getFamilyList({ commit }, account) { return model.getUserList(account).then(res => { if (res.code != 0) { that.$tools.msg(res.msg) return } commit('changeFamilay', res.data) }); }, // 获取所有卡片 getCardList({ commit }, account) { return model.getCardAllList(account).then(res => { console.log("卡片列表", res.data) commit('changeCardList', res.data) }) }, // 身体数据 getResult({ //报告 commit }, account) { return model.getResult(account).then((res) => { console.log("报告", res) if (res.code == 0) { commit('changeMeasureResult', res.data) } else { commit('changeMeasureResult', null) } }) }, // 跳绳数据 getSkipResult({ //报告 commit }, account) { return model.getSkipResult(account).then((res) => { console.log("跳绳报告", res) if (res.code == 0) { commit('changeMeasureSkip', res.data) } else { commit('changeMeasureSkip', null) } }) }, // 肺活量 getLungResult({ //报告 commit }, account) { return model.getLungResult(account).then((res) => { console.log("肺活量报告", res) if (res.code == 0) { commit('changeMeasureLung', res.data) } else { commit('changeMeasureLung', null) } }) }, GetBodyTrendList({ //趋势 commit }, account) { return model.getTrendList(account).then((res) => { console.log("趋势", res) commit('changeTrend', res.data) }) }, gethistoryList({ // 获取历史记录 commit }, account) { return model.getHistoryList(account).then((res) => { if (res.data && res.data.items) { commit('changehistoryList', res.data.items) } else { commit('changehistoryList', null) } }) } }