231 lines
4.8 KiB
JavaScript
231 lines
4.8 KiB
JavaScript
import Vue from 'vue'
|
|
import Vuex from 'vuex'
|
|
import actions from './actions.js'
|
|
Vue.use(Vuex)
|
|
export default new Vuex.Store({
|
|
// state: 存储基本数据
|
|
state: {
|
|
user: {
|
|
id: "",
|
|
head_pic: null,
|
|
nickname: "",
|
|
birthday: "",
|
|
gender: 0,
|
|
sex: 0,
|
|
age: 0,
|
|
height: "",
|
|
weight: "",
|
|
address: "",
|
|
card_order: [],
|
|
card_data_list: [],
|
|
target_current: {},
|
|
vitalcapacity_data: []
|
|
},
|
|
accountNumber: {
|
|
create_time: "",
|
|
head_pic: "",
|
|
last_update_time: "",
|
|
my_email: "",
|
|
my_tel: "",
|
|
nickname: "",
|
|
},
|
|
MeasureSkip: null,
|
|
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: []
|
|
},
|
|
MeasureLung: null,
|
|
PublicContent: null,
|
|
familayList: [],
|
|
historyList: [],
|
|
PublicRecord: [],
|
|
cardList: {
|
|
user: [],
|
|
all: []
|
|
},
|
|
Trend: [],
|
|
userDeviceList: [], //用户设备列表
|
|
isDrawe: false, //左侧弹框
|
|
isedit: false, //信息弹框
|
|
isTarget: false, //目标体重
|
|
isFirst: false, //初始体重
|
|
isRecord: false, //手动记录
|
|
isSlider: false, //分数占比
|
|
isConnected: false,
|
|
isPublicRecord: false,
|
|
isBluetoothTyle: false,
|
|
CooperationUrl: [],
|
|
LungLevel: [], //肺活量标准
|
|
devicesList: [], //筛选设备列表
|
|
labelList: [],
|
|
phoneInfo: {
|
|
info: {},
|
|
versionUrl: null,
|
|
platform: ""
|
|
},
|
|
cityList: [],
|
|
gradeList: [],
|
|
identityList: []
|
|
},
|
|
// mutations: Store中更改state数据状态的唯一方法(必须是同步函数)
|
|
mutations: {
|
|
// 版本信息
|
|
changePhoneInfo(state, newData) {
|
|
Object.assign(state.phoneInfo, newData)
|
|
},
|
|
// 账户信息
|
|
changeAccountNumber(state, newData) {
|
|
Object.assign(state.accountNumber, newData)
|
|
},
|
|
/* 用户信息 */
|
|
changeUser(state, newData) {
|
|
Object.assign(state.user, newData)
|
|
},
|
|
// 卡片列表
|
|
changeCardList(state, newData) {
|
|
state.cardList = newData
|
|
},
|
|
//历史记录
|
|
changehistoryList(state, newData) {
|
|
state.historyList = newData
|
|
},
|
|
// 获取称重数据
|
|
changeMeasureResult(state, newData) {
|
|
// state.MeasureResult = newData
|
|
Object.assign(state.MeasureResult, newData)
|
|
},
|
|
// 跳绳数据
|
|
changeMeasureSkip(state, newData) {
|
|
state.MeasureSkip = newData
|
|
},
|
|
// 肺活量
|
|
changeMeasureLung(state, newData) {
|
|
state.MeasureLung = newData
|
|
},
|
|
// 公共
|
|
changePublicContent(state, newData) {
|
|
state.PublicContent = newData
|
|
},
|
|
// 公共手动记录内容
|
|
changePublicRecord(state, newData) {
|
|
state.PublicRecord = newData
|
|
},
|
|
|
|
// 信息弹框
|
|
changeEdit(state, newData) {
|
|
state.isedit = newData
|
|
},
|
|
// 目标体重
|
|
changeTarget(state, newData) {
|
|
state.isTarget = newData
|
|
},
|
|
// 初始体重
|
|
changeFirst(state, newData) {
|
|
state.isFirst = newData
|
|
},
|
|
// 手动记录
|
|
changeRecord(state, newData) {
|
|
state.isRecord = newData
|
|
},
|
|
// 分数占比
|
|
changeSlider(state, newData) {
|
|
state.isSlider = newData
|
|
},
|
|
// 左侧菜单弹框
|
|
changeDrawe(state, newData) {
|
|
state.isDrawe = newData
|
|
},
|
|
// 肺活量标准
|
|
changeLungLevel(state, newData) {
|
|
state.lungLevel = newData
|
|
},
|
|
//获取家庭成员
|
|
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: [],
|
|
card_data_list: [],
|
|
target_current: {},
|
|
vitalcapacity_data: []
|
|
}
|
|
}
|
|
state.familayList = newData
|
|
},
|
|
//趋势
|
|
changeTrend(state, newData) {
|
|
state.Trend = newData
|
|
},
|
|
//蓝牙是否开启
|
|
changeBluetooth(state, newData) {
|
|
state.isBluetoothTyle = newData
|
|
},
|
|
// 蓝牙起否连接
|
|
changeConnected(state, newData) {
|
|
state.isConnected = newData
|
|
},
|
|
// 用户设备列表
|
|
changeUserDeviceList(state, newData) {
|
|
state.userDeviceList = newData
|
|
}, //
|
|
changedevicesList(state, newData) {
|
|
state.devicesList = newData
|
|
},
|
|
// 公共卡片
|
|
changeLabelList(state, newData) {
|
|
state.labelList = newData
|
|
},
|
|
// 城市
|
|
changeCityList(state, newData) {
|
|
state.cityList = newData
|
|
},
|
|
changeGradeList(state, newData) {
|
|
state.gradeList = newData
|
|
},
|
|
changeIdentityList(state, newData) {
|
|
state.identityList = newData
|
|
},
|
|
changePublicAdd(state, newData) {
|
|
state.isPublicRecord = newData
|
|
},
|
|
// 合作服务
|
|
changeCooperationUrl(state, newData) {
|
|
state.CooperationUrl = newData
|
|
},
|
|
|
|
},
|
|
// 模块化vuex
|
|
modules: {},
|
|
actions
|
|
}) |