This commit is contained in:
huangjinming 2023-07-12 13:41:42 +08:00
parent 6364a44ec0
commit 24d1792640
13 changed files with 141 additions and 109 deletions

View File

@ -2,9 +2,9 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<link rel="icon" href="/logo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CEBG - Anime PUBG on fire!</title>
<title>Badge</title>
</head>
<script type="module">
import {Buffer} from 'buffer';

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

BIN
public/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

View File

@ -109,7 +109,7 @@ export class Blockchain {
this.saveProvider();
AppModule.updateChainID(chainId);
AppModule.updateWalletStatus(true);
console.log("current login chain: ", chainId);
console.log("accountsLogin: ", accounts, AppModule.accountId);
if (isManual) {
@ -198,12 +198,12 @@ export class Blockchain {
*/
private selectChain(): Promise<number> {
return new Promise((resolve, reject) => {
this.switchEthereumChain(AVAILABLE_CHAINS[0], (res: any)=>{
this.switchEthereumChain(AVAILABLE_CHAINS[0], (res: any) => {
if (res.err) {
reject && reject(res.err)
return
reject && reject(res.err);
return;
}
resolve && resolve(res.chain)
resolve && resolve(res.chain);
});
});
}
@ -253,7 +253,7 @@ export class Blockchain {
public async getContractInstance(address: string, abi: any = ERC20ABI) {
if (!this.web3) {
this.connectWallet(true)
this.connectWallet(true);
// throw new Error(
// "Web3 instance is not initialized. Please call `initWeb3` method after user login."
// );
@ -319,7 +319,7 @@ export class Blockchain {
if (accounts && accounts.length > 0) {
if (AppModule.accountId !== accounts[0]) {
await UserModule.Logout();
this.currentChain = 0;
this.walletType = 0;
this.instanceCacheMap.clear();
@ -333,7 +333,6 @@ export class Blockchain {
localStorage.removeItem("supplyLimit");
localStorage.removeItem("mintableCount");
location.reload();
}
}
});
@ -366,7 +365,7 @@ export class Blockchain {
const onChainChange = (chainId: string) => {
console.log("switchEthereumChain: ", chainId);
this.provider.removeListener("chainChanged", onChainChange);
cb && cb({chain: chainId});
cb && cb({ chain: chainId });
};
this.provider.on("chainChanged", onChainChange);
try {
@ -391,7 +390,7 @@ export class Blockchain {
} catch (addError) {
console.error("add chain error: ", addError);
this.provider.removeListener("chainChanged", onChainChange);
cb && cb({err: addError})
cb && cb({ err: addError });
}
}
@ -467,11 +466,11 @@ export class Blockchain {
);
const res = await coinInstance.methods.totalSupply().call();
console.log("totalSupply: ", res);
return res
return res;
}
// 获取当前用户可mint的数量
public async getMintableCount(address?: string) {
// address = address || //TODO: current address
// address = address || //TODO: current address
const coinInstance: any = await this.getContractInstance(
Global.MEDAL_REWARDS_Address,
MEDAL_REWARDS_ABI
@ -480,7 +479,7 @@ export class Blockchain {
.getMintableCount(AppModule.accountId)
.call();
console.log("getMintableCount: ", res);
return res
return res;
}
// 获取当前用户的mint总数
public async supplyLimit(address: string) {
@ -490,7 +489,7 @@ export class Blockchain {
);
const res = await coinInstance.methods.supplyLimit().call();
console.log("supplyLimit: ", res);
return res
return res;
}
/**
* @param {string} address
@ -500,7 +499,8 @@ export class Blockchain {
public async getBalance(address: string, account: string | null) {
account = account || AppModule.accountId;
const coinInstance: any = await this.getContractInstance(address);
return await coinInstance.methods.balanceOf(account).call();
const res = await coinInstance.methods.balanceOf(account).call();
return res;
}
public async transferToAccount(

View File

@ -26,7 +26,7 @@
</div>
<div class="exclusive">
<div v-if="visible" class="w-[28rem] text-gray-100 text-content">
This is an exclusive badge for CEBG Genesis NFT holders. It will serve
This is an exclusive badge for Counter Fire Genesis NFT holders. It will serve
as an identity credential for Genesis NFT holders to participate in
all future activities.
</div>

View File

@ -1,6 +1,6 @@
<template>
<div>
<div class="flex pt-20 pl-2 pb-3">
<div class="pl-2 pb-3 containers">
<div class="card shadow-md rounded cards-container">
<div></div>
<div
@ -47,7 +47,9 @@
<img src="@/assets/img/badge/title-boder.png" alt="" />
</div>
<div class="text-content font-poppins-regular">
<p>This is an exclusive badge for CEBG Genesis NFT holders.</p>
<p>
This is an exclusive badge for Counter Fire Genesis NFT holders.
</p>
<p>
It will serve as an identity credential for Genesis NFT holders to
participate in all future activities.
@ -63,12 +65,15 @@
<div class="december-number">
{{ totalSupply || "0" }} / {{ supplyLimit || "0" }}
</div>
<div
:class="mintableCount == 0 ? 'disabled-claim' : 'claim'"
@click="handClaimBadge"
>
<div class="claim-item">Claim your Airdorp</div>
<div
<div class="claim" @click="handClaimBadge">
<div class="claim-item">
{{
quantity > 0
? "Airdropped: " + quantity
: "You're not eligible for this stage."
}}
</div>
<!-- <div
class="dis-msg"
v-show="mintableCount == 0"
:class="{
@ -84,7 +89,7 @@
alt=""
/>
</div>
</div>
</div> -->
</div>
</div>
<div class="card shadow-md rounded cards-container">
@ -137,6 +142,7 @@ const scrollOffset = ref("0%");
const parallaxFactor = 0.135; //
const visible = ref(false);
const canClaim = ref(false);
const quantity = ref(0);
const isLoading = ref(false);
const chain = useChainStore();
const totalSupply = ref(0);
@ -164,10 +170,9 @@ function shuffle(array) {
return array;
}
const statusMessage = computed(() => {
if (props.claimStatus ==-1 && mintableCount.value == 0) {
if (props.claimStatus == -1 && mintableCount.value == 0) {
return "No eligibility to claim";
} else {
switch (props.claimStatus) {
case -1:
return "Unclaimed";
@ -322,7 +327,13 @@ const loadDataFromLocalStorage = () => {
const fetchData = async () => {
try {
//
const Address='0x3F13F83E6363D97d0353cAAfACA08B05D9BF3637'
quantity.value = await chain.chainManager.bc.getBalance(
Address,
AppModule.accountId
);
console.log(quantity.value, "quantity.value");
totalSupply.value = await chain.chainManager.bc.totalSupply();
//mint
@ -337,10 +348,10 @@ const fetchData = async () => {
// }
//mint
supplyLimit.value = await chain.chainManager.bc.supplyLimit();
saveDataToLocalStorage();
const res = await claimInfoStatus();
claimStatus.value = res.data[1].status;
console.log(res.data, "claimInfoStatus2");
} catch (error) {
// console.error("Error fetching data:", error);
}
@ -424,6 +435,10 @@ onUnmounted(() => {
</script>
<style lang="scss" scoped>
.containers {
display: flex;
padding-top: 64px;
}
.cards-container {
transition: transform 0.5s ease-out;
}
@ -802,39 +817,39 @@ p {
color: #8b8b8b;
margin-bottom: 80px;
display: flex;
cursor: pointer;
// cursor: pointer;
position: relative;
border-radius: 12px;
align-items: center;
justify-content: center;
border: 1px solid #a6a6a6;
// border: 1px solid #a6a6a6;
user-select: none;
cursor: not-allowed;
//cursor: not-allowed;
// background: #FFEA00;
.claim-item {
position: relative;
padding-right: 20px;
}
.claim-item::after {
content: "";
display: inline-block;
position: absolute;
top: 50%;
left: 100%; /* 将图标放在文字的右侧 */
transform: translateY(-50%); /* 垂直居中对齐 */
width: 10px; /* 设置图标宽度 */
height: 10px; /* 设置图标高度 */
background-image: url("@/assets/img/badge/grey.png");
background-size: contain;
background-repeat: no-repeat;
margin-left: 0px; /* 与文字之间的间距 */
transition: margin-left 0.3s, background-image 0.3s; /* 添加过渡动画 */
}
}
.disabled-claim:hover .claim-item::after {
background-image: url("@/assets/img/badge/grey.png");
margin-left: 10px; /* 在 hover 时向前移动 4px */
// .claim-item::after {
// content: "";
// display: inline-block;
// position: absolute;
// top: 50%;
// left: 100%; /* */
// transform: translateY(-50%); /* */
// width: 10px; /* */
// height: 10px; /* */
// background-image: url("@/assets/img/badge/grey.png");
// background-size: contain;
// background-repeat: no-repeat;
// margin-left: 0px; /* */
// transition: margin-left 0.3s, background-image 0.3s; /* */
// }
}
// .disabled-claim:hover .claim-item::after {
// background-image: url("@/assets/img/badge/grey.png");
// margin-left: 10px; /* hover 4px */
// }
.claim {
width: 300px;
height: 64px;
@ -843,52 +858,52 @@ p {
font-family: Arial;
font-weight: 400;
margin-bottom: 50px;
color: #2f2b0b;
color: #fffefe;
user-select: none;
display: flex;
cursor: pointer;
// cursor: pointer;
border-radius: 12px;
align-items: center;
justify-content: center;
background: #ffba00;
// background: #ffba00;
// background-size: contain;
.claim-item {
position: relative;
padding-right: 20px;
}
.claim-item::after {
content: "";
display: inline-block;
position: absolute;
top: 50%;
left: 100%; /* 将图标放在文字的右侧 */
transform: translateY(-50%); /* 垂直居中对齐 */
width: 10px; /* 设置图标宽度 */
height: 10px; /* 设置图标高度 */
background-image: url("@/assets/img/badge/triangle-black.png");
background-size: contain;
background-repeat: no-repeat;
margin-left: 0px; /* 与文字之间的间距 */
transition: margin-left 0.3s, background-image 0.3s; /* 添加过渡动画 */
}
}
.claim:hover .claim-item::after {
background-image: url("@/assets/img/badge/triangle-black.png");
margin-left: 10px; /* 在 hover 时向前移动 4px */
}
.claim:hover {
width: 300px;
height: 64px;
font-size: 18px;
font-family: Arial;
font-weight: 400;
border-radius: 12px;
color: #0c0c0c;
display: flex;
align-items: center;
justify-content: center;
background: #ffea00;
// .claim-item::after {
// content: "";
// display: inline-block;
// position: absolute;
// top: 50%;
// left: 100%; /* */
// transform: translateY(-50%); /* */
// width: 10px; /* */
// height: 10px; /* */
// background-image: url("@/assets/img/badge/triangle-black.png");
// background-size: contain;
// background-repeat: no-repeat;
// margin-left: 0px; /* */
// transition: margin-left 0.3s, background-image 0.3s; /* */
// }
}
// .claim:hover .claim-item::after {
// background-image: url("@/assets/img/badge/triangle-black.png");
// margin-left: 10px; /* hover 4px */
// }
// .claim:hover {
// width: 300px;
// height: 64px;
// font-size: 18px;
// font-family: Arial;
// font-weight: 400;
// border-radius: 12px;
// color: #0c0c0c;
// display: flex;
// align-items: center;
// justify-content: center;
// background: #ffea00;
// }
.dis-msg {
width: 300px;
height: 50px;

View File

@ -36,7 +36,7 @@
<div class="follow-content">
<div></div>
<div class="follow">
<a href="https://twitter.com/CEBG_GAME" class="twiter">
<a href="https://twitter.com/_CounterFire" class="twiter">
<!-- <img src="../../assets/img/home/logo/twiter.png" alt="" /> -->
</a>
<a href="https://t.me/CEBG_official" class="telegram">
@ -298,8 +298,8 @@ function backTop() {
justify-content: center;
align-items: center;
img {
width: 92px;
height: 89px;
width: 188px;
height: 44px;
}
}
}

View File

@ -1,31 +1,23 @@
<template>
<div>
<div class="nav">
<div class="h-[5.625rem] flex items-center justify-between">
<div class="h-38 w-38 ml-5 flex items-center justify-center">
<img
src="@/assets/img/home/header-logo.png"
alt="Logo"
class="h-38 w-38"
/>
<div class="nav-centent">
<div class="logo">
<a href="/">
<img src="@/assets/img/badge/logo.png" alt="Logo" />
</a>
</div>
<div
v-if="!chain.logined"
class="w-[18.75rem] login-btn h-[3.75rem] mr-6 flex items-center justify-center bg-button-default"
>
<div v-if="!chain.logined" class="login-btn bg-button-default">
<div
class="text-lg login-btn-item italic text-my-text-color font-poppins-semiBoldItalic decoration-1"
class="login-btn-item"
@click="login"
>
Content
</div>
</div>
<div
v-else
class="w-[18.75rem] h-[3.75rem] login-btn mr-6 flex items-center justify-center bg-button-default dropdown-container"
>
<div v-else class="login-btn bg-button-default dropdown-container">
<div
class="text-lg italic font-poppins-semiBoldItalic login-btn-item text-my-text-color decoration-1"
class=" login-btn-item "
>
{{ formatAddress }}
</div>
@ -109,6 +101,23 @@ const logout = async () => {
background: url("@/assets/img/badge/nav-bg.png") no-repeat;
background-size: 100% 100%;
}
.nav-centent {
display: flex;
justify-content: space-between;
align-items: center;
padding-left: 18px;
padding-right: 20px;
height: 90px;
.logo {
width: 142px;
height: 54px;
img {
width: 100%;
height: 54px;
}
}
}
.bg-button-default {
background-image: url("@/assets/img/badge/login-btn.png");
background-repeat: no-repeat;
@ -133,10 +142,18 @@ const logout = async () => {
}
.login-btn {
cursor: pointer;
width: 300px;
height: 60px;
display: flex;
justify-content: center;
align-items: center;
}
.login-btn-item {
position: relative;
padding-right: 20px;
color: #34290a;
font-style: italic;
font-family: 'Poppins-SemiBoldItalic';
text-transform: uppercase;
}
.login-btn-item::after {

View File

@ -214,7 +214,7 @@ export const AllChains = [
{
name: 'Arbitrum One',
type: 'Mainnet',
rpc: 'https://rpc.ankr.com/arbitrum',
rpc: 'https://arbitrum-one.public.blastapi.io',
id: 42161,
symbol: 'ETH',
explorerurl: 'https://arbiscan.io/'

View File

@ -15,7 +15,7 @@ export const ALL_PROVIDERS = [
},
];
export const AVAILABLE_CHAINS = env === "production" ? [421613] : [421613];
export const AVAILABLE_CHAINS = env === "production" ? [42161] : [42161];
export const OFFICE_ACCOUNT =
env === "production"