|
@@ -1,64 +1,64 @@
|
|
<template>
|
|
<template>
|
|
- <div class="container">
|
|
|
|
|
|
+ <div class="container">
|
|
<div class="tag-container">
|
|
<div class="tag-container">
|
|
- <van-tag v-for="item in walletData.words" :key="item" plain type="primary" text-color="#4765DD">{{ item }}</van-tag>
|
|
|
|
|
|
+ <van-tag
|
|
|
|
+ v-for="item in walletData.words"
|
|
|
|
+ :key="item"
|
|
|
|
+ plain
|
|
|
|
+ type="primary"
|
|
|
|
+ text-color="#4765DD"
|
|
|
|
+ >{{ item }}</van-tag
|
|
|
|
+ >
|
|
</div>
|
|
</div>
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- <div class="button-group" >
|
|
|
|
-
|
|
|
|
- <a class="button-group-mnemonic a-link" @click="copyText" > {{ $t('login.CopyMnemonic') }}</a>
|
|
|
|
|
|
+ <div class="button-group">
|
|
|
|
+ <a class="button-group-mnemonic a-link im-copy-btn" :data-clipboard-text="walletData.words">
|
|
|
|
+ {{ $t("login.CopyMnemonic") }}</a
|
|
|
|
+ >
|
|
<van-button round block type="primary" native-type="submit" @click="next">
|
|
<van-button round block type="primary" native-type="submit" @click="next">
|
|
{{ $t("login.BackupComplete") }}
|
|
{{ $t("login.BackupComplete") }}
|
|
</van-button>
|
|
</van-button>
|
|
</div>
|
|
</div>
|
|
-
|
|
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
-<script setup>
|
|
|
|
-import { Clipboard } from '@capacitor/clipboard';
|
|
|
|
|
|
+<script setup>
|
|
import { createAccent } from "@/api/path/login.api";
|
|
import { createAccent } from "@/api/path/login.api";
|
|
import { useSystemStore } from "@/stores/modules/systemStore";
|
|
import { useSystemStore } from "@/stores/modules/systemStore";
|
|
import { useWalletAuth } from "@/composables/useWalletAuth";
|
|
import { useWalletAuth } from "@/composables/useWalletAuth";
|
|
|
|
|
|
|
|
+// 一键复制文本
|
|
|
|
+import { useCopy } from '@/hooks/use-copy.js';
|
|
|
|
+useCopy();
|
|
|
|
|
|
const systemStore = useSystemStore();
|
|
const systemStore = useSystemStore();
|
|
-const {
|
|
|
|
- authState,
|
|
|
|
- loginWithPrivateKey,
|
|
|
|
- loginWithStorage,
|
|
|
|
- logout,
|
|
|
|
|
|
+const {
|
|
|
|
+ authState,
|
|
|
|
+ loginWithPrivateKey,
|
|
|
|
+ loginWithStorage,
|
|
|
|
+ logout,
|
|
hasStoredWallet,
|
|
hasStoredWallet,
|
|
- getBalance
|
|
|
|
-} = useWalletAuth()
|
|
|
|
|
|
+ getBalance,
|
|
|
|
+} = useWalletAuth();
|
|
|
|
|
|
-const walletData = ref({})
|
|
|
|
|
|
+const walletData = ref({});
|
|
|
|
|
|
const next = async () => {
|
|
const next = async () => {
|
|
-
|
|
|
|
// 登录
|
|
// 登录
|
|
- const data = await loginWithPrivateKey(systemStore.getWallet.privateKey.trim())
|
|
|
|
- console.log("data=", data)
|
|
|
|
- //
|
|
|
|
- const res = await getBalance()
|
|
|
|
- console.log("res=", res)
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-const copyText = async () => {
|
|
|
|
- await Clipboard.write({
|
|
|
|
- string: walletData.value.words
|
|
|
|
- });
|
|
|
|
- $msg({type: 'success', message: $t("login.CopiedToClipboard")});
|
|
|
|
|
|
+ const data = await loginWithPrivateKey(
|
|
|
|
+ systemStore.getWallet.privateKey.trim()
|
|
|
|
+ );
|
|
|
|
+ console.log("data=", data);
|
|
|
|
+ //
|
|
|
|
+ const res = await getBalance();
|
|
|
|
+ console.log("res=", res);
|
|
};
|
|
};
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
const { data } = await createAccent({});
|
|
const { data } = await createAccent({});
|
|
- walletData.value = JSON.parse(atob(data.content) )
|
|
|
|
|
|
+ walletData.value = JSON.parse(atob(data.content));
|
|
systemStore.setStateValue({
|
|
systemStore.setStateValue({
|
|
key: "wallet",
|
|
key: "wallet",
|
|
value: {
|
|
value: {
|
|
@@ -67,38 +67,37 @@ onMounted(async () => {
|
|
},
|
|
},
|
|
localStorage: true,
|
|
localStorage: true,
|
|
});
|
|
});
|
|
-})
|
|
|
|
|
|
+});
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style scoped lang="less">
|
|
<style scoped lang="less">
|
|
-
|
|
|
|
-.tag-container{
|
|
|
|
- margin-top: 3px;
|
|
|
|
|
|
+.tag-container {
|
|
|
|
+ margin-top: 3px;
|
|
display: grid;
|
|
display: grid;
|
|
grid-template-columns: repeat(3, 1fr);
|
|
grid-template-columns: repeat(3, 1fr);
|
|
grid-gap: 16px;
|
|
grid-gap: 16px;
|
|
padding: 27px;
|
|
padding: 27px;
|
|
- .van-tag{
|
|
|
|
|
|
+ .van-tag {
|
|
width: 87px;
|
|
width: 87px;
|
|
height: 33px;
|
|
height: 33px;
|
|
display: flex;
|
|
display: flex;
|
|
align-items: center;
|
|
align-items: center;
|
|
justify-content: center;
|
|
justify-content: center;
|
|
border-radius: 4px;
|
|
border-radius: 4px;
|
|
- }
|
|
|
|
- .van-tag--plain{
|
|
|
|
- background: #ECEFFC;
|
|
|
|
|
|
+ }
|
|
|
|
+ .van-tag--plain {
|
|
|
|
+ background: #eceffc;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-.button-group{
|
|
|
|
- margin: 33px 17px 0 17px;
|
|
|
|
|
|
+.button-group {
|
|
|
|
+ margin: 33px 17px 0 17px;
|
|
display: flex;
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
align-items: center;
|
|
- .button-group-mnemonic{
|
|
|
|
- font-size: 14px;
|
|
|
|
|
|
+ .button-group-mnemonic {
|
|
|
|
+ font-size: 14px;
|
|
margin-bottom: 21px;
|
|
margin-bottom: 21px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-</style>
|
|
|
|
|
|
+</style>
|