xiongzhu 2 gadi atpakaļ
vecāks
revīzija
8e423923e5
1 mainītis faili ar 10 papildinājumiem un 8 dzēšanām
  1. 10 8
      src/views/HomeView.vue

+ 10 - 8
src/views/HomeView.vue

@@ -9,8 +9,8 @@
                     </ElIcon>
                     </ElIcon>
                     zkSync Era
                     zkSync Era
                     <ElInput class="ml-2 !w-20" v-model="depositAmount" />
                     <ElInput class="ml-2 !w-20" v-model="depositAmount" />
-                    <ElButton type="primary" class="ml-2" @click="zkDeposit" :loading="depositing">官方</ElButton>
-                    <ElButton type="primary" class="ml-2" :loading="depositing">Orbiter</ElButton>
+                    <ElButton type="primary" class="ml-2" @click="deposit(0)" :loading="depositing">官方</ElButton>
+                    <ElButton type="primary" class="ml-2" @click="deposit(1)" :loading="depositing">Orbiter</ElButton>
                 </div>
                 </div>
 
 
                 <div class="flex items-center mt-4">
                 <div class="flex items-center mt-4">
@@ -20,8 +20,10 @@
                     </ElIcon>
                     </ElIcon>
                     Mainnet
                     Mainnet
                     <ElInput class="ml-2 !w-20" v-model="widthdrawAmount" />
                     <ElInput class="ml-2 !w-20" v-model="widthdrawAmount" />
-                    <ElButton type="primary" class="ml-2" @click="zkWidthdraw" :loading="widthdrawing">官方</ElButton>
-                    <ElButton type="primary" class="ml-2" :loading="widthdrawing">Orbiter</ElButton>
+                    <ElButton type="primary" class="ml-2" @click="widthdraw(0)" :loading="widthdrawing">官方</ElButton>
+                    <ElButton type="primary" class="ml-2" @click="widthdraw(1)" :loading="widthdrawing">
+                        Orbiter
+                    </ElButton>
                 </div>
                 </div>
                 <div class="flex items-center mt-4">
                 <div class="flex items-center mt-4">
                     ETH
                     ETH
@@ -228,7 +230,7 @@ const depositAmount = ref('')
 const widthdrawAmount = ref('')
 const widthdrawAmount = ref('')
 const depositing = ref(false)
 const depositing = ref(false)
 const widthdrawing = ref(false)
 const widthdrawing = ref(false)
-async function zkDeposit() {
+async function deposit(type) {
     if (table.value.getSelectionRows().length === 0) {
     if (table.value.getSelectionRows().length === 0) {
         ElMessage.error('请选择账号')
         ElMessage.error('请选择账号')
         return
         return
@@ -240,7 +242,7 @@ async function zkDeposit() {
     depositing.value = true
     depositing.value = true
     try {
     try {
         console.log(table.value.getSelectionRows())
         console.log(table.value.getSelectionRows())
-        await http.post('/web3/zk-deposit', {
+        await http.post(type === 0 ? '/web3/zk-deposit' : '/web3/orbiter-deposit', {
             amount: depositAmount.value,
             amount: depositAmount.value,
             accountId: table.value.getSelectionRows()[0].id,
             accountId: table.value.getSelectionRows()[0].id,
             network: network.value
             network: network.value
@@ -252,7 +254,7 @@ async function zkDeposit() {
         ElMessage.error(error.message)
         ElMessage.error(error.message)
     }
     }
 }
 }
-async function zkWidthdraw() {
+async function widthdraw(type) {
     if (table.value.getSelectionRows().length === 0) {
     if (table.value.getSelectionRows().length === 0) {
         ElMessage.error('请选择账号')
         ElMessage.error('请选择账号')
         return
         return
@@ -264,7 +266,7 @@ async function zkWidthdraw() {
     widthdrawing.value = true
     widthdrawing.value = true
     try {
     try {
         console.log(table.value.getSelectionRows())
         console.log(table.value.getSelectionRows())
-        await http.post('/web3/zk-withdraw', {
+        await http.post(type === 0 ? '/web3/zk-withdraw' : '/web3/orbiter-withdraw', {
             amount: widthdrawAmount.value,
             amount: widthdrawAmount.value,
             accountId: table.value.getSelectionRows()[0].id,
             accountId: table.value.getSelectionRows()[0].id,
             network: network.value
             network: network.value