|
@@ -186,6 +186,11 @@ const store = new Vuex.Store({
|
|
//最近连接过的设备
|
|
//最近连接过的设备
|
|
finallyUseDevice: null,
|
|
finallyUseDevice: null,
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 用户选择好友的信息
|
|
|
|
+ */
|
|
|
|
+ finallySelectFriendInfo: null,
|
|
|
|
+
|
|
//phoneNumber
|
|
//phoneNumber
|
|
phoneNumber: '',
|
|
phoneNumber: '',
|
|
openid: '',
|
|
openid: '',
|
|
@@ -211,6 +216,11 @@ const store = new Vuex.Store({
|
|
bInstallWechat: false,
|
|
bInstallWechat: false,
|
|
bHideWeixin: false,
|
|
bHideWeixin: false,
|
|
|
|
|
|
|
|
+ //导航栏高度。这里统一参数,单位px
|
|
|
|
+ navHeight: 46,
|
|
|
|
+ tabbarHeight: 65,
|
|
|
|
+
|
|
|
|
+ systemInfo: null, //系统全部信息
|
|
clientName: '', //但是客户端名字
|
|
clientName: '', //但是客户端名字
|
|
system: '', // 系统版本
|
|
system: '', // 系统版本
|
|
platform: '', // 平台
|
|
platform: '', // 平台
|
|
@@ -328,14 +338,42 @@ const store = new Vuex.Store({
|
|
//跳绳条件下计数
|
|
//跳绳条件下计数
|
|
bRopeKeyOne: 0,
|
|
bRopeKeyOne: 0,
|
|
bRopeKeyTwo: 0,
|
|
bRopeKeyTwo: 0,
|
|
-
|
|
|
|
|
|
+
|
|
//钻石,金币
|
|
//钻石,金币
|
|
- cDiamond:1000,
|
|
|
|
- cGold:1000
|
|
|
|
|
|
+ cDiamond: 10000,
|
|
|
|
+ cGold: 10000,
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 任务相关
|
|
|
|
+ */
|
|
|
|
+ currentJumpTask: null
|
|
|
|
|
|
},
|
|
},
|
|
mutations: {
|
|
mutations: {
|
|
|
|
+ /**
|
|
|
|
+ * 设置当前操作的任务记录到本地
|
|
|
|
+ * @param {Object} state
|
|
|
|
+ * @param {Object} _taskObj
|
|
|
|
+ */
|
|
|
|
+ setActionJumpTask(state, _taskObj) {
|
|
|
|
+ uni.setStorageSync('currentJumpTask', _taskObj);
|
|
|
|
+ state.currentJumpTask = _taskObj;
|
|
|
|
+ },
|
|
|
|
+ //获取本地任务对象
|
|
|
|
+ getActionJumpTask(state) {
|
|
|
|
+ //如果存在本地任务
|
|
|
|
+ const value = uni.getStorageSync('currentJumpTask');
|
|
|
|
+ if (value) {
|
|
|
|
+ state.currentJumpTask = value;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
|
|
|
|
+ setFinallSelectFriendInfo(state, friendInfo) {
|
|
|
|
+ state.finallySelectFriendInfo = friendInfo;
|
|
|
|
+ },
|
|
|
|
+ clearFinallFriendInfo(state) {
|
|
|
|
+ state.finallySelectFriendInfo = null;
|
|
|
|
+ },
|
|
/**
|
|
/**
|
|
* 获取记录的最后一次连接设备
|
|
* 获取记录的最后一次连接设备
|
|
* @param {Object} state
|
|
* @param {Object} state
|
|
@@ -677,8 +715,10 @@ const store = new Vuex.Store({
|
|
success();
|
|
success();
|
|
} else {
|
|
} else {
|
|
|
|
|
|
- state.planData.cumulativeCalorie = Number(state.planData.cumulativeCalorie).sub(_localCalorieInt);
|
|
|
|
- state.planData.showCalorie = Number(state.planData.showCalorie).sub(_localCalorieInt);
|
|
|
|
|
|
+ state.planData.cumulativeCalorie = Number(state.planData.cumulativeCalorie).sub(
|
|
|
|
+ _localCalorieInt);
|
|
|
|
+ state.planData.showCalorie = Number(state.planData.showCalorie).sub(
|
|
|
|
+ _localCalorieInt);
|
|
|
|
|
|
self.commit("setLocalCalorie", oldLocalCalorie);
|
|
self.commit("setLocalCalorie", oldLocalCalorie);
|
|
if (fail)
|
|
if (fail)
|
|
@@ -690,7 +730,8 @@ const store = new Vuex.Store({
|
|
},
|
|
},
|
|
e => {
|
|
e => {
|
|
console.log(e);
|
|
console.log(e);
|
|
- state.planData.cumulativeCalorie = Number(state.planData.cumulativeCalorie).sub(_localCalorieInt);
|
|
|
|
|
|
+ state.planData.cumulativeCalorie = Number(state.planData.cumulativeCalorie).sub(
|
|
|
|
+ _localCalorieInt);
|
|
state.planData.showCalorie = Number(state.planData.showCalorie).sub(_localCalorieInt);
|
|
state.planData.showCalorie = Number(state.planData.showCalorie).sub(_localCalorieInt);
|
|
self.commit("setLocalCalorie", oldLocalCalorie);
|
|
self.commit("setLocalCalorie", oldLocalCalorie);
|
|
|
|
|
|
@@ -896,7 +937,8 @@ const store = new Vuex.Store({
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- state.planData.allCalorie = state.planData.showCalorie.add(state.planData.localCalorie);
|
|
|
|
|
|
+ state.planData.allCalorie = state.planData.showCalorie.add(state.planData
|
|
|
|
+ .localCalorie);
|
|
|
|
|
|
// console.log("======",state.planData )
|
|
// console.log("======",state.planData )
|
|
state.days = date.datedifference(res.data.startTime, res.data.endTime) + 1;
|
|
state.days = date.datedifference(res.data.startTime, res.data.endTime) + 1;
|
|
@@ -1186,6 +1228,9 @@ const store = new Vuex.Store({
|
|
//最近连接过的设备
|
|
//最近连接过的设备
|
|
state.finallyUseDevice = null;
|
|
state.finallyUseDevice = null;
|
|
|
|
|
|
|
|
+ //最近选择的好友
|
|
|
|
+ state.finallySelectFriendInfo = null;
|
|
|
|
+
|
|
//记录的蓝牙设备,保存id, 和对应的蓝牙连接数据
|
|
//记录的蓝牙设备,保存id, 和对应的蓝牙连接数据
|
|
state.BLEDeviceList = [];
|
|
state.BLEDeviceList = [];
|
|
//显示的蓝牙设备,取本地数据时候更新
|
|
//显示的蓝牙设备,取本地数据时候更新
|
|
@@ -1195,6 +1240,9 @@ const store = new Vuex.Store({
|
|
state.oldArcbarProCalorie = 0;
|
|
state.oldArcbarProCalorie = 0;
|
|
//记录表盘当前的总卡路里
|
|
//记录表盘当前的总卡路里
|
|
state.oldArcbarAllCalorie = 0;
|
|
state.oldArcbarAllCalorie = 0;
|
|
|
|
+
|
|
|
|
+ //任务相关
|
|
|
|
+ state.currentJumpTask = null;
|
|
},
|
|
},
|
|
|
|
|
|
loginUserInfo(state, data) {
|
|
loginUserInfo(state, data) {
|
|
@@ -1434,7 +1482,7 @@ const store = new Vuex.Store({
|
|
state.bListenerAccArray = false;
|
|
state.bListenerAccArray = false;
|
|
//更新二进制的
|
|
//更新二进制的
|
|
state.bListenerHexUpdate = false;
|
|
state.bListenerHexUpdate = false;
|
|
-
|
|
|
|
|
|
+
|
|
},
|
|
},
|
|
//连接蓝牙
|
|
//连接蓝牙
|
|
onCreateBLEConnection(state, context) {
|
|
onCreateBLEConnection(state, context) {
|
|
@@ -1811,7 +1859,8 @@ const store = new Vuex.Store({
|
|
gz
|
|
gz
|
|
} = data.gyro;
|
|
} = data.gyro;
|
|
|
|
|
|
- state.filter.Update(new o0.Vector3(ax, ay, az), msGap, new o0.Vector3(gx, gy, gz), callback); //我自己的更新acc的函数
|
|
|
|
|
|
+ state.filter.Update(new o0.Vector3(ax, ay, az), msGap, new o0.Vector3(gx, gy, gz),
|
|
|
|
+ callback); //我自己的更新acc的函数
|
|
},
|
|
},
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -2093,7 +2142,8 @@ const store = new Vuex.Store({
|
|
if (!res.connected) {
|
|
if (!res.connected) {
|
|
|
|
|
|
//要在连接的状态下 ,并且获取过匹配列表有参数的情况下,才提示重连
|
|
//要在连接的状态下 ,并且获取过匹配列表有参数的情况下,才提示重连
|
|
- if (!state.bShowBLEConnectModal && state.bVerifiedConnection && state.bPhoneMatched) {
|
|
|
|
|
|
+ if (!state.bShowBLEConnectModal && state.bVerifiedConnection && state
|
|
|
|
+ .bPhoneMatched) {
|
|
state.bShowBLEConnectModal = true;
|
|
state.bShowBLEConnectModal = true;
|
|
let _connectItem = Object.assign({}, state.BLEConnectDevice);
|
|
let _connectItem = Object.assign({}, state.BLEConnectDevice);
|
|
let _cIndex = state.cIndex;
|
|
let _cIndex = state.cIndex;
|
|
@@ -2120,6 +2170,9 @@ const store = new Vuex.Store({
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
+ } else {
|
|
|
|
+ //断开连接后reset一下参数
|
|
|
|
+ _self.commit("onResetBLEConnection");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -2201,7 +2254,8 @@ const store = new Vuex.Store({
|
|
}
|
|
}
|
|
for (let i = 0; i < serviceList.length; i++) {
|
|
for (let i = 0; i < serviceList.length; i++) {
|
|
let service = serviceList[i];
|
|
let service = serviceList[i];
|
|
- if (service.uuid.toLocaleLowerCase() === item.PRIMARY_SERVICE.toLocaleLowerCase()) {
|
|
|
|
|
|
+ if (service.uuid.toLocaleLowerCase() === item.PRIMARY_SERVICE
|
|
|
|
+ .toLocaleLowerCase()) {
|
|
state.serviceId = service.uuid;
|
|
state.serviceId = service.uuid;
|
|
//开始获取指定服务的特征值
|
|
//开始获取指定服务的特征值
|
|
_self.commit('B_GetBLEDeviceCharacteristics', {
|
|
_self.commit('B_GetBLEDeviceCharacteristics', {
|
|
@@ -2372,7 +2426,7 @@ const store = new Vuex.Store({
|
|
let ay4 = BLE.hexToSignedInt(ay4Str) / 32768 * 16;
|
|
let ay4 = BLE.hexToSignedInt(ay4Str) / 32768 * 16;
|
|
let az4 = BLE.hexToSignedInt(az4Str) / 32768 * 16;
|
|
let az4 = BLE.hexToSignedInt(az4Str) / 32768 * 16;
|
|
|
|
|
|
- let accArray= [{
|
|
|
|
|
|
+ let accArray = [{
|
|
ax: ax1,
|
|
ax: ax1,
|
|
ay: ay1,
|
|
ay: ay1,
|
|
az: az1,
|
|
az: az1,
|
|
@@ -2401,21 +2455,21 @@ const store = new Vuex.Store({
|
|
min: min4,
|
|
min: min4,
|
|
s: s4
|
|
s: s4
|
|
}]
|
|
}]
|
|
-
|
|
|
|
- for(let i=0 ;i<accArray.length;i++){
|
|
|
|
|
|
+
|
|
|
|
+ for (let i = 0; i < accArray.length; i++) {
|
|
let _temp = accArray[i];
|
|
let _temp = accArray[i];
|
|
box["acc"] = {
|
|
box["acc"] = {
|
|
- ax:_temp.ax,
|
|
|
|
- ay:_temp.ay,
|
|
|
|
- az:_temp.az,
|
|
|
|
|
|
+ ax: _temp.ax,
|
|
|
|
+ ay: _temp.ay,
|
|
|
|
+ az: _temp.az,
|
|
};
|
|
};
|
|
box["min"] = _temp.min;
|
|
box["min"] = _temp.min;
|
|
box["s"] = _temp.s;
|
|
box["s"] = _temp.s;
|
|
box["ms"] = _temp.ms;
|
|
box["ms"] = _temp.ms;
|
|
-
|
|
|
|
|
|
+
|
|
uni.$emit('updateBLEDeviceData', box);
|
|
uni.$emit('updateBLEDeviceData', box);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -2522,7 +2576,7 @@ const store = new Vuex.Store({
|
|
// bSendHex: true,
|
|
// bSendHex: true,
|
|
// bOpen: true
|
|
// bOpen: true
|
|
// });
|
|
// });
|
|
- console.log('B_OpenRopeSkipping',3);
|
|
|
|
|
|
+ console.log('B_OpenRopeSkipping', 3);
|
|
this.commit('onWriteBLEConnectionValue', {
|
|
this.commit('onWriteBLEConnectionValue', {
|
|
value: "3"
|
|
value: "3"
|
|
});
|
|
});
|
|
@@ -2620,7 +2674,8 @@ const store = new Vuex.Store({
|
|
_sendData = BLE.str2ab(value);
|
|
_sendData = BLE.str2ab(value);
|
|
}
|
|
}
|
|
|
|
|
|
- console.log("currentInstruction:", state.currentInstruction, value, state.bListenerUpdate, state.bListenerMac,
|
|
|
|
|
|
+ console.log("currentInstruction:", state.currentInstruction, value, state.bListenerUpdate, state
|
|
|
|
+ .bListenerMac,
|
|
state.bListenerHexUpdate);
|
|
state.bListenerHexUpdate);
|
|
console.log("state.deviceId:", state.deviceId, state.serviceId, state.writeCharacteristicId);
|
|
console.log("state.deviceId:", state.deviceId, state.serviceId, state.writeCharacteristicId);
|
|
uni.writeBLECharacteristicValue({
|
|
uni.writeBLECharacteristicValue({
|
|
@@ -2631,7 +2686,8 @@ const store = new Vuex.Store({
|
|
// 这里的value是ArrayBuffer类型
|
|
// 这里的value是ArrayBuffer类型
|
|
value: _sendData,
|
|
value: _sendData,
|
|
success: (res) => {
|
|
success: (res) => {
|
|
- console.log('writeBLECharacteristicValue success', res.errMsg, value, retryCount);
|
|
|
|
|
|
+ console.log('writeBLECharacteristicValue success', res.errMsg, value,
|
|
|
|
+ retryCount);
|
|
if (success) {
|
|
if (success) {
|
|
success(res);
|
|
success(res);
|
|
}
|
|
}
|
|
@@ -2640,7 +2696,8 @@ const store = new Vuex.Store({
|
|
console.log(fail)
|
|
console.log(fail)
|
|
//重新写入
|
|
//重新写入
|
|
if (retryCount > 0) {
|
|
if (retryCount > 0) {
|
|
- console.log("writeBLECharacteristicValue Rewrite ===================>" + value + " == " + retryCount);
|
|
|
|
|
|
+ console.log("writeBLECharacteristicValue Rewrite ===================>" +
|
|
|
|
+ value + " == " + retryCount);
|
|
retryCount--;
|
|
retryCount--;
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
this.commit("B_WriteBLECharacteristicValue", {
|
|
this.commit("B_WriteBLECharacteristicValue", {
|