优化
This commit is contained in:
@@ -38,6 +38,43 @@ export function usePythonBridge() {
|
||||
// });
|
||||
// };
|
||||
|
||||
//删除前端储存数据
|
||||
const deleteStorageData = (data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (pyBridge.value) {
|
||||
pyBridge.value.deleteAccountInfo(JSON.stringify(data),function (result) {
|
||||
resolve(result);
|
||||
});
|
||||
}else{
|
||||
console.log("pyBridge is null未连接上")
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
//获取前端储存数据
|
||||
const getStorageData = (data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (pyBridge.value) {
|
||||
pyBridge.value.readAccountInfo(JSON.stringify(data),function (result) {
|
||||
resolve(result);
|
||||
});
|
||||
}else{
|
||||
console.log("pyBridge is null未连接上")
|
||||
}
|
||||
});
|
||||
};
|
||||
//设置前端储存数据
|
||||
const setStorageData = (data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (pyBridge.value) {
|
||||
pyBridge.value.storageAccountInfo(JSON.stringify(data),function (result) {
|
||||
resolve(result);
|
||||
});
|
||||
}else{
|
||||
console.log("pyBridge is null未连接上")
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 查询获取大哥的数据
|
||||
const controlTask = (data) => {
|
||||
@@ -58,7 +95,6 @@ export function usePythonBridge() {
|
||||
if (pyBridge.value) {
|
||||
pyBridge.value.getBrotherInfo(function (result) {
|
||||
resolve(JSON.parse(result));
|
||||
// ElMessage.success(result);
|
||||
});
|
||||
}else{
|
||||
console.log("pyBridge is null未连接上")
|
||||
@@ -92,7 +128,6 @@ export function usePythonBridge() {
|
||||
const givePyAnchorId = (id) => {
|
||||
console.log("id",id);
|
||||
if (pyBridge.value) {
|
||||
ElMessage.success(id);
|
||||
pyBridge.value.givePyAnchorId(id, function (result) {
|
||||
});
|
||||
}
|
||||
@@ -155,6 +190,9 @@ export function usePythonBridge() {
|
||||
controlTask,
|
||||
getBrotherInfo,
|
||||
getVersion,
|
||||
givePyAnchorId
|
||||
givePyAnchorId,
|
||||
getStorageData,
|
||||
setStorageData,
|
||||
deleteStorageData,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user