2024-05-02 15:59:36 +08:00
|
|
|
import Vue from 'vue'
|
|
|
|
|
import Vuex from 'vuex'
|
|
|
|
|
import actions from './actions.js'
|
|
|
|
|
Vue.use(Vuex)
|
|
|
|
|
export default new Vuex.Store({
|
2024-05-29 16:35:45 +08:00
|
|
|
// state: 存储基本数据
|
|
|
|
|
state: {
|
|
|
|
|
user: {
|
|
|
|
|
id: "",
|
|
|
|
|
headimg: null,
|
|
|
|
|
nickname: "",
|
|
|
|
|
birthday: "",
|
|
|
|
|
gender: 0,
|
|
|
|
|
sex: 0,
|
2024-07-22 14:13:19 +08:00
|
|
|
address: [],
|
2024-05-29 16:35:45 +08:00
|
|
|
card_data_list: [],
|
|
|
|
|
target_current: {}
|
|
|
|
|
},
|
2024-06-13 18:03:50 +08:00
|
|
|
accountNumber: {
|
|
|
|
|
create_time: "",
|
|
|
|
|
head_pic: "",
|
|
|
|
|
last_update_time: "",
|
|
|
|
|
my_email: "",
|
|
|
|
|
my_tel: "",
|
|
|
|
|
nickname: "",
|
|
|
|
|
},
|
2024-05-29 16:35:45 +08:00
|
|
|
MeasureSkip: null,
|
|
|
|
|
MeasureResult: null,
|
|
|
|
|
MeasureLung: null,
|
|
|
|
|
familayList: [],
|
|
|
|
|
historyList: [],
|
|
|
|
|
cardList: {
|
|
|
|
|
user: [],
|
|
|
|
|
all: []
|
|
|
|
|
},
|
|
|
|
|
Trend: [],
|
2024-07-08 10:50:07 +08:00
|
|
|
userDeviceList: [], //用户设备列表
|
2024-05-29 16:35:45 +08:00
|
|
|
isDrawe: false, //左侧弹框
|
|
|
|
|
isedit: false, //信息弹框
|
|
|
|
|
isTarget: false, //目标体重
|
|
|
|
|
isFirst: false, //初始体重
|
|
|
|
|
isRecord: false, //手动记录
|
|
|
|
|
isSlider: false, //分数占比
|
2024-06-13 18:03:50 +08:00
|
|
|
isConnected: false,
|
|
|
|
|
isBluetoothTyle: false,
|
2024-07-22 14:13:19 +08:00
|
|
|
LungLevel: [], //肺活量标准
|
|
|
|
|
devicesList: [], //筛选设备列表
|
|
|
|
|
phoneInfo: {
|
|
|
|
|
info: {},
|
|
|
|
|
versionUrl: {},
|
|
|
|
|
platform: ""
|
|
|
|
|
},
|
2024-05-02 15:59:36 +08:00
|
|
|
|
2024-05-29 16:35:45 +08:00
|
|
|
},
|
|
|
|
|
// mutations: Store中更改state数据状态的唯一方法(必须是同步函数)
|
|
|
|
|
mutations: {
|
2024-07-22 14:13:19 +08:00
|
|
|
// 版本信息
|
|
|
|
|
changePhoneInfo(state, newData) {
|
|
|
|
|
Object.assign(state.phoneInfo, newData)
|
|
|
|
|
},
|
2024-06-13 18:03:50 +08:00
|
|
|
// 账户信息
|
|
|
|
|
changeAccountNumber(state, newData) {
|
|
|
|
|
Object.assign(state.accountNumber, newData)
|
|
|
|
|
},
|
2024-05-29 16:35:45 +08:00
|
|
|
/* 用户信息 */
|
|
|
|
|
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
|
|
|
|
|
},
|
|
|
|
|
// 跳绳数据
|
|
|
|
|
changeMeasureSkip(state, newData) {
|
|
|
|
|
state.MeasureSkip = newData
|
|
|
|
|
},
|
|
|
|
|
// 肺活量
|
|
|
|
|
changeMeasureLung(state, newData) {
|
|
|
|
|
state.MeasureLung = 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
|
|
|
|
|
},
|
2024-07-22 14:13:19 +08:00
|
|
|
// 肺活量标准
|
|
|
|
|
changeLungLevel(state, newData) {
|
|
|
|
|
state.lungLevel = newData
|
|
|
|
|
},
|
2024-05-29 16:35:45 +08:00
|
|
|
//获取家庭成员
|
|
|
|
|
changeFamilay(state, newData) {
|
2024-06-13 18:03:50 +08:00
|
|
|
if (newData.length == 0) {
|
|
|
|
|
uni.setStorageSync('userid', "")
|
|
|
|
|
uni.setStorageSync('gender', 0)
|
|
|
|
|
state.user.target_current = {}
|
|
|
|
|
state.user.card_data_list = []
|
|
|
|
|
}
|
2024-05-29 16:35:45 +08:00
|
|
|
state.familayList = newData
|
|
|
|
|
},
|
|
|
|
|
//趋势
|
|
|
|
|
changeTrend(state, newData) {
|
|
|
|
|
state.Trend = newData
|
2024-06-13 18:03:50 +08:00
|
|
|
},
|
|
|
|
|
//蓝牙是否开启
|
|
|
|
|
changeBluetooth(state, newData) {
|
|
|
|
|
state.isBluetoothTyle = newData
|
|
|
|
|
},
|
|
|
|
|
// 蓝牙起否连接
|
|
|
|
|
changeConnected(state, newData) {
|
|
|
|
|
state.isConnected = newData
|
|
|
|
|
},
|
2024-07-08 10:50:07 +08:00
|
|
|
// 用户设备列表
|
|
|
|
|
changeUserDeviceList(state, newData) {
|
|
|
|
|
state.userDeviceList = newData
|
2024-07-22 14:13:19 +08:00
|
|
|
}, //
|
|
|
|
|
changedevicesList(state, newData) {
|
|
|
|
|
state.devicesList = newData
|
|
|
|
|
}
|
2024-05-29 16:35:45 +08:00
|
|
|
},
|
|
|
|
|
// 模块化vuex
|
|
|
|
|
modules: {},
|
|
|
|
|
actions
|
|
|
|
|
})
|