index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <div class="container">
  3. <div class="head-bg"/>
  4. <div class="head-body">
  5. <div class="user-info-body">
  6. <van-image
  7. width="46px"
  8. height="46px"
  9. fit="cover"
  10. round
  11. :src="walletStore.avatar"
  12. />
  13. <div class="user-info">
  14. <div class="user-info-name">{{ walletStore.username }}</div>
  15. <div class="user-info-key-body">
  16. <span>{{ formatAddress(walletStore.account) }}</span>
  17. <svg-icon class="im-copy-btn" style="width: 24px; height: 24px;" :data-clipboard-text="walletStore.account" name="copy" />
  18. </div>
  19. </div>
  20. </div>
  21. <van-row justify="end" class="user-info-row">
  22. <van-col span="6" >
  23. <div class="user-bar-icon-box">
  24. <svg-icon class="user-bar-icon" name="address-book" @click="goToaPage('meAddressManagement')"/>
  25. <span class="user-info-text">地址薄</span>
  26. </div>
  27. </van-col>
  28. <van-col span="6">
  29. <div class="user-bar-icon-box">
  30. <svg-icon class="user-bar-icon" name="bar-url" @click="goToaPage('download')"/>
  31. <span class="user-info-text">下载链接</span>
  32. </div>
  33. </van-col>
  34. <van-col span="6">
  35. <div class="user-bar-icon-box" @click="goToaPage('walletManagement')">
  36. <svg-icon class="user-bar-icon" name="wallet"/>
  37. <span class="user-info-text">钱包管理</span>
  38. </div>
  39. </van-col>
  40. <van-col span="6">
  41. <div class="user-bar-icon-box" @click="goToaPage('personalInformation')">
  42. <svg-icon class="user-bar-icon" name="id-card"/>
  43. <span class="user-info-text">个人资料</span>
  44. </div>
  45. </van-col>
  46. </van-row>
  47. </div>
  48. <!-- 用户索引栏 -->
  49. <van-list class="user-bar-list">
  50. <van-cell
  51. v-for="(item, index) in filteredVanList"
  52. :key="index"
  53. :class="index == filteredVanList.length - 1 ? 'user-bar-list-last' : ''"
  54. :title="item.title"
  55. is-link
  56. @click="evGoPath(item.url)"
  57. >
  58. <template #icon>
  59. <svg-icon class="cell-icon" :name="item.icon" />
  60. </template>
  61. </van-cell>
  62. </van-list>
  63. </div>
  64. </template>
  65. <script setup>
  66. import { useSystemStore } from "@/stores/modules/systemStore"
  67. import { useWalletStore } from "@/stores/modules/walletStore";
  68. import { openDapp } from "@/composables/dAppView";
  69. import { cryptoEncode } from "@/utils/crypto";
  70. import { useCopy } from "@/hooks/use-copy.js";
  71. useCopy();
  72. const systemStore = useSystemStore();
  73. const walletStore = useWalletStore();
  74. const router = useRouter();
  75. const vanListConfig = [
  76. { title: '元宝兑换', icon:"ingot", url: 'exchange',status:true },
  77. { title: '竞赛', icon:"competition", url: '',status:true },
  78. { title: '节点分红', icon:"red-envelope", url: 'nodeDividend',status:systemStore.Administrator.is_white },
  79. // { title: '帮助中心', icon:"help", url: '/' },
  80. { title: $t('router.AboutUs'), icon:"me", url: 'aboutUs',status:true },
  81. { title: '系统设置', icon:"set", url: 'systemSettings',status:true },
  82. { title: '管理员设置', icon:"admin-set", url: 'administratorSettings',status:systemStore.Administrator.is_super },
  83. ]
  84. const filteredVanList = computed(() => {
  85. return vanListConfig.filter(item => item.status !== false);
  86. });
  87. const formatAddress = (address) => {
  88. if (!address) return '';
  89. return address.slice(0, 8) + '...' + address.slice(-6);
  90. };
  91. const evGoPath = (path)=>{
  92. if(path == ''){
  93. const dapp = cryptoEncode(
  94. JSON.stringify({
  95. address: walletStore.account,
  96. privateKey: walletStore.privateKey,
  97. })
  98. );
  99. openDapp('http://192.168.0.70:8088/#/', { dapp });
  100. return;
  101. }
  102. router.push(path)
  103. }
  104. const goToaPage = (url) => {
  105. router.push(url)
  106. }
  107. </script>
  108. <style lang="less" scoped>
  109. .head-bg {
  110. .fn-head-bg()
  111. }
  112. .head-body {
  113. width: 100%;
  114. display: flex;
  115. flex-direction: column;
  116. .user-info-body {
  117. flex: 1;
  118. display: flex;
  119. padding: 44px 17px 0 17px;
  120. .user-info {
  121. margin-left: 17px;
  122. .user-info-name {
  123. font-size: 1.1rem;
  124. font-weight: 500;
  125. color: @theme-color1;
  126. }
  127. .user-info-key-body{
  128. display: flex;
  129. align-items: center;
  130. font-weight: 400;
  131. font-size: 12px;
  132. color: @font-color2;
  133. span {
  134. margin-top: 4px;
  135. margin-right: 4px;
  136. }
  137. }
  138. }
  139. }
  140. .user-info-row {
  141. margin: 27px 17px 0 17px;
  142. height: 78px;
  143. min-height: 78px;
  144. background: @bg-color1;
  145. box-shadow: 0px 4px 8px -2px rgba(25, 75, 137, 0.25);
  146. border-radius: 17px 17px 17px 17px;
  147. }
  148. .user-bar-icon-box{
  149. height: 100%;
  150. display: flex;
  151. flex-direction: column;
  152. align-items: center;
  153. justify-content: center;
  154. .user-bar-icon{
  155. width: 25px;
  156. height: 25px;
  157. }
  158. .user-info-text{
  159. font-weight: 400;
  160. font-size: 12px;
  161. color: #000000;
  162. margin-top: 5px;
  163. }
  164. }
  165. }
  166. .van-cell{
  167. height: 42px;
  168. background: @bg-color1;
  169. border-bottom: 1px solid @bg-color1;
  170. font-size: 15px ;
  171. &::after{
  172. border-bottom: 1px solid #F2F2F2;
  173. }
  174. }
  175. .user-bar-list-last::after{
  176. border-bottom: 0;
  177. }
  178. .user-bar-list{
  179. margin: 37px 17px 0 17px;
  180. border-radius: 12px 12px 12px 12px;
  181. overflow: hidden;
  182. .cell-icon{
  183. width: 21px;
  184. height: 21px;
  185. margin-right: 4px;
  186. }
  187. }
  188. </style>