Procházet zdrojové kódy

Merge branch 'master' of https://git.nanodreamtech.com/wkw/wallet_app

wkw před 1 měsícem
rodič
revize
24a523bd6f

+ 1 - 1
src/api/axios.js

@@ -31,7 +31,7 @@ axiosInstance.interceptors.request.use(
     systemStore.localLoading(true);
 
     if (!pathArr.includes(config.url)) {
-      const token = localStorage.getItem("token");
+      const token = systemStore.token;
       if (token && config.headers) {
         config.headers["Authorization"] = token;
       }

+ 13 - 6
src/common/login.js

@@ -2,12 +2,17 @@ import { login } from "@/api/path/login.api";
 
 import { imLogin } from "@/api/path/im.api";
 import { userInfo } from "@/api/path/jdfh.api";
+import { useWalletStore } from "@/stores/modules/walletStore";
 import { useSystemStore } from "@/stores/modules/systemStore";
 
 const imgHost = import.meta.env.VITE_PRO_IM_PATH + "/api/v1/file/";
 
+
+
 export async function sysLogin(address) {
+  const walletStore = useWalletStore();
   const systemStore = useSystemStore();
+
   const results = await Promise.allSettled([
     login({ wallet_address: address }),
     imLogin({ uuid: address }),
@@ -17,10 +22,10 @@ export async function sysLogin(address) {
   const imLoginResult = results[1].value;
 
   systemStore.token = loginResult.data.access_token;
-  systemStore.avatar = imgHost + imLoginResult.data.avatar;
-  systemStore.nickname = imLoginResult.data.nickname;
 
-  console.log(systemStore)
+  walletStore.avatar = imgHost + imLoginResult.data.avatar;
+  walletStore.username = imLoginResult.data.nickname;
+ 
   // 节点分红---获取用户是否为管理员以及是否加入了白名单
   const res = await userInfo({ address });
   if (res.ret) {
@@ -38,8 +43,10 @@ export async function sysLogin(address) {
 
 // 更新用户信息
 export async function updateUserInfo(address) {
-  const systemStore = useSystemStore();
+  const walletStore = useWalletStore();
+ 
+
   const res = await imLogin({ uuid: address });
-  systemStore.avatar = imgHost + res.data.avatar;
-  systemStore.nickname = res.data.nickname;
+  walletStore.avatar = imgHost + res.data.avatar;
+  walletStore.username = res.data.nickname;
 }

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

@@ -4,9 +4,7 @@ import { getSTSInfo } from "@/api/path/system.api";
 export const useSystemStore = defineStore("useSystemStore", {
   state: () => ({
     local_loading: false,
-    routeSate: "",
-    avatar: "",
-    nickname: "",
+    routeSate: "", 
     token: "",
     ISCREATE: false,
     stsClientInfo: {},

+ 2 - 0
src/stores/modules/walletStore.js

@@ -25,6 +25,8 @@ export const useWalletStore = defineStore("useWalletStore", {
     rpcUrl: "", // ACC私有链RPC
 
     username: "", // 用户名
+    avatar: "", // 头像
+
     accountName: "", //网络昵称
     accountIcon: "", // 网络头像
     accountPassword: null, // 密码

+ 2 - 2
src/views/me/index.vue

@@ -8,10 +8,10 @@
           height="46px"
           fit="cover"
           round
-          :src="systemStore.avatar"
+          :src="walletStore.avatar"
         />
         <div class="user-info">
-          <div class="user-info-name">{{systemStore.nickname}}</div>
+          <div class="user-info-name">{{ walletStore.username  }}</div>
           <div class="user-info-key-body">
             <span>{{ formatAddress(walletStore.account) }}</span>
             <svg-icon style="width: 24px; height: 24px;" name="copy" />

+ 4 - 5
src/views/me/personalInformation/index.vue

@@ -1,9 +1,9 @@
 <template>
   <div class="container">
     <div class="userimg">
-      <van-image round width="60" height="60" :src="systemStore.avatar" />
+      <van-image round width="60" height="60" :src="walletStore.avatar" />
     </div>
-    <div class="username">{{ systemStore.nickname || "Angel Token" }}</div>
+    <div class="username">{{ walletStore.username || "Angel Token" }}</div>
     <div class="useraddress">
       <span>0xF3fefE…EcaB</span>
       <svg-icon style="width: 18px; height: 18px" name="copy" />
@@ -11,7 +11,7 @@
     <van-list class="user-bar-list">
       <van-cell
         title="修改暱稱"
-        :value="systemStore.nickname"
+        :value="walletStore.username"
         is-link
         @click="show = true"
       ></van-cell>
@@ -55,8 +55,7 @@ import { useSystemStore } from "@/stores/modules/systemStore";
 import { useWalletStore } from "@/stores/modules/walletStore";
 import { uploadFile, userInfoEdit } from "@/api/path/im.api";
 import { updateUserInfo } from "@/common/login";
-
-const systemStore = useSystemStore();
+ 
 const walletStore = useWalletStore();
 
 const show = ref(false);

+ 4 - 4
src/views/wallet/index.vue

@@ -7,11 +7,11 @@
             width="28px"
             height="28px"
             round
-            :src="systemStore.avatar"
+            :src="walletStore.avatar"
           />
           <div class="user-info">
             <div class="user-info-name" @click="showWallet = true">
-              <div>{{ systemStore.nickname }}</div>
+              <div>{{ walletStore.username }}</div>
               <svg-icon style="width: 16px; height: 16px;margin-left: 3px;" name="down" />
             </div>
             <div class="user-info-key-body">
@@ -22,7 +22,7 @@
         </div>
         <div class="network">
           <van-image width="20px" height="20px" round :src="walletStore.accountIcon"/>
-          <div class="network-name">{{systemStore.nickname}}</div>
+          <div class="network-name">{{ walletStore.username  }}</div>
         </div>
       </div>
       <div class="amount">
@@ -102,7 +102,7 @@
                     width="37px"
                     height="37px"
                     round
-                    src="https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg"
+                    :src="item.avatar"
                   />
                   <div class="tree-li-cont">
                     <div class="tree-li-text">{{ item.username }}</div>