import http from './https.js'
import tools from './tools.js'
import store from '@/store'
export default {
	// 登录
	getonlogin(param) { // 登录
		return http.post("/login_action", param).then(res => {
			return res
		})
	},
	getSendCode(param) { // 验证码
		return http.post("/send_phone_email_code", param).then(res => {
			return res
		})
	},
	getregister(param) { // 注册
		return http.post("/register_action", param).then(res => {
			return res
		})
	},
	getResetPassword(param) { // 重置密码
		return http.post("/reset_password", param).then(res => {
			return res
		})
	},
	getloginOut(param) { // 退出登录
		return http.post("/user_quit_account", param).then(res => {
			return res
		})
	},
	// 首页
	getUserInfo(param) { // 成员详情
		return http.post("/get_user_data_information", param).then(res => {
			return res
		})
	},
	getUserList(param) { // 成员列表
		return http.post("/get_user_card_list", param).then(res => {
			return res
		})
	},
	getDelUser(param) { // 删除成员
		return http.post("/del_user_data", param).then(res => {
			return res
		})
	},
	getEditUser(param) { // 修改成员资料
		return http.post("/update_user_data", param).then(res => {
			return res
		})
	},
	getAddUser(param) { // 添加成员
		return http.post("/create_user_data", param).then(res => {
			return res
		})
	},
	getGradeList(param) { // 获取年级列表
		return http.post("/get_grade_list", param).then(res => {
			return res
		})
	},
	getCardAllList(param) { // 获取所有卡片
		return http.post("/get_card_all_list", param).then(res => {
			return res
		})
	},
	getCardAllOrder(param) { // 保存卡片顺序
		return http.post("/save_user_card_order", param).then(res => {
			return res
		})
	},
	// 身体数据卡片
	getfirstweight(param) { //修改初始体重
		return http.post("/card_modify_weight", param).then(res => {
			return res
		})
	},
	getinsertmeasure(param) { //手动记录
		return http.post('/card_manual_recording', param).then(res => {
			return res
		})
	},
	getResult(param) { //获取测量报告
		return http.post("/card_data_detailed", param).then(res => {
			return res
		})
	},
	getTrendList(param) { //趋势
		return http.post("/card_curve_chart", param).then(res => {
			return res
		})
	},
	// 跳绳
	getSkipResult(param) { //获取测量报告
		return http.post("/skip_today_data", param).then(res => {
			return res
		})
	},
	getskipmeasure(param) { //手动记录
		return http.post('/skip_manual_recording', param).then(res => {
			return res
		})
	},
	getSkipTrendList(param) { //趋势
		return http.post("/skip_curve_chart", param).then(res => {
			return res
		})
	},
	// 肺活量
	getLungResult(param) { //获取测量报告
		return http.post("/vitalcapacity_data_report", param).then(res => {
			return res
		})
	},
	getLungmeasure(param) { //手动记录
		return http.post('/vitalcapacity_save_record_data', param).then(res => {
			return res
		})
	},
	getLungTrendList(param) { //趋势
		return http.post("/vitalcapacity_curve_chart", param).then(res => {
			return res
		})
	},
	// 公共
	gethistory(param) { //历史记录
		return http.post("/get_all_record_data_page", param).then(res => {
			return res
		})
	},
	gethistorydetail(param) { //历史记录详情
		return http.post("/get_all_record_detailed_information", param).then(res => {
			return res
		})
	},
	gethistorydelete(param) { //删除历史记录
		return http.post("/card_del_record_data", param).then(res => {
			return res
		})
	},
	getresultdiff(param) { //记录对比
		return http.post("/get_all_record_data_group", 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].r_t)) { //includes 检测数组是否有某个值
						pkList.Dlist.push(res.data[i].r_t);
					}
				}
				res.pkList = pkList
			}
			return res
		})
	},
	getresultcontrast(param) { //对比详情
		return http.post("/get_all_card_data_contrast", param).then(res => {
			return res
		})
	},
}