Jelajahi Sumber

修改蓝牙 vuex

wangchao 3 tahun lalu
induk
melakukan
96e5400d87
2 mengubah file dengan 16 tambahan dan 31 penghapusan
  1. 0 23
      store/bluetooth/index.js
  2. 16 8
      store/index.js

+ 0 - 23
store/bluetooth/index.js

@@ -1,23 +0,0 @@
-let sysinfo = uni.getSystemInfoSync();
-const Bluetooth = {
-	state: {
-		//蓝牙信息
-		BLEInformation: {
-			platform: sysinfo.platform || "",
-			deviceId: "",
-			writeCharaterId: "",
-			writeServiceId: "",
-			notifyCharaterId: "",
-			notifyServiceId: "",
-			readCharaterId: "",
-			readServiceId: "",
-		}
-	},
-	mutations:{
-		BLEInformationSet(state, info){
-			state.BLEInformation = info;
-		}
-	}
-}
-
-export default Bluetooth;

+ 16 - 8
store/index.js

@@ -1,8 +1,6 @@
 import Vue from 'vue'
 import Vue from 'vue'
 import Vuex from 'vuex'
 import Vuex from 'vuex'
 Vue.use(Vuex)
 Vue.use(Vuex)
-//蓝牙设置
-import Bluetooth from '@/store/bluetooth/index.js'
 let lifeData = {};
 let lifeData = {};
 
 
 try {
 try {
@@ -41,12 +39,10 @@ const saveLifeData = function(key, value) {
 		uni.setStorageSync('lifeData', tmp);
 		uni.setStorageSync('lifeData', tmp);
 	}
 	}
 }
 }
+let sysinfo = uni.getSystemInfoSync();
 
 
 
 
 const store = new Vuex.Store({
 const store = new Vuex.Store({
-	modules: {
-		Bluetooth
-	},
 	state: {
 	state: {
 		sysinfo: uni.getSystemInfoSync(),//系统信息
 		sysinfo: uni.getSystemInfoSync(),//系统信息
 		enter:{},
 		enter:{},
@@ -93,7 +89,18 @@ const store = new Vuex.Store({
 		clientId: lifeData.clientId?lifeData.clientId: "",
 		clientId: lifeData.clientId?lifeData.clientId: "",
 		// 确定收货
 		// 确定收货
 		isConfigfreightTransport:true,
 		isConfigfreightTransport:true,
-		choice:""
+		choice:"",
+		//蓝牙信息
+		BLEInformation: {
+			platform: sysinfo.platform || "",
+			deviceId: "",
+			writeCharaterId: "",
+			writeServiceId: "",
+			notifyCharaterId: "",
+			notifyServiceId: "",
+			readCharaterId: "",
+			readServiceId: "",
+		}
 	},
 	},
 	mutations: {
 	mutations: {
 		$uStore(state, payload) {
 		$uStore(state, payload) {
@@ -140,8 +147,9 @@ const store = new Vuex.Store({
 		state.enter = provider
 		state.enter = provider
 		console.log(state)
 		console.log(state)
 		},
 		},
-		
-		
+		BLEInformationSet(state, info){
+			state.BLEInformation = info;
+		}
 	},
 	},
 	actions: {
 	actions: {