337 lines
11 KiB
JavaScript
337 lines
11 KiB
JavaScript
import http from './https.js'
|
|
export default {
|
|
onlogin(param) { // 登录
|
|
return http.post("/api/wxopen/onlogin", param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
getSendCode(param) { // 验证码
|
|
return http.get("/api/wxopen/sendcode", param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
getRegister(param) { // 手机号进行注册
|
|
return http.post("/api/wxopen/deregister", param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
getregister(param) { // 微信授权登录
|
|
return http.post('/api/wxopen/register', param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
getWxOpenPhone(param) { // 解密手机号
|
|
return http.post('/api/wxopen/deuserphone', param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
getDecryptdata(param) { // 解密用户资料
|
|
return http.post("/api/wxopen/deuserinfo", param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
getConfig(param) { // 配置详情
|
|
return http.post("/api/wxopen/config/get", param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
getoutlogin(param) { // 退出登录
|
|
return http.get("/api/wxopen/outlogin", param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
submitadvice(param) { // 意见反馈
|
|
return http.post("/api/wxopen/submitadvice", param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
//
|
|
getUserInfo(param) { //获取用户信息
|
|
return http.post("/api/adult/info", param).then(res => {
|
|
if (res.code == 0) {
|
|
res.data.name = res.data.nickname
|
|
res.data.id = res.data.familyid
|
|
// res.data.firstresulttime = res.data.firstresulttime.substring(0, 10)
|
|
}
|
|
return res
|
|
})
|
|
},
|
|
getResult(param) { //获取成人测量信息
|
|
return http.post("/api/adult/measureinfo", param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
getfirstweight(param) { //修改初始体重
|
|
return http.post("/api/adult/submitfirstweight", param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
setTarget(param) { //设置目标体重
|
|
return http.post("/api/family/settarget", param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
getbodylist(param) { //测评列表
|
|
return http.post("/api/adult/getbodylist", param).then(res => {
|
|
if (res.code == 0) {
|
|
let box = res.data
|
|
let k = 1
|
|
for (var n = 0; n < box.length; n++) {
|
|
for (var i = 0; i < box[n].qalist.length; i++) {
|
|
let info = box[n].qalist[i]
|
|
box[n].qalist[i] = {
|
|
Id: info.id,
|
|
title: info.title,
|
|
data: [{
|
|
id: info.id,
|
|
val: k++,
|
|
value: info.nonevalue,
|
|
valId: box[n].id,
|
|
name: '没有',
|
|
},
|
|
{
|
|
id: info.id,
|
|
val: k++,
|
|
value: info.littlevalue,
|
|
valId: box[n].id,
|
|
name: '很少',
|
|
},
|
|
{
|
|
id: info.id,
|
|
val: k++,
|
|
value: info.somevalue,
|
|
valId: box[n].id,
|
|
name: '有时',
|
|
},
|
|
{
|
|
id: info.id,
|
|
val: k++,
|
|
value: info.oftenvalue,
|
|
valId: box[n].id,
|
|
name: '经常',
|
|
},
|
|
{
|
|
id: info.id,
|
|
val: k++,
|
|
value: info.alwaysvalue,
|
|
valId: box[n].id,
|
|
name: '总是',
|
|
}
|
|
]
|
|
|
|
}
|
|
}
|
|
}
|
|
res.data = box
|
|
}
|
|
return res
|
|
})
|
|
},
|
|
getbodyinfo(param) { //体质测评结果
|
|
return http.post("/api/adult/getbodyinfo", param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
getbodyresultinfo(param) { //体质测评计算
|
|
return http.post("/api/adult/getbodyresultinfo", param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
//
|
|
getFamilyList(param) { // 获取家庭成员列表
|
|
return http.post('/api/family/getlist', param).then(res => {
|
|
if (res.data) {
|
|
for (let i = 0; i < res.data.length; i++) {
|
|
res.data[i].familyid = res.data[i].id
|
|
res.data[i].type = res.data[i].type == 1 ? "成人" : res.data[i].type == 2 ? "儿童" : "婴儿"
|
|
}
|
|
}
|
|
return res.data
|
|
})
|
|
},
|
|
getsubmit(param) { //家庭成员信息修改
|
|
return http.post('/api/family/submit', param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
getdelete(param) { //删除家庭成员
|
|
return http.get('/api/family/delete', param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
|
|
getdetail(param) { //家庭成员详情
|
|
return http.get('/api/family/detail', param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
getHistoryList(param) { //获取指定家庭成员历史记录
|
|
return http.post('/api/family/gethistorylist', param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
getaddlist(param) { //手动添加记录列表
|
|
return http.post('/api/family/getaddlist', param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
//
|
|
getinsertmeasure(param) { //手动记录
|
|
return http.post('/api/result/insertmeasure', param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
getmeasure(param) { //新增蓝牙测量记录
|
|
return http.post('/api/result/measure', param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
getmeasuredata(param) { //新增蓝牙测量记录,适用于f01pro
|
|
return http.post('/api/result/measuredata', param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
getmeasurefunit(param) { //新增蓝牙测量记录,身高带单位
|
|
return http.post('/api/result/measureofunit', param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
gethistorydelete(param) { //删除历史记录
|
|
return http.post("/api/result/delete", param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
getTrendList(param) { //趋势
|
|
return http.post("/api/result/trendlist", param).then(res => {
|
|
if (res.code == 0) {
|
|
let list = res.data
|
|
let cidata = {
|
|
weight: {
|
|
categories: [],
|
|
series: [{
|
|
color: "#ff9f40",
|
|
name: "体重",
|
|
data: [],
|
|
}]
|
|
},
|
|
bmi: {
|
|
categories: [],
|
|
series: [{
|
|
name: "bmi",
|
|
color: "#5ba7ff",
|
|
data: [],
|
|
}]
|
|
},
|
|
muscle: {
|
|
categories: [],
|
|
series: [{
|
|
color: "#ff7f91",
|
|
name: "肌肉",
|
|
data: [],
|
|
}]
|
|
},
|
|
fat_r: {
|
|
categories: [],
|
|
series: [{
|
|
color: "#3fcba7",
|
|
name: "脂肪",
|
|
data: [],
|
|
}]
|
|
}
|
|
}
|
|
|
|
for (var i = 0; i < list.length; i++) {
|
|
cidata.weight.categories.push(list[i].time);
|
|
cidata.bmi.categories.push(list[i].time);
|
|
cidata.muscle.categories.push(list[i].time);
|
|
cidata.fat_r.categories.push(list[i].time);
|
|
cidata.weight.series.forEach(item => {
|
|
item.data.push(list[i].weight)
|
|
})
|
|
cidata.bmi.series.forEach(item => {
|
|
item.data.push(list[i].bmi)
|
|
})
|
|
cidata.muscle.series.forEach(item => {
|
|
item.data.push(list[i].muscle)
|
|
})
|
|
cidata.fat_r.series.forEach(item => {
|
|
item.data.push(list[i].fat_r)
|
|
})
|
|
}
|
|
res.data = cidata
|
|
}
|
|
return res.data
|
|
})
|
|
},
|
|
//对比列表
|
|
GetTrendList(param) {
|
|
return http.post("/api/result/trendlist", param).then(res => {
|
|
if (res.code == 0) {
|
|
let pkList = {
|
|
list: [],
|
|
Dlist: []
|
|
}
|
|
for (var i = 0; i < res.data.length; i++) {
|
|
pkList.list.push(res.data[i])
|
|
if (!pkList.Dlist.includes(res.data[i].createtime)) { //includes 检测数组是否有某个值
|
|
pkList.Dlist.push(res.data[i].createtime);
|
|
}
|
|
}
|
|
res.data.pkList = pkList
|
|
}
|
|
return res.data
|
|
})
|
|
},
|
|
getresultdiff(param) { //记录对比
|
|
return http.post("/api/result/resultdiff", param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
|
|
//
|
|
getdevactive(param) { //设备激活
|
|
return http.post('/api/device/active', param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
getdevstatus(param) { //检查设备状态
|
|
return http.get('/api/device/checkdevstatus', param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
getdevdetail(param) { //设备详情
|
|
return http.post('/api/device/detail', param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
//
|
|
GetTplList(param) { //获取消息模板列表
|
|
return http.get('/api/message/gettplList', param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
GetSubscribe(param) { //消息订阅
|
|
return http.post('/api/message/subscribe', param).then(res => {
|
|
return res
|
|
|
|
})
|
|
},
|
|
GetSubscribeInfo(param) { //获取订阅状态
|
|
return http.get('/api/message/getsubscribeinfo', param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
Getunsubscribe(param) { //取消订阅
|
|
return http.post('/api/message/unsubscribe', param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
// 协议
|
|
GetAdListDetail(param) {
|
|
return http.get('/api/zx/infodetail', param).then(res => {
|
|
return res
|
|
})
|
|
},
|
|
|
|
}
|