完成充值和cec活动

This commit is contained in:
yuyongdong 2024-08-20 14:44:56 +08:00
parent 7e8c95636f
commit ca83c4f9c0
4 changed files with 73 additions and 46 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -406,7 +406,7 @@
<div v-else class="item-amount item-amount-input">
<span @click="rechargeDecrease">-</span>
<!-- <span>0</span> -->
<input type="text" placeholder="0" v-model="brickworkAmount" @input="handleInput" oninput="value=value.replace(/[^\d]/g,'')">
<input type="number" placeholder="0" v-model="brickworkAmount" @input="handleInput" oninput="value=value.replace(/[^\d]/g,'')">
<span @click="rechargeIncrease">+</span>
<h4>Unit</h4>
</div>
@ -641,7 +641,6 @@ const getRechargeGoods = async () => {
// selectItem
const selectItem = (data, index) => {
console.log(toRaw(data))
activeIndex.value = index
if(data.goods_id == 1006) {
confirmRecharge.value = {
@ -660,10 +659,10 @@ const handleInput = (e) => {
if(Number(brickworkAmount.value) > toRaw(confirmRecharge.value).max_buy_times) {
brickworkAmount.value = toRaw(confirmRecharge.value).max_buy_times
toRaw(confirmRecharge.value).price = toRaw(confirmRecharge.value).max_buy_times
toRaw(confirmRecharge.value).diamond = brickworkAmount.value*50
toRaw(confirmRecharge.value).diamond = brickworkAmount.value*100
} else {
toRaw(confirmRecharge.value).price = brickworkAmount.value
toRaw(confirmRecharge.value).diamond = brickworkAmount.value*50
toRaw(confirmRecharge.value).diamond = brickworkAmount.value*100
priceAmount.value = brickworkAmount.value
}
@ -672,8 +671,9 @@ const handleInput = (e) => {
const rechargeDecrease = async () => {
if(brickworkAmount.value == 1) return false
brickworkAmount.value--
priceAmount.value--
if(confirmRecharge.value.goods_id == 1001) {
priceAmount.value = brickworkAmount.value
// priceAmount.value--
if(confirmRecharge.value.goods_id == 1006) {
toRaw(confirmRecharge.value).price = brickworkAmount.value
toRaw(confirmRecharge.value).diamond = brickworkAmount.value*100
}
@ -681,7 +681,8 @@ const rechargeDecrease = async () => {
const rechargeIncrease = async () => {
if(brickworkAmount.value == toRaw(confirmRecharge.value).max_buy_times) return false
brickworkAmount.value++
priceAmount.value++
priceAmount.value = brickworkAmount.value
// priceAmount.value++
if(confirmRecharge.value.goods_id == 1006) {
toRaw(confirmRecharge.value).price = brickworkAmount.value
toRaw(confirmRecharge.value).diamond = brickworkAmount.value*100
@ -690,7 +691,6 @@ const rechargeIncrease = async () => {
//
const conformBtn = async () => {
// console.log(toRaw(confirmRecharge.value))
// return
// if(localWalletStore.walletType == 3) {
let address = localWalletStore.address
@ -700,9 +700,10 @@ const conformBtn = async () => {
loadingDialogVisible.value = true
// getGameLog()
// return
let goods_num = Number(toRaw(confirmRecharge.value).goods_id) == 1006 ? Number(brickworkAmount.value) : 1
try {
const bc = new BlockChain()
let res = await bc.mall.execBuyItem(Number(toRaw(confirmRecharge.value).goods_id), Number(brickworkAmount.value),toRaw(confirmRecharge.value).currency_list[0].address)
let res = await bc.mall.execBuyItem(Number(toRaw(confirmRecharge.value).goods_id), goods_num,toRaw(confirmRecharge.value).currency_list[0].address)
// console.log(res)
if(res) {
brickworkAmount.value = 1
@ -2193,6 +2194,7 @@ onMounted(() => {
div {
width: 36px;
height: 28px;
margin-right: 10px;
img {
width: 100%;
height: 100%;
@ -2202,25 +2204,37 @@ onMounted(() => {
.item-amount-input {
width: 222px;
height: 42px;
padding: 0 20px;
display: flex;
align-items: center;
justify-content: space-evenly;
justify-content: space-between;
margin: 0 auto;
background: #1E1B26;
border-radius: 21px;
position: relative;
input {
color: #fff;
width: 100px;
width: 90px;
height: 42px;
border: 0px;
text-align: center;
font-size: 28px;
margin-right: 35px;
}
input[type=number] {
-moz-appearance:textfield;
}
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
h4 {
position: absolute;
top: 50%;
right: 50px;
transform: translateY(-50%);
right: -43px;
// right: -43px;
font-size: 20px;
}
}

View File

@ -78,7 +78,7 @@ const routes = [
name: "CecActivityView",
component: CecActivityView,
meta: {
title: "CecActivityView",
title: "Counter Fire-CecActivity",
canonical: "https://.counterfire.games",
},
},

View File

@ -15,15 +15,16 @@
</div>
</div>
<div class="right">
<div class="wallet">
<span
v-if="localWalletStore.address == null || localWalletStore.address == ''"
@click="getLinkWallet"
>Connect Wallet</span>
<div class="wallet" v-if="localWalletStore.address == null || localWalletStore.address == ''" @click="getLinkWallet">
<span>Connect Wallet</span>
<div class="wallet-btn">
<img class="hover-show" src="@/assets/img/cec_activity/ConnectMenu1.png" alt />
<img class="hover-none" src="@/assets/img/cec_activity/ConnectMenu2.png" alt />
</div>
</div>
<div class="wallet" v-else @click="isLogout = !isLogout">
<div
class="wallet-address"
@click="isLogout = !isLogout"
v-else
>{{ localWalletStore.showAddress }}</div>
<div class="wallet-btn">
<img class="hover-show" src="@/assets/img/cec_activity/ConnectMenu1.png" alt />
@ -37,7 +38,7 @@
<div class="mint-body">
<div class="mint-body-left">
<div class="mint-body-left-title">
<h2>$CEC Bounty Hunt</h2>
<h2>Contribution Clash</h2>
<div class="tips">
<div class="tips-icon">
<img src="@/assets/img/cec_activity/event_help.png" alt />
@ -58,7 +59,7 @@
<div>
<img src="@/assets/img/marketplace/totalContribution.png" alt />
</div>
<h6>{{ marketplaceStore.contributionPoint }}</h6>
<h6>{{ cecInfo.my_contribution }}</h6>
</li>
</div>
<div class="mint-body-left-my-pro">
@ -90,7 +91,7 @@
<div class="my-amount">
<li>
<div>Your Credits</div>
<span>{{ marketplaceStore.contributionPoint }}</span>
<span>{{ cecInfo.my_contribution }}</span>
</li>
<div class="line"></div>
<li>
@ -99,7 +100,8 @@
</li>
</div>
</div>
<div class="right" :style="{width: `${totalWidth}%`}"></div>
<div class="right" v-if="totalWidth != 100" :style="{width: `${totalWidth}%`}"></div>
<div class="total-right" v-else :style="{width: `${totalWidth}%`}"></div>
</div>
<div class="total">
<li>
@ -165,17 +167,21 @@ const router = useRouter();
const totalCecPool = ref(0)
const cecInfo = ref({
my_contribution: '',
global_contribution: '',
total_cec_pool: '',
my_expected_cec: ''
my_contribution: '-',
global_contribution: '-',
total_cec_pool: 500000,
my_expected_cec: '-'
})
const myWidth = computed(() => {
let str = (Number(cecInfo.value.my_contribution) / Number(cecInfo.value.global_contribution)) * 100
// let str = cecInfo.value.total_cec_pool
if(!localWalletStore.token) {
str = 0
} else {
if(str < 10) return 10
}
return str
})
@ -186,11 +192,13 @@ const totalWidth = computed(() => {
//
const getCecActivity = async () => {
if(localWalletStore.token) {
const { errcode, errmsg, contributionPoint, info } = await apiCecActivity(localWalletStore.address)
if(errcode != 0) return
totalCecPool.value = contributionPoint
cecInfo.value = info
}
}
//
@ -228,22 +236,23 @@ const downloadGame = (platform) => {
}
};
// const loginDiscord = () => {
// const _address = localWalletStore.address;
// const codeChallenge = Date.now();
// const state = btoa(`${_address}|${codeChallenge}`);
// // const url = 'https://discord.com/api/oauth2/authorize?client_id=1116692240224501850&redirect_uri=http%3A%2F%2Flocalhost%3A3010%2Fdiscord%2Fredirect_uri&response_type=code&scope=guilds%20identify%20guilds.members.read'
// const url = `https://discord.com/api/oauth2/authorize?client_id=1117759635269636096&redirect_uri=https%3A%2F%2Foauth-svr.cebggame.com%2Fdiscord%2Fredirect_uri&response_type=code&scope=guilds%20identify%20guilds.members.read&state=${state}`;
// // location.href = url
// // // Redirect the user to the Discord OAuth2 authorization page
// let params = `scrollbars=yes,resizable=yes,status=no,location=no,toolbar=no,menubar=no,width=600,height=800,left=100,top=100`;
// let newwin = window.open(url, "discord login", params);
// var timer = setInterval(function() {
// if (newwin.closed) {
// clearInterval(timer);
// }
// }, 10);
// };
const loginDiscord = () => {
const _address = localWalletStore.address;
const codeChallenge = Date.now();
const state = btoa(`${_address}|${codeChallenge}`);
// const url = 'https://discord.com/api/oauth2/authorize?client_id=1116692240224501850&redirect_uri=http%3A%2F%2Flocalhost%3A3010%2Fdiscord%2Fredirect_uri&response_type=code&scope=guilds%20identify%20guilds.members.read'
const url = `https://discord.com/api/oauth2/authorize?client_id=1117759635269636096&redirect_uri=https%3A%2F%2Foauth-svr.cebggame.com%2Fdiscord%2Fredirect_uri&response_type=code&scope=guilds%20identify%20guilds.members.read&state=${state}`;
// location.href = url
// // Redirect the user to the Discord OAuth2 authorization page
let params = `scrollbars=yes,resizable=yes,status=no,location=no,toolbar=no,menubar=no,width=600,height=800,left=100,top=100`;
let newwin = window.open(url, "discord login", params);
console.log(newwin)
var timer = setInterval(function() {
if (newwin.closed) {
clearInterval(timer);
}
}, 10);
};
//
const toTwitter = () => {
@ -714,6 +723,10 @@ onMounted(() => {
background: linear-gradient(180deg, #8929ff, #e362ff);
border-radius: 0 20px 20px 0;
}
.total-right {
background: linear-gradient(180deg, #8929ff, #e362ff);
border-radius: 20px;
}
}
.total {
position: absolute;