|
@@ -1,7 +1,7 @@
|
|
import { defineStore } from "pinia";
|
|
import { defineStore } from "pinia";
|
|
import Web3 from "web3";
|
|
import Web3 from "web3";
|
|
import CryptoJS from "crypto-js";
|
|
import CryptoJS from "crypto-js";
|
|
-import { cloneDeep } from "lodash";
|
|
|
|
|
|
+import { cloneDeep, forEach } from "lodash";
|
|
import { sysLogin } from "@/common/login.js";
|
|
import { sysLogin } from "@/common/login.js";
|
|
|
|
|
|
|
|
|
|
@@ -123,9 +123,22 @@ export const useWalletStore = defineStore("useWalletStore", {
|
|
this.walletList.push(data)
|
|
this.walletList.push(data)
|
|
}
|
|
}
|
|
},
|
|
},
|
|
-
|
|
|
|
|
|
+ // 删除钱包
|
|
|
|
+ deleteWallet(id) {
|
|
|
|
+ const list = this.walletList.filter(item => item.id != id);
|
|
|
|
+ this.walletList = list
|
|
|
|
+ },
|
|
// 切换钱包
|
|
// 切换钱包
|
|
- switchWallet(account) {
|
|
|
|
|
|
+ switchWallet(id) {
|
|
|
|
+ const item = this.walletList.find(item => item.id === id);
|
|
|
|
+ if(!item){
|
|
|
|
+ $msg($t("global.WalletDoesNotExist"))
|
|
|
|
+ }
|
|
|
|
+ forEach(this.$state, (_, key) => {
|
|
|
|
+ if (key !== "walletList") {
|
|
|
|
+ this.$state[key] = item[key];
|
|
|
|
+ }
|
|
|
|
+ })
|
|
},
|
|
},
|
|
},
|
|
},
|
|
});
|
|
});
|