2022-05-03 21:35:39 +08:00
|
|
|
|
import model from "../tools/model.js"
|
|
|
|
|
|
import tools from '@/tools/tools.js'
|
2022-05-13 09:22:34 +08:00
|
|
|
|
import config from '@/config.js'
|
2022-05-03 21:35:39 +08:00
|
|
|
|
// Action 包含异步操作(请求API方法)、回调函数提交mutaions更改state数据状态,使之可以异步
|
|
|
|
|
|
export default {
|
2025-10-20 10:58:11 +08:00
|
|
|
|
// 用户信息
|
|
|
|
|
|
getUserInfo({
|
|
|
|
|
|
commit
|
|
|
|
|
|
},
|
|
|
|
|
|
account) {
|
|
|
|
|
|
return model.getUserInfo(account).then(res => {
|
|
|
|
|
|
commit('changeUser', res.data)
|
|
|
|
|
|
if (!res.data.height || !res.data.mage || !res.data.birthday) {
|
|
|
|
|
|
uni.redirectTo({
|
|
|
|
|
|
url: `/pageTwo/login/userinfo`
|
|
|
|
|
|
})
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
// 获取称重结果
|
|
|
|
|
|
getResult({
|
|
|
|
|
|
commit
|
|
|
|
|
|
}, account) {
|
|
|
|
|
|
console.log("1111111", account)
|
|
|
|
|
|
return model.getResult(account).then((res) => {
|
|
|
|
|
|
console.log("报告", res)
|
|
|
|
|
|
if (res.code == 0) {
|
|
|
|
|
|
commit('changeMeasureResult', res.data)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
commit('changeMeasureResult', null)
|
|
|
|
|
|
}
|
|
|
|
|
|
return 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)
|
|
|
|
|
|
}
|
|
|
|
|
|
return res
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
//趋势
|
|
|
|
|
|
GetBodyTrendList({
|
|
|
|
|
|
commit
|
|
|
|
|
|
}, account) {
|
|
|
|
|
|
return model.GetBodyTrendList(account).then((res) => {
|
|
|
|
|
|
if (res) {
|
|
|
|
|
|
commit('changeTrend', res.cidata)
|
|
|
|
|
|
}
|
|
|
|
|
|
return res
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
// 更新家庭成员
|
|
|
|
|
|
getFamilyList({
|
|
|
|
|
|
commit
|
|
|
|
|
|
}) {
|
|
|
|
|
|
return model.getFamilyList({
|
|
|
|
|
|
pagenum: 20,
|
|
|
|
|
|
pagesize: 1
|
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
|
commit('changeFamilay', res)
|
|
|
|
|
|
return res
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
// 获取历史记录
|
|
|
|
|
|
gethistoryList({
|
|
|
|
|
|
commit
|
|
|
|
|
|
}, account) {
|
|
|
|
|
|
return model.getHistoryList(account).then((res) => {
|
|
|
|
|
|
if (res.data && res.data.rows) {
|
|
|
|
|
|
commit('changehistoryList', res.data.rows)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
commit('changehistoryList', null)
|
|
|
|
|
|
}
|
|
|
|
|
|
return res
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2022-05-13 09:22:34 +08:00
|
|
|
|
|
2025-10-20 10:58:11 +08:00
|
|
|
|
// 配置详情
|
|
|
|
|
|
getConfig({
|
|
|
|
|
|
commit
|
|
|
|
|
|
}, account) {
|
|
|
|
|
|
account.appid = config.appid
|
|
|
|
|
|
return model.getConfig(account).then((res) => {
|
|
|
|
|
|
console.log("配置详情", res)
|
|
|
|
|
|
if (res.code == 0) {
|
|
|
|
|
|
commit("changeConfig", res.data)
|
|
|
|
|
|
commit("toggleColor", res.data.themecolor)
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|