nft 合作发布
This commit is contained in:
parent
0524ae5df5
commit
ddc04eed65
9
package-lock.json
generated
9
package-lock.json
generated
@ -20,6 +20,7 @@
|
||||
"postcss-px-to-viewport": "^1.1.1",
|
||||
"swiper": "^5.4.5",
|
||||
"vue": "^2.6.14",
|
||||
"vue-gtag": "^1.16.1",
|
||||
"vue-loader": "^15.10.1",
|
||||
"vue-router": "^3.5.1",
|
||||
"vuex": "^3.6.2",
|
||||
@ -12992,6 +12993,14 @@
|
||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/vue-gtag": {
|
||||
"version": "1.16.1",
|
||||
"resolved": "https://registry.npmmirror.com/vue-gtag/-/vue-gtag-1.16.1.tgz",
|
||||
"integrity": "sha512-5vs0pSGxdqrfXqN1Qwt0ZFXG0iTYjRMu/saddc7QIC5yp+DKgjWQRpGYVa7Pq+KbThxwzzMfo0sGi7ISa6NowA==",
|
||||
"peerDependencies": {
|
||||
"vue": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/vue-hot-reload-api": {
|
||||
"version": "2.3.4",
|
||||
"resolved": "https://registry.npmmirror.com/vue-hot-reload-api/-/vue-hot-reload-api-2.3.4.tgz",
|
||||
|
@ -25,6 +25,7 @@
|
||||
"vue-loader": "^15.10.1",
|
||||
"vue-router": "^3.5.1",
|
||||
"vuex": "^3.6.2",
|
||||
"vue-gtag": "^1.16.1",
|
||||
"web3": "^4.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
BIN
src/assets/username/Azuki.jpg
Normal file
BIN
src/assets/username/Azuki.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.3 KiB |
BIN
src/assets/username/Forge.jpg
Normal file
BIN
src/assets/username/Forge.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
BIN
src/assets/username/Game Theory.jpg
Normal file
BIN
src/assets/username/Game Theory.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
BIN
src/assets/username/My Pet Hooligan.jpg
Normal file
BIN
src/assets/username/My Pet Hooligan.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
BIN
src/assets/username/Pudgy Penguins.jpg
Normal file
BIN
src/assets/username/Pudgy Penguins.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
src/assets/username/Xociety.jpg
Normal file
BIN
src/assets/username/Xociety.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 238 KiB |
@ -35,6 +35,8 @@ export default {
|
||||
if (data.status === 2) {
|
||||
this.$emit('stateupdate', data.status);
|
||||
return;
|
||||
// } else if(data.status === 1) {
|
||||
// this.$showErr('Please try again')
|
||||
}
|
||||
this.beginCountdown();
|
||||
|
||||
@ -47,6 +49,7 @@ export default {
|
||||
let timer = setInterval(() => {
|
||||
this.timeLeft--;
|
||||
if (this.timeLeft <= 0) {
|
||||
this.$showErr('Please try again')
|
||||
clearInterval(timer);
|
||||
}
|
||||
}, 1000);
|
||||
|
@ -74,7 +74,7 @@ export default {
|
||||
localStorage.setItem('walletName',val)
|
||||
localStorage.setItem('myAddress',res)
|
||||
this.myAddress = res
|
||||
await this.getWalletConnected()
|
||||
await this.getWalletConnected(val)
|
||||
},
|
||||
async disconnect() {
|
||||
let walletName = localStorage.getItem('walletName')
|
||||
@ -85,9 +85,13 @@ export default {
|
||||
},
|
||||
|
||||
// 登录
|
||||
async getWalletConnected() {
|
||||
await this.$store.dispatch('user/login', this.activity)
|
||||
async getWalletConnected(val) {
|
||||
let require = {activity: this.activity, val}
|
||||
await this.$store.dispatch('user/login', require)
|
||||
await this.$store.dispatch('user/fetchUserState')
|
||||
this.$gtag.event("login_info", {
|
||||
address_type: this.myAddress,
|
||||
})
|
||||
location.reload()
|
||||
},
|
||||
|
||||
|
@ -7,6 +7,7 @@ import ElementUI from 'element-ui'
|
||||
import 'element-ui/lib/theme-chalk/index.css'
|
||||
import moment from 'moment'
|
||||
import axios from 'axios'
|
||||
import VueGtag from "vue-gtag";
|
||||
import iErrorMsg from './components/errorDialog/index.js'
|
||||
Vue.prototype.$axios = axios
|
||||
|
||||
@ -22,6 +23,10 @@ Vue.filter('formatDate', function (value) {
|
||||
return moment(value).format('YYYY-MM-DD HH:mm:ss')
|
||||
})
|
||||
|
||||
Vue.use(VueGtag, {
|
||||
config: { id: "G-4KSHDJ3MGL" }
|
||||
}, router);
|
||||
|
||||
// Vue.config.errorHandler = function(err, vm, info){
|
||||
// //todo: show error message
|
||||
// console.error('[vue error handler|error]: ', err)
|
||||
|
@ -24,8 +24,8 @@ const actions = {
|
||||
commit('updateToken', token)
|
||||
commit('updateLoginStatus', true)
|
||||
},
|
||||
async login({ state, commit}, activity) {
|
||||
let token = await new Wallet().loginWithEthereum(activity)
|
||||
async login({ state, commit}, activityList) {
|
||||
let token = await new Wallet().loginWithEthereum(activityList)
|
||||
commit('updateToken', token)
|
||||
},
|
||||
async fetchUserState({ state, commit }) {
|
||||
|
@ -914,7 +914,7 @@ export default {
|
||||
await apiCheckActivity(id);
|
||||
await this.getProgress();
|
||||
},
|
||||
async loginTwitter() {
|
||||
async loginTwitter(id) {
|
||||
// const _address = "0x8c10Ae04BF525734eaC00d5F7c062567461c207F";
|
||||
const clientId = "aG1Jdm1YX0NhSU9rYU5sM0xQeVI6MTpjaQ";
|
||||
// const codeChallenge = crypto.randomUUID()
|
||||
@ -935,7 +935,7 @@ export default {
|
||||
}
|
||||
}, 10);
|
||||
// location.href = url;
|
||||
await this.getActivitrStatue(data.id);
|
||||
await this.getActivitrStatue(id);
|
||||
},
|
||||
async loginDiscord() {
|
||||
const _address = this.$store.state.user.address;
|
||||
@ -987,6 +987,7 @@ export default {
|
||||
}
|
||||
} else {
|
||||
if (data?.status == 3) {
|
||||
console.log(data ,'这里')
|
||||
// alert(`领取成功, 获得积分: ${data.score}`)
|
||||
this.isLoading = false;
|
||||
this.activityDialog(data);
|
||||
@ -1902,6 +1903,7 @@ export default {
|
||||
.bar-no {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
color: #fbc059;
|
||||
}
|
||||
|
@ -151,7 +151,6 @@ export default {
|
||||
this.$emit('toNavIndex')
|
||||
}
|
||||
if(discordId) {
|
||||
console.log('zheli')
|
||||
try {
|
||||
let { errcode, errmsg, data } = await apiClaimNft(itemData.contract);
|
||||
if (!errcode) {
|
||||
@ -173,7 +172,6 @@ export default {
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
// this.$message.error(`claim partner reward error: ${err}`);
|
||||
}
|
||||
} else {
|
||||
@ -428,6 +426,7 @@ export default {
|
||||
padding: 5px 4px;
|
||||
border-radius: 15px;
|
||||
margin-left: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
</style>>
|
||||
|
@ -283,7 +283,7 @@ export default {
|
||||
async getLeaderBoard () {
|
||||
let res = await this.$axios.get(process.env.VUE_APP_API_URL+`/api/activity/leaderboard/uaw_activity/0`)
|
||||
this.rankingTableData = res.data.data
|
||||
console.log('rankingTableData' ,this.rankingTableData)
|
||||
// console.log('rankingTableData' ,this.rankingTableData)
|
||||
},
|
||||
// 获取用户状态
|
||||
getUserState() {
|
||||
|
@ -147,7 +147,7 @@ export class Wallet {
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
const onChainChange = (chainId) => {
|
||||
console.log('switchEthereumChain: ', chainId)
|
||||
// console.log('switchEthereumChain: ', chainId)
|
||||
this.provider.removeListener('chainChanged', onChainChange)
|
||||
resolve && resolve()
|
||||
}
|
||||
@ -156,9 +156,9 @@ export class Wallet {
|
||||
method: 'wallet_switchEthereumChain',
|
||||
params: [{ chainId: hexChainId }]
|
||||
}).then(() => {
|
||||
console.log('switch chain success')
|
||||
// console.log('switch chain success')
|
||||
}).catch(e => {
|
||||
console.log('switch chain error: ', e)
|
||||
// console.log('switch chain error: ', e)
|
||||
if (e.code === 4902 || e.message.indexOf('Unrecognized chain ID') >= 0) {
|
||||
const data = chainData
|
||||
this.provider.request({
|
||||
@ -177,7 +177,7 @@ export class Wallet {
|
||||
}
|
||||
]
|
||||
}).then(() => {
|
||||
console.log('add chain success')
|
||||
// console.log('add chain success')
|
||||
}).catch(addError => {
|
||||
console.error('add chain error: ', addError)
|
||||
this.provider.removeListener('chainChanged', onChainChange)
|
||||
@ -200,7 +200,7 @@ export class Wallet {
|
||||
subscribeToEvents(){
|
||||
// Subscribe to accounts change
|
||||
this.provider.on('accountsChanged', async (accounts) => {
|
||||
console.log('accountsChanged: ', accounts)
|
||||
// console.log('accountsChanged: ', accounts)
|
||||
if (accounts && accounts.length > 0) {
|
||||
this.address = accounts[0]
|
||||
store.commit('wallet/updateAddress', this.address)
|
||||
@ -215,13 +215,19 @@ export class Wallet {
|
||||
|
||||
// Subscribe to session disconnection
|
||||
this.provider.on('disconnect', (err) => {
|
||||
console.log('disconnect', err)
|
||||
// console.log('disconnect', err)
|
||||
store.commit('wallet/updateConnected', false)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
async loginWithEthereum(activity) {
|
||||
async loginWithEthereum(activityList) {
|
||||
let walletType
|
||||
if(activityList.val == 'ethereum') {
|
||||
walletType = 'metamask'
|
||||
} else if(activityList.val == 'okxwallet') {
|
||||
walletType = 'okx'
|
||||
}
|
||||
const web3 = new Web3(this.provider);
|
||||
let addresses = await web3.eth.getAccounts();
|
||||
let tryCount = 0;
|
||||
@ -239,7 +245,7 @@ export class Wallet {
|
||||
// console.log(chainId, "----");
|
||||
const nonce = await loginNonce(address);
|
||||
// console.log(nonce, "nonce-------------");
|
||||
const nonceStr = `${nonce}|okx`;
|
||||
const nonceStr = `${nonce}| ${walletType}`;
|
||||
const nonceEncrypt = hexToBase58(aesEncrypt(nonceStr, 'uaw_activity'));
|
||||
const message = new SiweMessage({
|
||||
domain: document.location.host,
|
||||
@ -255,14 +261,14 @@ export class Wallet {
|
||||
method: 'personal_sign',
|
||||
params: [web3.utils.utf8ToHex(msgSign), address],
|
||||
});
|
||||
let resLogin = await loginWithSignature(message, signature, activity);
|
||||
console.log(resLogin.errcode, '61');
|
||||
let resLogin = await loginWithSignature(message, signature, activityList.activity);
|
||||
// console.log(resLogin.errcode, '61');
|
||||
if (!resLogin.errcode) {
|
||||
new GlobalData().token = resLogin.data.token;
|
||||
localStorage.setItem('token', resLogin.data.token);
|
||||
setToken(resLogin.data.token);
|
||||
// console.log(resLogin.data.token);
|
||||
console.log(parseTokenData(resLogin.data.token), '------------------');
|
||||
// console.log(parseTokenData(resLogin.data.token), '------------------');
|
||||
return resLogin.data.token;
|
||||
} else {
|
||||
throw new Error(resLogin.errmsg);
|
||||
@ -275,7 +281,7 @@ export class Wallet {
|
||||
let gasPrice = await web3.eth.getGasPrice()
|
||||
gasPrice = gasPrice * 2n
|
||||
// const gasPrice = 100000000n;
|
||||
console.log('gasPrice: ',gasPrice)
|
||||
// console.log('gasPrice: ',gasPrice)
|
||||
// return
|
||||
let sendObj = {
|
||||
from: address,
|
||||
@ -284,7 +290,7 @@ export class Wallet {
|
||||
data
|
||||
}
|
||||
let gasLimit = await web3.eth.estimateGas(sendObj)
|
||||
console.log('gasLimit: ', gasLimit,sendObj)
|
||||
// console.log('gasLimit: ', gasLimit,sendObj)
|
||||
Object.assign(sendObj, {gasPrice, gasLimit})
|
||||
return web3.eth.sendTransaction(sendObj)
|
||||
}
|
||||
@ -301,7 +307,7 @@ export class Wallet {
|
||||
let web3 = this.web3;
|
||||
const instance = this.initInstance(web3, process.env.VUE_APP_CONTRACT, treasureAbi, address);
|
||||
let gasPrice = await web3.eth.getGasPrice()
|
||||
console.log('chainCheckIn gasPrice: ', gasPrice)
|
||||
// console.log('chainCheckIn gasPrice: ', gasPrice)
|
||||
gasPrice = gasPrice * 2n
|
||||
let gasLimit = await instance.methods.dailyCheckin().estimateGas();
|
||||
return instance.methods.dailyCheckin().send({ from: address, gasPrice, gasLimit });
|
||||
|
Loading…
x
Reference in New Issue
Block a user