This commit is contained in:
huangjinming 2023-06-28 14:40:40 +08:00
parent ee652db9be
commit 4cb9067683
12 changed files with 6853 additions and 611 deletions

View File

@ -10,6 +10,15 @@
property="og:description" property="og:description"
content="CounterFire.games | Gacha is blinking! Quest and Rewards.Join Counter Fire and Rise of Gacha. Get your gacha and rewards. A new evolution about Web3Gaming." content="CounterFire.games | Gacha is blinking! Quest and Rewards.Join Counter Fire and Rise of Gacha. Get your gacha and rewards. A new evolution about Web3Gaming."
/> />
<meta
name="description"
content="CounterFire.games | Gacha is blinking! Quest and Rewards.Join Counter Fire and Rise of Gacha. Get your gacha and rewards. A new evolution about Web3Gaming."
/>
<meta
name="keywords"
content="CounterFireCFGamefiWeb3web3gaming; Cf game;Cf mobile; CounterFire googleplay; CounterFire Appstore;
battle royale;token;airdrop;p2e; play to earn, free to play, blockchain game;Arbitrum game;Arbitrum. Cryptocurrency; Cryptoanime gameanime web3 gameTwo-dimensional gameshooting gameAnime shooting mobile game"
/>
<meta property="og:type" content="website" /> <meta property="og:type" content="website" />
<meta property="og:url" content="https://www.counterfire.games/" /> <meta property="og:url" content="https://www.counterfire.games/" />
<meta <meta
@ -31,5 +40,19 @@
<body> <body>
<div id="app"></div> <div id="app"></div>
<script type="module" src="/src/main.js"></script> <script type="module" src="/src/main.js"></script>
<!-- Google tag (gtag.js) -->
<script
async
src="https://www.googletagmanager.com/gtag/js?id=G-9WFW3HQTR8"
></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());
gtag("config", "G-9WFW3HQTR8");
</script>
</body> </body>
</html> </html>

5665
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,6 @@
"name": "my-vue-app", "name": "my-vue-app",
"private": true, "private": true,
"version": "0.0.0", "version": "0.0.0",
"type": "module",
"scripts": { "scripts": {
"dev": "vite --host --mode dev", "dev": "vite --host --mode dev",
"build:dev": "vite build --mode dev", "build:dev": "vite build --mode dev",
@ -26,6 +25,7 @@
"normalize.css": "^8.0.1", "normalize.css": "^8.0.1",
"pinia": "^2.0.30", "pinia": "^2.0.30",
"postcss-px-to-viewport": "^1.1.1", "postcss-px-to-viewport": "^1.1.1",
"prerender-spa-plugin-next": "^4.2.3",
"process": "^0.11.10", "process": "^0.11.10",
"rollup-plugin-polyfill-node": "^0.12.0", "rollup-plugin-polyfill-node": "^0.12.0",
"stream-browserify": "^3.0.0", "stream-browserify": "^3.0.0",
@ -34,6 +34,9 @@
"uuid": "^9.0.0", "uuid": "^9.0.0",
"video.js": "^8.0.4", "video.js": "^8.0.4",
"videojs-flash": "^2.2.1", "videojs-flash": "^2.2.1",
"vite-plugin-pages": "^0.31.0",
"vite-plugin-ssr": "^0.4.132",
"vite-ssg": "^0.22.2",
"vue": "^3.2.45", "vue": "^3.2.45",
"vue-3d-loader": "^2.1.5", "vue-3d-loader": "^2.1.5",
"vue-router": "^4.1.6", "vue-router": "^4.1.6",

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 KiB

BIN
src/assets/img/task/bg.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

View File

@ -327,7 +327,14 @@ import {
} from "@/api/User"; } from "@/api/User";
import { useChainStore } from "@/store/chain"; import { useChainStore } from "@/store/chain";
import { useAppStore } from "@/store/app"; import { useAppStore } from "@/store/app";
import { ref, onMounted, watch, reactive, inject } from "vue"; import {
ref,
onMounted,
watch,
reactive,
inject,
getCurrentInstance,
} from "vue";
import { v4 as uuidv4 } from "uuid"; import { v4 as uuidv4 } from "uuid";
import { hasMetamask } from "@/utils/chain.util"; import { hasMetamask } from "@/utils/chain.util";
import { message, notification } from "ant-design-vue"; import { message, notification } from "ant-design-vue";
@ -375,6 +382,15 @@ async function login(event) {
} }
} }
} }
const assign = (source, target) => {
if (target === undefined || target === null) {
throw new TypeError("Cannot convert undefined or null to object");
}
for (let key in target) {
source[key] = target[key];
}
};
const updateLogin = async () => { const updateLogin = async () => {
currentTask.value = 2; currentTask.value = 2;
}; };
@ -427,7 +443,7 @@ const checkUserStatus = async () => {
// console.log("Success! UserStatus successfully obtained."); // console.log("Success! UserStatus successfully obtained.");
const resu = await UserInfo({ account: AppModule.accountId }); const resu = await UserInfo({ account: AppModule.accountId });
if (resu) { if (resu) {
Object.assign(userInfo, resu); assign(userInfo, resu);
const formatAddress = (address) => { const formatAddress = (address) => {
if (address.length >= 15) { if (address.length >= 15) {
return ( return (
@ -493,7 +509,7 @@ const handDiscode = async () => {
// console.log("Success! UserStatus successfully obtained."); // console.log("Success! UserStatus successfully obtained.");
const resu = await UserInfo({ account: AppModule.accountId }); const resu = await UserInfo({ account: AppModule.accountId });
if (resu) { if (resu) {
Object.assign(userInfo, resu); assign(userInfo, resu);
const formatAddress = (address) => { const formatAddress = (address) => {
if (address.length >= 15) { if (address.length >= 15) {
return ( return (
@ -632,7 +648,7 @@ const checkUserStatustw = async () => {
// console.log("Success! UserStatus successfully obtained."); // console.log("Success! UserStatus successfully obtained.");
const resu = await UserInfo({ account: AppModule.accountId }); const resu = await UserInfo({ account: AppModule.accountId });
if (resu) { if (resu) {
Object.assign(userInfo, resu); assign(userInfo, resu);
const formatAddress = (address) => { const formatAddress = (address) => {
if (address.length >= 15) { if (address.length >= 15) {
return ( return (
@ -702,7 +718,7 @@ const handTwitter = async () => {
const resu = await UserInfo({ account: AppModule.accountId }); const resu = await UserInfo({ account: AppModule.accountId });
if (resu) { if (resu) {
// userInfo.value = resq // userInfo.value = resq
Object.assign(userInfo, resu); assign(userInfo, resu);
console.log(userInfo.twitter, "-=-=-userInfo.twitter"); console.log(userInfo.twitter, "-=-=-userInfo.twitter");
const formatAddress = (address) => { const formatAddress = (address) => {
if (address.length >= 15) { if (address.length >= 15) {
@ -784,7 +800,7 @@ const handQuote = () => {
"Adorable! join with me in @_CounterFire,Bring Gacha home with you \nShe will unveil even more rewards as she bursts out of her shell.\n#CounterFire Now available on Google Play,A new evolution about #Web3Gaming"; "Adorable! join with me in @_CounterFire,Bring Gacha home with you \nShe will unveil even more rewards as she bursts out of her shell.\n#CounterFire Now available on Google Play,A new evolution about #Web3Gaming";
const url = `https://twitter.com/intent/tweet?text=${encodeURIComponent( const url = `https://twitter.com/intent/tweet?text=${encodeURIComponent(
text text
)}&url=https://counterfire.games/?code=${code}`; )}&url=https://www.counterfire.games/?code=${code}`;
window.open(url, "_blank", "width=500,height=600"); window.open(url, "_blank", "width=500,height=600");
}; };
@ -799,36 +815,19 @@ const handQuoteVerification = createDebouncedFunction(async () => {
if (resq && resq.status[5] == 1) { if (resq && resq.status[5] == 1) {
isQuote.value = true; isQuote.value = true;
quoteLoading.value = false; quoteLoading.value = false;
// isClaim.value = true;
const resjoin = await getJoin({ const resjoin = await getJoin({
account: AppModule.accountId, account: AppModule.accountId,
invite_code: route.query.code, invite_code: route.query.code,
}); });
console.log(route.query.code, "invite code2"); if (resq && (!resq.claim || Number(resq.claim) == 0) && resq.status.every((status) => status == 1)) {
if (resjoin.errcode == 0) {
// addNotification("successful");
}
const balance = await chain.chainManager.bc.getBalances(
AppModule.accountId
);
if (balance) {
isBalance.value = balance;
}
if (
resq &&
balance == 0 &&
resq.status.every((status) => status == 1)
) {
isClaim.value = true; isClaim.value = true;
isBalance.value = Number(resq.claim);
} else { } else {
isClaim.value = false; isClaim.value = false;
isBalance.value = Number(resq.claim);
} }
let resqd = await Claim({
account: AppModule.accountId,
claim: balance,
});
} }
// console.log(route.query.code, "invite code1"); // console.log(route.query.code, "invite code1");
} }
@ -850,8 +849,7 @@ const handClaim = async () => {
isTwitter.value && isTwitter.value &&
isFollowCEBG.value && isFollowCEBG.value &&
isQuote.value && isQuote.value &&
chain.logined && chain.logined
isBalance.value == 0
) { ) {
claimLoading.value = true; claimLoading.value = true;
try { try {
@ -888,12 +886,6 @@ const handClaim = async () => {
isClaim.value = false; isClaim.value = false;
isBalance.value = 1; isBalance.value = 1;
claimLoading.value = false; claimLoading.value = false;
const balance = await chain.chainManager.bc.getBalances(
AppModule.accountId
);
if (balance) {
isBalance.value = 1;
}
} }
if (resq.errcode !== 0) { if (resq.errcode !== 0) {
claimLoading.value = false; claimLoading.value = false;
@ -921,7 +913,9 @@ watch(
if (chain.logined == true) { if (chain.logined == true) {
currentTask.value = 2; currentTask.value = 2;
} }
const resq = await UserStatus({ account: AppModule.accountId }); const resq = await UserStatus({
account: AppModule.accountId,invite_code: route.query.code
});
if (resq) { if (resq) {
if (chain.logined == true) { if (chain.logined == true) {
currentTask.value = 2; currentTask.value = 2;
@ -945,26 +939,13 @@ watch(
if (resq && resq.status[5] == 1) { if (resq && resq.status[5] == 1) {
isQuote.value = true; isQuote.value = true;
} }
if (newValue == true) {
const balance = await chain.chainManager.bc.getBalances( if (resq && (!resq.claim || Number(resq.claim) == 0) && resq.status.every((status) => status == 1)) {
AppModule.accountId isClaim.value = true;
); isBalance.value = Number(resq.claim);
if (balance) { } else {
isBalance.value = balance; isClaim.value = false;
} isBalance.value = Number(resq.claim);
if (
resq &&
balance == 0 &&
resq.status.every((status) => status == 1)
) {
isClaim.value = true;
} else {
isClaim.value = false;
}
let resqd = await Claim({
account: AppModule.accountId,
claim: balance,
});
} }
} }
// if(resq.errcode !== 0){ // if(resq.errcode !== 0){
@ -990,7 +971,7 @@ watch(
if (resu) { if (resu) {
// userInfo.value = resq // userInfo.value = resq
Object.assign(userInfo, resu); assign(userInfo, resu);
console.log(userInfo.twitter, "-=-=-userInfo.twitter"); console.log(userInfo.twitter, "-=-=-userInfo.twitter");
const formatAddress = (address) => { const formatAddress = (address) => {
if (address.length >= 15) { if (address.length >= 15) {
@ -1031,12 +1012,10 @@ onMounted(async () => {
currentTask.value = 2; currentTask.value = 2;
} }
const resq = await UserStatus({ account: AppModule.accountId }); const resq = await UserStatus({
if (JSON.stringify(lastResq.value) === JSON.stringify(resq)) { account: AppModule.accountId,invite_code: route.query.code,
return; });
}
//lastResq.value = JSON.parse(JSON.stringify(resq));
lastResq.value = JSON.parse(JSON.stringify(resq));
if (resq) { if (resq) {
if (chain.logined == true) { if (chain.logined == true) {
currentTask.value = 2; currentTask.value = 2;
@ -1061,16 +1040,12 @@ onMounted(async () => {
isQuote.value = true; isQuote.value = true;
} }
const balance = await chain.chainManager.bc.getBalances( if (resq && (!resq.claim || Number(resq.claim) == 0) && resq.status.every((status) => status == 1)) {
AppModule.accountId
);
if (balance) {
isBalance.value = balance;
}
if (resq && balance == 0 && resq.status.every((status) => status == 1)) {
isClaim.value = true; isClaim.value = true;
isBalance.value = Number(resq.claim);
} else { } else {
isClaim.value = false; isClaim.value = false;
isBalance.value = Number(resq.claim);
} }
if (resq && resq.status.every((status) => status == 1)) { if (resq && resq.status.every((status) => status == 1)) {
const res = await getJoin({ const res = await getJoin({
@ -1083,7 +1058,7 @@ onMounted(async () => {
if (resu) { if (resu) {
// userInfo.value = resq // userInfo.value = resq
Object.assign(userInfo, resu); assign(userInfo, resu);
const formatAddress = (address) => { const formatAddress = (address) => {
if (address.length >= 15) { if (address.length >= 15) {
return ( return (

View File

@ -292,6 +292,16 @@ const formattedData = computed(() => {
const typesInRegular = computed(() => const typesInRegular = computed(() =>
userInfo.regular.map((item) => item.type).join("<br/>") userInfo.regular.map((item) => item.type).join("<br/>")
); );
const assign = (source, target)=>{
if (target === undefined || target === null) {
throw new TypeError('Cannot convert undefined or null to object')
}
for (let key in target) {
source[key] = target[key]
}
}
const totalRegularPoints = computed(() => const totalRegularPoints = computed(() =>
userInfo.regular.reduce((total, item) => total + item.point, 0) userInfo.regular.reduce((total, item) => total + item.point, 0)
); );
@ -328,7 +338,7 @@ const handleCopy = () => {
watch( watch(
() => chain.logined, () => chain.logined,
async (newValue, oldValue) => { async (newValue, oldValue) => {
console.log("logined changed from", oldValue, "to", newValue); // console.log("logined changed from", oldValue, "to", newValue);
const res = await getLeaderboard({ offset: 0, limit: 100 }); const res = await getLeaderboard({ offset: 0, limit: 100 });
console.log(res); console.log(res);
if (res) { if (res) {
@ -342,7 +352,8 @@ watch(
console.log(data.value, "ff"); console.log(data.value, "ff");
} }
const userStatus = await UserStatus({ account: AppModule.accountId }); const userStatus = await UserStatus({ account: AppModule.accountId });
if (userStatus && userStatus.status.every((status) => status == 1)) {
if ( userStatus && userStatus.claim && Number(userStatus.claim) !== 0 && userStatus.status.every((status) => status == 1)) {
isStatus.value = true; isStatus.value = true;
const resjoin = await getJoin({ const resjoin = await getJoin({
account: AppModule.accountId, account: AppModule.accountId,
@ -353,7 +364,7 @@ watch(
if (resq) { if (resq) {
// userInfo.value = resq // userInfo.value = resq
Object.assign(userInfo, resq); assign(userInfo, resq);
inviteLink.value = `${import.meta.env.VUE_APP_GPAL_API}/?code=${ inviteLink.value = `${import.meta.env.VUE_APP_GPAL_API}/?code=${
userInfo.invite_code userInfo.invite_code
}`; }`;
@ -376,14 +387,14 @@ onMounted(async () => {
console.log(data.value, "ff"); console.log(data.value, "ff");
} }
const resStatus = await UserStatus({ account: AppModule.accountId }); const resStatus = await UserStatus({ account: AppModule.accountId });
if (resStatus && resStatus.status.every((status) => status == 1)) { if ( resStatus && resStatus.claim && Number(resStatus.claim) !== 0 && resStatus.status.every((status) => status == 1)) {
isStatus.value = true; isStatus.value = true;
} }
const resq = await UserInfo({ account: AppModule.accountId }); const resq = await UserInfo({ account: AppModule.accountId });
if (resq) { if (resq) {
// userInfo.value = resq // userInfo.value = resq
Object.assign(userInfo, resq); assign(userInfo, resq);
inviteLink.value = `${import.meta.env.VUE_APP_GPAL_API}/?code=${ inviteLink.value = `${import.meta.env.VUE_APP_GPAL_API}/?code=${
userInfo.invite_code userInfo.invite_code
}`; }`;

View File

@ -23,6 +23,9 @@ notification.config({
rtl: true, rtl: true,
}); });
const app = createApp(App); const app = createApp(App);
app.config.globalProperties.$log = console.log.bind(console);
app app
.use(pinia) .use(pinia)
.use(VueClipboard) .use(VueClipboard)

View File

@ -3,6 +3,8 @@ import { message } from 'ant-design-vue'
import glodata from '@/store/user_global'; import glodata from '@/store/user_global';
// console.log(import.meta.env);
const service = axios.create({ const service = axios.create({
baseURL: import.meta.env.VUE_APP_BASE_API2, baseURL: import.meta.env.VUE_APP_BASE_API2,
timeout: 10000 timeout: 10000
@ -11,7 +13,22 @@ const service = axios.create({
// Request interceptors // Request interceptors
service.interceptors.request.use( service.interceptors.request.use(
(config) => { (config) => {
// Removed the token handling // Add X-Access-Token header to every request, you can add other custom headers here
if (glodata.token) {
if (config.url) {
if (config.url.indexOf('?') > 0) {
config.url += `&token=${glodata.token}`
} else {
config.url += `?token=${glodata.token}`
}
if (config.url.indexOf('account=') < 0 && glodata.accountId) {
config.url += `&account=${glodata.accountId}`
}
if (config.url.indexOf('net_id=') < 0 && glodata.chainId) {
config.url += `&net_id=${glodata.chainId}`
}
}
}
config.headers['Content-Type'] = 'application/json' config.headers['Content-Type'] = 'application/json'
return config return config
}, },
@ -23,17 +40,18 @@ service.interceptors.request.use(
// Response interceptors // Response interceptors
service.interceptors.response.use( service.interceptors.response.use(
(response) => { (response) => {
// Some example codes here:
// code == 0: success
// code == 10: username or password is incorrect
// You can change this part for your own usage.
const res = response.data const res = response.data
if (res.errcode) { if (res.errcode) {
// Uncomment this block if you want to show an error message // Message({
/* // message: res.errmsg || 'Error',
Message({ // type: 'error',
message: res.errmsg || 'Error', // duration: 5 * 1000
type: 'error', // })
duration: 5 * 1000 // return Promise.reject(new Error(res.errmsg || 'Error'))
})
*/
// return Promise.reject(new Error(res.errmsg || 'Error'))
} else { } else {
return response.data return response.data
} }

View File

@ -54,7 +54,7 @@
</div> </div>
</div> </div>
<div class="bg"> <div class="bg">
<img src="@/assets/img/task/bg.png" alt="" /> <img src="@/assets/img/task/bg.jpg" alt="" />
</div> </div>
</div> </div>
</template> </template>

View File

@ -3,6 +3,7 @@ import vue from "@vitejs/plugin-vue";
// import requireTransform from "vite-plugin-require-transform"; // import requireTransform from "vite-plugin-require-transform";
// 如果编辑器提示 path 模块找不到,则可以安装一下 @types/node -> npm i @types/node -D // 如果编辑器提示 path 模块找不到,则可以安装一下 @types/node -> npm i @types/node -D
import { resolve } from "path"; import { resolve } from "path";
import prerender from 'vite-plugin-prerender'
import nodePolyfills from 'rollup-plugin-polyfill-node'; import nodePolyfills from 'rollup-plugin-polyfill-node';
// https://vitejs.dev/config/ // https://vitejs.dev/config/

1589
yarn.lock

File diff suppressed because it is too large Load Diff