...
This commit is contained in:
parent
40daef4c40
commit
d6edaaf64e
@ -1,8 +1,9 @@
|
|||||||
import Web3 from 'web3'
|
import Web3 from 'web3'
|
||||||
import { useAppStore } from '@/store/app'
|
import { useAppStore } from '@/store/app'
|
||||||
import { ERC20ABI } from '@/configs/contracts'
|
import { ERC20ABI } from '@/configs/contracts'
|
||||||
|
import pinia from '@/store';
|
||||||
|
|
||||||
const AppModule = useAppStore();
|
const AppModule = useAppStore(pinia);
|
||||||
|
|
||||||
export class Chain {
|
export class Chain {
|
||||||
private web3: Web3
|
private web3: Web3
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Blockchain } from '@/chain/blockchain'
|
import { Blockchain } from '@/chain/blockchain'
|
||||||
import { getNonce } from '@/api/User'
|
import { getNonce } from '@/api/User'
|
||||||
|
import pinia from '@/store';
|
||||||
import { useAppStore } from '@/store/app'
|
import { useAppStore } from '@/store/app'
|
||||||
import { useUserStore } from '@/store/user'
|
import { useUserStore } from '@/store/user'
|
||||||
import { message } from 'ant-design-vue'
|
import { message } from 'ant-design-vue'
|
||||||
@ -8,7 +9,7 @@ import { AVAILABLE_CHAINS } from '@/configs/configchain'
|
|||||||
import { AllChains } from '@/configs/allchain'
|
import { AllChains } from '@/configs/allchain'
|
||||||
import { ACTIVATE_PROXY_ABI, MYSTERY_BOX_ABI, MYSTERY_PROXY_ABI } from '@/configs/contracts'
|
import { ACTIVATE_PROXY_ABI, MYSTERY_BOX_ABI, MYSTERY_PROXY_ABI } from '@/configs/contracts'
|
||||||
|
|
||||||
const AppModule = useAppStore();
|
const AppModule = useAppStore(pinia);
|
||||||
const UserModule = useUserStore();
|
const UserModule = useUserStore();
|
||||||
|
|
||||||
export default class ChainManager {
|
export default class ChainManager {
|
||||||
|
@ -53,34 +53,32 @@
|
|||||||
import { ref, reactive, onMounted, computed } from "vue";
|
import { ref, reactive, onMounted, computed } from "vue";
|
||||||
import { useChainStore } from "@/store/chain";
|
import { useChainStore } from "@/store/chain";
|
||||||
import { useAppStore } from "@/store/app";
|
import { useAppStore } from "@/store/app";
|
||||||
import pinia from "@/store";
|
|
||||||
import { useRouter, useRoute } from "vue-router";
|
import { useRouter, useRoute } from "vue-router";
|
||||||
import ChainModel from "../../components/home/ChainModel.vue";
|
import ChainModel from "../../components/home/ChainModel.vue";
|
||||||
const AppModule = useAppStore(pinia);
|
const AppModule = useAppStore();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const chain = useChainStore();
|
const chain = useChainStore();
|
||||||
const app = useAppStore();
|
|
||||||
|
|
||||||
function click(event) {
|
function click(event) {
|
||||||
router.push(event.key);
|
router.push(event.key);
|
||||||
}
|
}
|
||||||
|
|
||||||
const formatAddress = computed(() => {
|
const formatAddress = computed(() => {
|
||||||
console.log(AppModule.accountId.value,'AppModule.accountId');
|
console.log(AppModule.accountId,'AppModule.accountId');
|
||||||
if(!AppModule.accountId.value){
|
if(!AppModule.accountId){
|
||||||
return '-'
|
return '-'
|
||||||
}
|
}
|
||||||
if (AppModule.accountId.value.length >= 10) {
|
if (AppModule.accountId.length >= 10) {
|
||||||
return (
|
return (
|
||||||
AppModule.accountId.value.substring(0, 6) +
|
AppModule.accountId.substring(0, 6) +
|
||||||
"......" +
|
"......" +
|
||||||
AppModule.accountId.value.substring(AppModule.accountId.value.length - 4)
|
AppModule.accountId.substring(AppModule.accountId.length - 4)
|
||||||
);
|
);
|
||||||
} else if (
|
} else if (
|
||||||
AppModule.accountId.value.length > 0 &&
|
AppModule.accountId.length > 0 &&
|
||||||
AppModule.accountId.value.length < 10
|
AppModule.accountId.length < 10
|
||||||
) {
|
) {
|
||||||
return AppModule.accountId.value
|
return AppModule.accountId
|
||||||
} else {
|
} else {
|
||||||
return "-";
|
return "-";
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import 'normalize.css';
|
|||||||
import "@/assets/text/text.css";
|
import "@/assets/text/text.css";
|
||||||
import Antd from 'ant-design-vue';
|
import Antd from 'ant-design-vue';
|
||||||
import 'ant-design-vue/dist/antd.css';
|
import 'ant-design-vue/dist/antd.css';
|
||||||
import { createPinia } from "pinia";
|
import pinia from "@/store";
|
||||||
import router from "./router/index";
|
import router from "./router/index";
|
||||||
import VueAnimXyz from '@animxyz/vue3'
|
import VueAnimXyz from '@animxyz/vue3'
|
||||||
import '@animxyz/core' // Import css here if you haven't elsewhere
|
import '@animxyz/core' // Import css here if you haven't elsewhere
|
||||||
@ -13,4 +13,4 @@ import App from './App.vue'
|
|||||||
import vue3dLoader from "vue-3d-loader";
|
import vue3dLoader from "vue-3d-loader";
|
||||||
|
|
||||||
const app = createApp(App);
|
const app = createApp(App);
|
||||||
app.use(createPinia()).use(VueAnimXyz).use(vue3dLoader).use(Antd).use(router).mount('#app')
|
app.use(pinia).use(VueAnimXyz).use(vue3dLoader).use(Antd).use(router).mount('#app')
|
||||||
|
@ -27,8 +27,9 @@ export const useAppStore = defineStore('app', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateAccount(_accountId) {
|
function updateAccount(_accountId) {
|
||||||
|
console.log("updateAccount start", accountId, _accountId);
|
||||||
accountId.value = _accountId;
|
accountId.value = _accountId;
|
||||||
|
console.log("updateAccount end", accountId, _accountId);
|
||||||
}
|
}
|
||||||
function updateChainID(_chainId) {
|
function updateChainID(_chainId) {
|
||||||
chainId.value = _chainId;
|
chainId.value = _chainId;
|
||||||
|
@ -26,7 +26,7 @@ export const useUserStore = defineStore("user", () => {
|
|||||||
|
|
||||||
const token = ref(getToken());
|
const token = ref(getToken());
|
||||||
const accountId = ref(getAccountId());
|
const accountId = ref(getAccountId());
|
||||||
AppModule.updateAccount(accountId);
|
AppModule.updateAccount(accountId.value);
|
||||||
if(token.value && accountId.value){
|
if(token.value && accountId.value){
|
||||||
|
|
||||||
AppModule.updateStep(1);
|
AppModule.updateStep(1);
|
||||||
@ -66,9 +66,11 @@ export const useUserStore = defineStore("user", () => {
|
|||||||
console.log("login data: ", authData);
|
console.log("login data: ", authData);
|
||||||
const res = await login(authData);
|
const res = await login(authData);
|
||||||
if (!res.errcode && res.token) {
|
if (!res.errcode && res.token) {
|
||||||
|
accountId.value = account;
|
||||||
setToken(res.token);
|
setToken(res.token);
|
||||||
console.log(res, "resres");
|
console.log(res, "resres");
|
||||||
setAccountId(account);
|
setAccountId(account);
|
||||||
|
AppModule.updateAccount(account);
|
||||||
AppModule.updateToken(res.token);
|
AppModule.updateToken(res.token);
|
||||||
token.value = res.token;
|
token.value = res.token;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user