Browse Source

feat: 个人信息

liming 3 weeks ago
parent
commit
8c785a7cf7

+ 1 - 1
index.html

@@ -4,7 +4,7 @@
     <meta charset="UTF-8">
     <link rel="icon" href="/favicon.ico"> 
     <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
-    <title>Vite App</title>
+    <title>Angel Toke</title>
   </head>
   <body>
     <div id="app"></div>

BIN
public/favicon.ico


+ 2 - 2
src/api/path/login.api.js

@@ -21,5 +21,5 @@ export function hotTokens(param) {
 }
 // 登录
 export function login(param) {
-  return service.post('login/walletLogin', param );
-}
+  return service.post('login/walletLoginNew', param );
+}

+ 2 - 0
src/api/path/system.api.js

@@ -7,3 +7,5 @@ import service from '../axios'
 export function getSTSInfo(params) {
   return service.get('/admin/system/getSTSInfo', params)
 }
+
+

+ 4 - 3
src/api/path/user.api.js

@@ -1,5 +1,6 @@
 import service from '../axios'
 
-export function login(param) {
-  return service.post('/user/login', param );
-}
+// 修改用户信息
+export function userInfoEdit(param) {
+  return service.put('info_edit', param );
+}

+ 1 - 1
src/common/login.js

@@ -6,7 +6,7 @@ import { useSystemStore } from "@/stores/modules/systemStore";
 const systemStore = useSystemStore();
 export async function sysLogin(address) {
 
-  const { data, code } = await login({ wallet_address:address }); 
+  const { data, code } = await login({ address:address }); 
   if(code !== 1){
     $msg($t("form.LoginFailed"));
     return

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

@@ -10,7 +10,7 @@ export const useSystemStore = defineStore("useSystemStore", {
     token: getLocalStorage("token") || "",
     stsClientInfo: {},
   }),
-  persist: true,
+  persist: ["stsClientInfo"],
   getters: {
     getLocalLoading() {
       return this.local_loading;
@@ -88,6 +88,9 @@ export const useSystemStore = defineStore("useSystemStore", {
     getISCREATE() {
       return this.ISCREATE || getLocalStorage("ISCREATE");
     },
+    getUserInfo() {
+      return this.user_login_information || getLocalStorage("user_login_information");
+    },
   },
   actions: {
     localLoading(value = false) {

+ 14 - 3
src/views/me/personalInformation/index.vue

@@ -8,7 +8,7 @@
                 src="https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg"
             />
         </div>
-        <div class="username">Wallet</div>
+        <div class="username">{{ systemStore.getUserInfo?.name || "Angel Toke"}}</div>
         <div class="useraddress">
             <span>0xF3fefE…EcaB</span>
             <svg-icon style="width: 18px; height: 18px;" name="copy" />
@@ -35,7 +35,7 @@
                 <van-field v-model="nickname" class="pop-input"/>
                 <div class="pop-btn">
                     <van-button type="default" class="btn cancel" @click="show = false">取消</van-button>
-                    <van-button type="default" class="btn confirm" @click="show = false">確定</van-button>
+                    <van-button type="default" class="btn confirm" @click="updateUserName">確定</van-button>
                 </div>
             </div>
         </van-popup>
@@ -43,12 +43,23 @@
 </template>
 
 <script setup>
+import { userInfoEdit } from "@/api/path/user.api"
 import QrcodeVue from 'qrcode.vue'
+import { useSystemStore  } from "@/stores/modules/systemStore";
+
+const systemStore = useSystemStore();
+
 const show = ref(false);
 const nickname = ref('');
 const qrtext = ref('');
 const afterRead = () => {
-    
+    console.log("afterRead")
+}
+
+const updateUserName = async () => {
+  const res = await userInfoEdit({
+    name: nickname.value
+  })
 }
 </script>