# 取得使用者資訊 ## 功能 向後端索取使用者資訊 ## 使用 tips: * 執行 getUserInfo() 後會將資料存於 vuex useStore,如要使用資料,須另引用。 * 通常在使用者登入後,store 就會有資料,可直接調用。 ``` jsx // 調用函式執行 <script setup> // 引入共用函式; getUserInfo() 存於 common.js const { getUserInfo } = common(); await getUserInfo(); </script> // 調用 store 資料 <script setup> import { useStore } from 'vuex'; const store = useStore(); const user = computed(() => store.state.user); console.log(user.value) </script> ``` ## 說明書 (以使用者: 'aaaaaa' SessionKey 版面: 'aah' 為例) ### API 路徑 ![20240227144502](https://hackmd.io/_uploads/BJ6gSWj2T.png) /api/User/Info ### 前端傳入資料 ##### Example Value ``` jsx // params { "sessionKey": "7a9e4971c0074b0f9f9d1584fea6e9fb", "lang": "en", "domainLayoutId": "aah" } ``` ##### parameters | params | Description | type | required | | ---------------- | ----------- | ------ | -------- | | sessionKey | SessionKey | string | true | | lang | 語系 | string | false | | domainLayoutId | 域名版面識別碼 | string | true | ### 後端回傳資料 #### 成功 ##### Example Value ``` jsx! // status code: 200 { "bucketId": "OwinT", // 分站識別碼 "account": "aaaaaa", // 帳號 "createTime": 1693965194376, // 新增時間 "realName": "werawesdfew", // 真實姓名 "avatarImage": "https://image3.owin.info/2c2bce287a954228b6b17921b5237cf0.jpg", // 頭像圖 "nickName": "盖特芬格", // 暱稱 "aboutMe": " ", // 個人簽名 "birthday": null, // 生日(yyyy-MM-dd) "gender": null, // 性別(0=男,1=女生) "isAnchor": false, // 是否為主播 "level": 6, // 代理等級 "phoneNumber": "******123431", // 電話號碼 "email": null, // 電子信箱 "directLowerCount": 0, // 直屬下級會員數 "indirectLowerCount": 0, // 非直屬下級會員數 "type": true, // 類型(0=信用,1=現金) "recommendCode": "XL6MO0", // 推廣碼 "recRegisterUrl": "", // 邀請碼註冊網址 "isPlatformPayOpen": true, // 是否開啟平台支付 "isAgentPayOpen": true, // 是否開啟代理支付 "hasTransactionPassword": true, // 是否已設定轉帳密碼 "peerageLevel": null, // 代理貴族爵位等級 "identification": "12465123511", // 身分識別碼(CPF) "isWithdrawalTelVerify": true // 出款需手機驗證 } ``` #### 失敗 ![20240227150419](https://hackmd.io/_uploads/B14tFWi3p.png)