liming 1 месяц назад
Родитель
Сommit
202d60346e

+ 4 - 11
capacitor.config.ts

@@ -6,18 +6,11 @@ const config: CapacitorConfig = {
   webDir: 'dist',
 
   // 开发服务器配置(热更新用)
-  // server: {
-  //   url: 'http://192.168.0.59:5173',
-  //   cleartext: true,          // 允许HTTP明文通信(仅开发环境)
-  //   allowNavigation: ['*']    // 允许任意URL导航
-  // },
   server: {
-    allowNavigation: [
-      "*.angeltokens.io",
-      "*.your-api.com"
-    ]
-  }
-
+    url: 'http://192.168.0.59:5173',
+    cleartext: true,          // 允许HTTP明文通信(仅开发环境)
+    allowNavigation: ['*']    // 允许任意URL导航
+  }, 
   // 插件配置
   plugins: {
     SplashScreen: {

+ 0 - 1
package.json

@@ -23,7 +23,6 @@
     "@capacitor/app": "^7.0.1",
     "@capacitor/browser": "^7.0.1",
     "@capacitor/cli": "^7.2.0",
-    "@capacitor/clipboard": "^7.0.1",
     "@capacitor/core": "^7.2.0",
     "@capacitor/device": "^7.0.1",
     "@capacitor/ios": "^7.2.0",

+ 1 - 1
src/api/axios.js

@@ -11,7 +11,7 @@ const requestCountMap = new Map(); // 用于记录请求的次数
 const isNativeApp = Capacitor.isNativePlatform();
 
 const axiosInstance = axios.create({
-  baseURL: (isNativeApp ? import.meta.env.VITE_PRO_PATH : import.meta.env.BASE_URL) + "/api", // 设置 API 基础 URL
+  baseURL: (isNativeApp ? import.meta.env.VITE_PRO_PATH : import.meta.env.VITE_DEV_PATH) + "/api", // 设置 API 基础 URL
   timeout: 300000, // 设置请求超时时间
 });
 

+ 4 - 0
src/assets/css/global.less

@@ -26,6 +26,10 @@
   }
 }
 
+.van-notify {
+  top: 64px !important;
+}
+
 
 
 .fn-head-bg(@height: 197px){

+ 2 - 2
src/hooks/use-copy.js

@@ -1,4 +1,4 @@
-import { onUnmounted } from 'vue';
+ 
 import ClipboardJS from 'clipboard';
 /**
  * 复制文本
@@ -6,7 +6,7 @@ import ClipboardJS from 'clipboard';
 export function useCopy(_class = '.im-copy-btn') {
   const clipboard = new ClipboardJS(_class);
   clipboard.on('success', (e) => {
-    $msg({type: 'success', message: '已复制到剪切板!'});
+   $msg($t("login.CopiedToClipboard"));
   });
   onUnmounted(() => {
     clipboard.destroy();

+ 1 - 0
src/i18n/zhHk/login.js

@@ -20,4 +20,5 @@ export default {
   CopyMnemonic: "複製助記詞",
 
   CopiedToClipboard: "已複製到剪貼板",
+  CopyFailed: "複製失敗",
 };

+ 4 - 1
src/plugins/storage.js

@@ -1,8 +1,11 @@
 
 import { showNotify } from 'vant';
 import { i18n } from "@/i18n";
+ 
 export function setup() {
-  window["$msg"] = showNotify 
+  window["$msg"] = (msg, type = 'warning')=>{
+    showNotify({ type:type, message: msg, background:"transparent", color:"#4765dd", top: 150})
+  } 
 
   window["$t"] = i18n.global.t;
 }

+ 1 - 2
src/views/dapp/index.vue

@@ -50,8 +50,7 @@
   </div>
 </template>
 
-<script setup>
-import { ref } from "vue";
+<script setup> 
 
 const images = [
   "https://fastly.jsdelivr.net/npm/@vant/assets/apple-1.jpeg",

+ 47 - 48
src/views/login/backupMnemonic/index.vue

@@ -1,64 +1,64 @@
 <template>
-  <div class="container">  
+  <div class="container">
     <div class="tag-container">
-      <van-tag v-for="item in walletData.words" :key="item" plain type="primary"   text-color="#4765DD">{{ item }}</van-tag>
+      <van-tag
+        v-for="item in walletData.words"
+        :key="item"
+        plain
+        type="primary"
+        text-color="#4765DD"
+        >{{ item }}</van-tag
+      >
     </div>
 
-
-
-     <div class="button-group"  >
-
-      <a class="button-group-mnemonic  a-link" @click="copyText" > {{  $t('login.CopyMnemonic')  }}</a>
+    <div class="button-group">
+      <a class="button-group-mnemonic a-link im-copy-btn" :data-clipboard-text="walletData.words">
+        {{ $t("login.CopyMnemonic") }}</a
+      >
       <van-button round block type="primary" native-type="submit" @click="next">
         {{ $t("login.BackupComplete") }}
       </van-button>
     </div>
-
   </div>
 </template>
 
-<script setup>
-import { Clipboard } from '@capacitor/clipboard';
+<script setup>  
 import { createAccent } from "@/api/path/login.api";
 import { useSystemStore } from "@/stores/modules/systemStore";
 import { useWalletAuth } from "@/composables/useWalletAuth";
 
+// 一键复制文本
+import { useCopy } from '@/hooks/use-copy.js';
+useCopy();
 
 const systemStore = useSystemStore();
-const { 
-  authState, 
-  loginWithPrivateKey, 
-  loginWithStorage, 
-  logout, 
+const {
+  authState,
+  loginWithPrivateKey,
+  loginWithStorage,
+  logout,
   hasStoredWallet,
-  getBalance
-} = useWalletAuth()
+  getBalance,
+} = useWalletAuth();
 
-const walletData = ref({})
+const walletData = ref({});
 
 const next = async () => {
- 
   // 登录
-  const data = await loginWithPrivateKey(systemStore.getWallet.privateKey.trim())
-  console.log("data=", data)
-  // 
-  const res = await getBalance()
-  console.log("res=", res)
-}
-
-
-const copyText = async () => {
-  await Clipboard.write({
-    string: walletData.value.words
-  }); 
-  $msg({type: 'success', message: $t("login.CopiedToClipboard")});
+  const data = await loginWithPrivateKey(
+    systemStore.getWallet.privateKey.trim()
+  );
+  console.log("data=", data);
+  //
+  const res = await getBalance();
+  console.log("res=", res);
 };
-
-
+ 
+ 
 
 onMounted(async () => {
   const { data } = await createAccent({});
-  walletData.value =  JSON.parse(atob(data.content) ) 
+  walletData.value = JSON.parse(atob(data.content));
   systemStore.setStateValue({
     key: "wallet",
     value: {
@@ -67,38 +67,37 @@ onMounted(async () => {
     },
     localStorage: true,
   });
-})
+});
 </script>
 
 <style scoped lang="less">
- 
-.tag-container{
-  margin-top: 3px; 
+.tag-container {
+  margin-top: 3px;
   display: grid;
   grid-template-columns: repeat(3, 1fr);
   grid-gap: 16px;
   padding: 27px;
-  .van-tag{
+  .van-tag {
     width: 87px;
     height: 33px;
     display: flex;
     align-items: center;
     justify-content: center;
     border-radius: 4px;
-  } 
-  .van-tag--plain{
-    background: #ECEFFC;
+  }
+  .van-tag--plain {
+    background: #eceffc;
   }
 }
 
-.button-group{
-  margin: 33px 17px 0 17px; 
+.button-group {
+  margin: 33px 17px 0 17px;
   display: flex;
   flex-direction: column;
   align-items: center;
-  .button-group-mnemonic{
-    font-size: 14px; 
+  .button-group-mnemonic {
+    font-size: 14px;
     margin-bottom: 21px;
   }
 }
-</style>
+</style>

+ 4 - 4
src/views/login/createWallet/index.vue

@@ -73,8 +73,8 @@ const form = ref({});
 
 
 const onSubmit = ()=>{
-  if(form.value.password !== form.value.confirmPassword){
-    $msg({ type: 'warning', message: $t("form.InconsistentPasswords") })
+  if(form.value.password !== form.value.confirmPassword){ 
+    $msg($t("form.InconsistentPasswords"));
     return 
   }
   let data = _.cloneDeep(form.value)
@@ -84,9 +84,9 @@ const onSubmit = ()=>{
     value: data,
     localStorage: true,
   });
-
+console.log(data)
   router.push({
-    name: "backupMnemonic",
+    path: "/backupMnemonic",
   });
 }