2025-05-30 11:14:38 +08:00
|
|
|
|
import Vue from 'vue'
|
|
|
|
|
|
import Vuex from 'vuex'
|
|
|
|
|
|
import actions from './actions.js'
|
2026-03-23 09:50:49 +08:00
|
|
|
|
import json from '@/content.json'
|
2025-05-30 11:14:38 +08:00
|
|
|
|
Vue.use(Vuex)
|
|
|
|
|
|
export default new Vuex.Store({
|
|
|
|
|
|
// state: 存储基本数据
|
|
|
|
|
|
state: {
|
|
|
|
|
|
user: {
|
2026-03-23 09:50:49 +08:00
|
|
|
|
aud_id: "",
|
2025-05-30 11:14:38 +08:00
|
|
|
|
head_pic: null,
|
|
|
|
|
|
nickname: "",
|
|
|
|
|
|
birthday: "",
|
|
|
|
|
|
gender: 0,
|
|
|
|
|
|
sex: 0,
|
|
|
|
|
|
age: 0,
|
|
|
|
|
|
stage: "",
|
|
|
|
|
|
height: "",
|
|
|
|
|
|
weight: "",
|
|
|
|
|
|
address: "",
|
|
|
|
|
|
head_data: 0,
|
2026-03-23 09:50:49 +08:00
|
|
|
|
food_count: {},
|
2025-05-30 11:14:38 +08:00
|
|
|
|
card_order: [],
|
|
|
|
|
|
card_data_list: [],
|
|
|
|
|
|
target_current: {},
|
|
|
|
|
|
vitalcapacity_data: []
|
|
|
|
|
|
},
|
2026-03-23 09:50:49 +08:00
|
|
|
|
// 配置接口
|
|
|
|
|
|
configInfo: {
|
|
|
|
|
|
activity_level: [],
|
|
|
|
|
|
area_list: [],
|
|
|
|
|
|
banner: [],
|
|
|
|
|
|
meal_list: [],
|
|
|
|
|
|
literature: {
|
|
|
|
|
|
index: [],
|
|
|
|
|
|
bmi_evaluation: [],
|
|
|
|
|
|
height_prediction: [],
|
|
|
|
|
|
warning: []
|
|
|
|
|
|
},
|
|
|
|
|
|
identity_list: [],
|
|
|
|
|
|
grade_list: [],
|
|
|
|
|
|
cookbook_label: [],
|
|
|
|
|
|
default_count_foot: [],
|
|
|
|
|
|
business_cooperation_url: [],
|
|
|
|
|
|
},
|
|
|
|
|
|
// 蓝牙
|
|
|
|
|
|
bleValue: {
|
|
|
|
|
|
deviceId: "",
|
|
|
|
|
|
serviceId: "",
|
2026-03-25 17:27:29 +08:00
|
|
|
|
isFood: false,
|
|
|
|
|
|
foodWeight: 100,
|
|
|
|
|
|
foodUnit: "g",
|
|
|
|
|
|
foodNotify: "",
|
|
|
|
|
|
foodWrite: "",
|
|
|
|
|
|
foodunitList: json.unitArray,
|
|
|
|
|
|
foodType: 1, //食物称 1实时,2锁定 状态类型
|
2026-03-23 16:23:40 +08:00
|
|
|
|
bleTipsText: "", //蓝牙提示语
|
|
|
|
|
|
isConnectStatus: 0, //蓝牙连接状态 0搜索中,1失败,2成功
|
2026-03-23 09:50:49 +08:00
|
|
|
|
},
|
|
|
|
|
|
// 计食器
|
|
|
|
|
|
countFoodInfo: {
|
|
|
|
|
|
date: "",
|
|
|
|
|
|
details: {},
|
|
|
|
|
|
list: [],
|
|
|
|
|
|
remaining_kcal: "",
|
|
|
|
|
|
nutrients_four: [],
|
|
|
|
|
|
trace_elements_all_day: []
|
|
|
|
|
|
},
|
|
|
|
|
|
// 用户接口
|
2025-05-30 11:14:38 +08:00
|
|
|
|
accountNumber: {
|
|
|
|
|
|
create_time: "",
|
|
|
|
|
|
head_pic: "",
|
|
|
|
|
|
last_update_time: "",
|
|
|
|
|
|
my_email: "",
|
|
|
|
|
|
my_tel: "",
|
|
|
|
|
|
nickname: "",
|
|
|
|
|
|
},
|
|
|
|
|
|
MeasureResult: {
|
|
|
|
|
|
body_type_name: "",
|
|
|
|
|
|
body_type_unit: "",
|
|
|
|
|
|
body_type_value: "",
|
|
|
|
|
|
bottom_list: [],
|
|
|
|
|
|
cplist: {
|
|
|
|
|
|
moodlist: [],
|
|
|
|
|
|
nutritionlist: [],
|
|
|
|
|
|
sleeplist: [],
|
|
|
|
|
|
sportlist: []
|
|
|
|
|
|
},
|
|
|
|
|
|
literature: [],
|
|
|
|
|
|
record_time: "",
|
|
|
|
|
|
score_name: "",
|
|
|
|
|
|
score_unit: "",
|
|
|
|
|
|
score_value: "",
|
|
|
|
|
|
target_current: {
|
|
|
|
|
|
target_weight: 0,
|
|
|
|
|
|
initial_weight: "",
|
|
|
|
|
|
cumulative_weight: "",
|
|
|
|
|
|
cumulative_day: ""
|
|
|
|
|
|
},
|
|
|
|
|
|
top_list: []
|
|
|
|
|
|
},
|
2026-03-27 10:04:26 +08:00
|
|
|
|
phoneInfo: {
|
|
|
|
|
|
info: {},
|
|
|
|
|
|
versionUrl: null,
|
|
|
|
|
|
platform: ""
|
|
|
|
|
|
},
|
2026-03-23 09:50:49 +08:00
|
|
|
|
MeasureSkip: null,
|
2025-05-30 11:14:38 +08:00
|
|
|
|
MeasureLung: null,
|
|
|
|
|
|
familayList: [],
|
|
|
|
|
|
PublicRecord: [],
|
2026-03-23 16:23:40 +08:00
|
|
|
|
LungLevel: [], //肺活量标准
|
2026-03-23 09:50:49 +08:00
|
|
|
|
CardList: {
|
|
|
|
|
|
chosen_fixed: [],
|
|
|
|
|
|
chosen_yes: [],
|
|
|
|
|
|
chosen_no: []
|
2025-05-30 11:14:38 +08:00
|
|
|
|
},
|
2026-03-25 17:27:29 +08:00
|
|
|
|
homeCardIndex: 0,
|
2025-05-30 11:14:38 +08:00
|
|
|
|
isDrawe: false, //左侧弹框
|
|
|
|
|
|
isTarget: false, //目标体重
|
|
|
|
|
|
isFirst: false, //初始体重
|
|
|
|
|
|
isRecord: false, //手动记录
|
2026-03-23 16:23:40 +08:00
|
|
|
|
isPublicRecord: false, //公共手动记录弹框
|
2026-03-27 10:04:26 +08:00
|
|
|
|
isBluetoothTyle: false,
|
2025-05-30 11:14:38 +08:00
|
|
|
|
},
|
|
|
|
|
|
mutations: {
|
2026-03-27 10:04:26 +08:00
|
|
|
|
// 版本信息
|
|
|
|
|
|
changePhoneInfo(state, newData) {
|
|
|
|
|
|
Object.assign(state.phoneInfo, newData)
|
|
|
|
|
|
},
|
2025-05-30 11:14:38 +08:00
|
|
|
|
// 账户信息
|
|
|
|
|
|
changeAccountNumber(state, newData) {
|
|
|
|
|
|
Object.assign(state.accountNumber, newData)
|
|
|
|
|
|
},
|
|
|
|
|
|
/* 用户信息 */
|
|
|
|
|
|
changeUser(state, newData) {
|
|
|
|
|
|
Object.assign(state.user, newData)
|
|
|
|
|
|
},
|
2026-03-25 17:27:29 +08:00
|
|
|
|
// 首页卡片当前项
|
|
|
|
|
|
changehomeCard(state, newData) {
|
|
|
|
|
|
state.homeCardIndex = newData
|
|
|
|
|
|
},
|
2026-03-23 09:50:49 +08:00
|
|
|
|
//获取家庭成员
|
|
|
|
|
|
changeFamilay(state, newData) {
|
|
|
|
|
|
if (newData.length == 0) {
|
|
|
|
|
|
uni.setStorageSync('userid', "")
|
|
|
|
|
|
uni.setStorageSync('gender', 0)
|
|
|
|
|
|
state.user = {
|
|
|
|
|
|
id: "",
|
|
|
|
|
|
head_pic: null,
|
|
|
|
|
|
nickname: "",
|
|
|
|
|
|
birthday: "",
|
|
|
|
|
|
gender: 0,
|
|
|
|
|
|
sex: 0,
|
|
|
|
|
|
age: 0,
|
|
|
|
|
|
weight: "",
|
|
|
|
|
|
address: "",
|
|
|
|
|
|
measure_model: 0,
|
|
|
|
|
|
card_order: [],
|
|
|
|
|
|
food_count: {},
|
|
|
|
|
|
card_data_list: [],
|
|
|
|
|
|
target_current: {},
|
|
|
|
|
|
vitalcapacity_data: []
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
state.familayList = newData
|
|
|
|
|
|
},
|
2025-05-30 11:14:38 +08:00
|
|
|
|
// 卡片列表
|
|
|
|
|
|
changeCardList(state, newData) {
|
2026-03-23 09:50:49 +08:00
|
|
|
|
state.CardList = newData
|
2025-05-30 11:14:38 +08:00
|
|
|
|
},
|
2026-03-23 09:50:49 +08:00
|
|
|
|
// 左侧菜单弹框
|
|
|
|
|
|
changeDrawe(state, newData) {
|
|
|
|
|
|
state.isDrawe = newData
|
2025-05-30 11:14:38 +08:00
|
|
|
|
},
|
|
|
|
|
|
// 获取称重数据
|
|
|
|
|
|
changeMeasureResult(state, newData) {
|
|
|
|
|
|
Object.assign(state.MeasureResult, newData)
|
|
|
|
|
|
},
|
2026-03-23 09:50:49 +08:00
|
|
|
|
// 菜谱
|
|
|
|
|
|
changeMenuList(state, newData) {
|
|
|
|
|
|
state.menuList = newData
|
|
|
|
|
|
},
|
2025-05-30 11:14:38 +08:00
|
|
|
|
// 跳绳数据
|
|
|
|
|
|
changeMeasureSkip(state, newData) {
|
|
|
|
|
|
state.MeasureSkip = newData
|
|
|
|
|
|
},
|
2026-03-23 09:50:49 +08:00
|
|
|
|
// 肺活量标准
|
|
|
|
|
|
changeLungLevel(state, newData) {
|
|
|
|
|
|
state.lungLevel = newData
|
|
|
|
|
|
},
|
2025-05-30 11:14:38 +08:00
|
|
|
|
// 肺活量
|
|
|
|
|
|
changeMeasureLung(state, newData) {
|
|
|
|
|
|
state.MeasureLung = newData
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 目标体重
|
|
|
|
|
|
changeTarget(state, newData) {
|
|
|
|
|
|
state.isTarget = newData
|
|
|
|
|
|
},
|
|
|
|
|
|
// 初始体重
|
|
|
|
|
|
changeFirst(state, newData) {
|
|
|
|
|
|
state.isFirst = newData
|
|
|
|
|
|
},
|
|
|
|
|
|
// 手动记录
|
|
|
|
|
|
changeRecord(state, newData) {
|
|
|
|
|
|
state.isRecord = newData
|
|
|
|
|
|
},
|
2026-03-23 09:50:49 +08:00
|
|
|
|
|
|
|
|
|
|
// 公共手动记录内容
|
|
|
|
|
|
changePublicRecord(state, newData) {
|
|
|
|
|
|
state.PublicRecord = newData
|
2025-05-30 11:14:38 +08:00
|
|
|
|
},
|
2026-03-23 09:50:49 +08:00
|
|
|
|
// 公共手动弹框
|
|
|
|
|
|
changeTsPublicRecord(state, newData) {
|
|
|
|
|
|
state.isPublicRecord = newData
|
2025-05-30 11:14:38 +08:00
|
|
|
|
},
|
2026-03-23 09:50:49 +08:00
|
|
|
|
|
|
|
|
|
|
// 计时
|
|
|
|
|
|
changeConfigInfo(state, newData) {
|
|
|
|
|
|
state.configInfo = newData
|
2025-05-30 11:14:38 +08:00
|
|
|
|
},
|
2026-03-23 09:50:49 +08:00
|
|
|
|
// 计食器
|
|
|
|
|
|
changeCountFoodInfo(state, newData) {
|
|
|
|
|
|
state.countFoodInfo = newData
|
2025-05-30 11:14:38 +08:00
|
|
|
|
},
|
2026-03-23 09:50:49 +08:00
|
|
|
|
// 蓝牙信息
|
|
|
|
|
|
changeBluetoothValue(state, newData) {
|
|
|
|
|
|
Object.assign(state.bleValue, newData)
|
2025-05-30 11:14:38 +08:00
|
|
|
|
},
|
2026-03-27 10:04:26 +08:00
|
|
|
|
//蓝牙状态
|
|
|
|
|
|
changeBluetooth(state, newData) {
|
|
|
|
|
|
state.isBluetoothTyle = newData
|
|
|
|
|
|
},
|
2025-05-30 11:14:38 +08:00
|
|
|
|
},
|
|
|
|
|
|
// 模块化vuex
|
|
|
|
|
|
modules: {},
|
|
|
|
|
|
actions
|
|
|
|
|
|
})
|