ソースを参照

添加地址簿

wkw 3 週間 前
コミット
7bada2899a

+ 1 - 0
src/stores/modules/systemStore.js

@@ -11,6 +11,7 @@ export const useSystemStore = defineStore("useSystemStore", {
     ISCREATE: false,
     stsClientInfo: {},
     Administrator: {},
+    DAPP_CACHE_KEY:[]
   }),
   persist: true,
   getters: {

+ 27 - 9
src/views/dapp/index.vue

@@ -27,7 +27,7 @@
             </template>
         </van-swipe>
 
-        <van-tabs class="tabs-wrapper-card" type="card">
+        <van-tabs class="tabs-wrapper-card" type="card" @change="onTabsWrapperCard">
             <van-tab
                 v-for="(item, index) in tabsAppConfig"
                 :title="item.title"
@@ -36,7 +36,7 @@
                 <div class="tabs-content-body">
                     <div
                         v-for="cItem in item.children"
-                        class="tabs-content-item"
+                        class="tabs-content-item" @click="handleVisitDapp(cItem)"
                     >
                         <van-image
                             class="tabs-content-item-icon"
@@ -49,11 +49,7 @@
             </van-tab>
         </van-tabs>
 
-        <van-tabs
-            v-model="activeTab"
-            @change="onTabChange"
-            class="tabs-wrapper"
-        >
+        <van-tabs v-model="activeTab" @change="onTabChange" class="tabs-wrapper">
             <!-- 全部 -->
             <van-tab title="全部" name="ALL">
                 <template #default>
@@ -63,7 +59,7 @@
                             <div
                                 class="tab-box-list"
                                 v-for="item in group.items"
-                                :key="item.id"
+                                :key="item.id" @click="handleVisitDapp(item)"
                             >
                                 <van-image
                                     class="tab-box-list-img"
@@ -102,7 +98,7 @@
                         <div
                             class="tab-box-list"
                             v-for="item in filteredList"
-                            :key="item.id"
+                            :key="item.id" @click="handleVisitDapp(item)"
                         >
                             <van-image
                                 class="tab-box-list-img"
@@ -129,6 +125,9 @@
 
 <script setup>
 import { dappSlides, dappList } from '@/api/path/dapp.api';
+import { useSystemStore } from "@/stores/modules/systemStore";
+const systemStore = useSystemStore();
+
 const slidesList = ref([]);
 const tabsAppConfig = ref([
     {
@@ -195,10 +194,29 @@ const getdappList = async () => {
   rawList.value = res.data.list;
 };
 
+// 热门推荐 浏览记录切换
+const onTabsWrapperCard = (name) => {
+    if(name == 1) loadHistoryList();
+}
+
+//保存数据
+const handleVisitDapp = (item) => {
+  const history = systemStore.DAPP_CACHE_KEY
+  const filtered = history.filter(i => i.id !== item.id);
+  filtered.unshift(item);
+  const newHistory = filtered.slice(0, 6);
+  systemStore.DAPP_CACHE_KEY = newHistory;
+};
+const loadHistoryList = () => {
+  const history = systemStore.DAPP_CACHE_KEY
+  tabsAppConfig.value[1].children = history;
+};
+
 onMounted(async () => {
     getdappSlides();
     gethotlist();
     getdappList();
+    loadHistoryList(); // 加载浏览记录
 });
 </script>
 

+ 87 - 7
src/views/me/addAddress/index.vue

@@ -3,10 +3,10 @@
         <div class="content">
             <div class="card-box">
                 <div class="card-title">选择网络</div>
-                <div class="card-input" style="justify-content: space-between;">
+                <div class="card-input" style="justify-content: space-between;" @click="showWallet = true">
                     <div class="card-input-lf">
-                        <svg-icon style="width: 30px; height: 30px;" name="acc" />
-                        <div class="card-text">STT</div>
+                        <van-image width="30px" height="30px" round :src="selectTokenInfo.logo"/>
+                        <div class="card-text">{{selectTokenInfo.name}}</div>
                     </div>
                     <svg-icon style="width: 16px; height: 16px;" name="right1" />
                 </div>
@@ -23,7 +23,7 @@
                     <van-field 
                         type="textarea"
                         v-model="walletAddress"
-                        placeholder="请输入收货地址"
+                        placeholder="请输入地址"
                         rows="1"
                         :autosize="true"
                     >
@@ -34,15 +34,49 @@
                 </div>
             </div>
         </div>
-        <van-button class="footer-btn" type="primary" size="large">确认</van-button>
+        <van-button class="footer-btn" type="primary" size="large" :disabled="isConfirm" @click="confirm">确认</van-button>
+        <van-popup v-model:show="showWallet" position="bottom" round style="height:400px">
+            <div class="pop-content" style="height:400px">
+                <div class="pop-title">
+                    <svg-icon style="width: 24px; height: 24px;" name="left-arrow" @click="showWallet = false"/>
+                    <div class="title">选择网络</div>
+                </div>
+                <div class="list-ul">
+                    <div class="list-li" v-for="item in hotTokensList" @click="changeList(item)" :key="item.name">
+                        <div class="list-li-lf">
+                            <van-image width="42px" height="42px" round :src="item.logo"/>
+                            <div style="margin-left: 12px;">{{item.name}}</div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </van-popup>
     </div>
 </template>
 
 <script setup>
-import { useRouter } from 'vue-router'
-const router = useRouter();
+import { showToast } from 'vant';
+import { useWalletStore } from "@/stores/modules/walletStore";
+const walletStore = useWalletStore();
+
+let hotTokensList = walletStore.tokenList;
+let selectTokenInfo = ref(walletStore.tokenList[0]);
+const showWallet = ref(false);
 const addressName = ref('')
 const walletAddress = ref('')
+
+const isConfirm = computed(()=>{
+    return !(addressName.value.trim() && walletAddress.value.trim());
+})
+// 切换网络
+const changeList = (item) => {
+    showWallet.value = false;
+    selectTokenInfo.value = item;
+}
+// 确认
+const confirm = () => {
+   
+}
 </script>
 
 <style lang="less" scoped>
@@ -112,6 +146,52 @@ const walletAddress = ref('')
         box-sizing: border-box;
         color: #fff;
     }
+    .pop-content{
+        display: flex;
+        flex-direction: column;
+        .pop-title{
+            padding: 17px;
+            border-bottom: 1px solid #F2F2F2;
+            display: flex;
+            align-items: center;
+            font-family: PingFang SC, PingFang SC;
+            font-weight: 500;
+            font-size: 17px;
+            color: #000000;
+            .title{
+                flex: 1;
+                display: flex;
+                justify-content: center;
+            }
+        }
+        .list-ul{
+            flex: 1;
+            display: flex;
+            flex-direction: column;
+            overflow: auto;
+            margin: 16px;
+            .list-li{
+                display: flex;
+                align-items: center;
+                justify-content: space-between;
+                font-family: PingFang SC, PingFang SC;
+                font-weight: 500;
+                margin-bottom: 16px;
+                .list-li-lf{
+                    display: flex;
+                    align-items: center;
+                    font-size: 15px;
+                    color: #000000;
+                }
+            }
+            .list-li:last-child{
+                margin-bottom: 0;
+            }
+        }
+        .list-ul::-webkit-scrollbar{
+            width: 0;
+        }
+    }
 }
 :deep(.van-button--primary){
     border: none !important;

+ 1 - 1
src/views/transaction/jys/index.vue

@@ -232,7 +232,7 @@ const changeBtn = async () => {
         return;
     }
 
-    const balances = [Number(STTLIST.balance || 0), Number(WGTLIST.balance || 0)];
+    const balances = [Number(STTLIST.balance || 0), Number(WGTLIST.balance || 0),Number(WGTLIST.balance || 0)];
     const tokenName = tabActive.value == 0 ? 'STT' : 'WGT';
     if (inputValue > balances[tabActive.value]) {
         showToast(`输入数量不能大于可用${tokenName}数量`);

+ 5 - 0
vite.config.js

@@ -70,6 +70,11 @@ export default defineConfig(({ mode }) => {
       cors: true,
       hmr: true,
       proxy: {
+        "/api/v2": {
+          target: env.VITE_PRO_BACKEND_PATH,
+          changeOrigin: true,
+          secure: true,
+        },
         "/api/v1": {
           target: env.VITE_PRO_IM_PATH,
           changeOrigin: true,