index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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. import { startScan } from "@/composables/barcodeScanner.js"
  72. useCopy();
  73. const systemStore = useSystemStore();
  74. const walletStore = useWalletStore();
  75. const router = useRouter();
  76. const vanListConfig = [
  77. { title: '元宝兑换', icon:"ingot", url: 'exchange',status:true },
  78. { title: '竞赛', icon:"competition", url: '',status:true },
  79. { title: '节点分红', icon:"red-envelope", url: 'nodeDividend',status:systemStore.Administrator.is_white },
  80. // { title: '帮助中心', icon:"help", url: '/' },
  81. { title: $t('router.AboutUs'), icon:"me", url: 'aboutUs',status:true },
  82. { title: '系统设置', icon:"set", url: 'systemSettings',status:true },
  83. { title: '管理员设置', icon:"admin-set", url: 'administratorSettings',status:systemStore.Administrator.is_super },
  84. ]
  85. const filteredVanList = computed(() => {
  86. return vanListConfig.filter(item => item.status !== false);
  87. });
  88. const formatAddress = (address) => {
  89. if (!address) return '';
  90. return address.slice(0, 8) + '...' + address.slice(-6);
  91. };
  92. const evGoPath = (path)=>{
  93. if(path == ''){
  94. const dapp = cryptoEncode(
  95. JSON.stringify({
  96. address: walletStore.account,
  97. privateKey: walletStore.privateKey,
  98. })
  99. );
  100. openDapp('http://192.168.0.70:8088/#/', { dapp });
  101. return;
  102. }
  103. router.push(path)
  104. }
  105. const goToaPage = (url) => {
  106. router.push(url)
  107. }
  108. </script>
  109. <style lang="less" scoped>
  110. .head-bg {
  111. .fn-head-bg()
  112. }
  113. .head-body {
  114. width: 100%;
  115. display: flex;
  116. flex-direction: column;
  117. .user-info-body {
  118. flex: 1;
  119. display: flex;
  120. padding: 44px 17px 0 17px;
  121. .user-info {
  122. margin-left: 17px;
  123. .user-info-name {
  124. font-size: 1.1rem;
  125. font-weight: 500;
  126. color: @theme-color1;
  127. }
  128. .user-info-key-body{
  129. display: flex;
  130. align-items: center;
  131. font-weight: 400;
  132. font-size: 12px;
  133. color: @font-color2;
  134. span {
  135. margin-top: 4px;
  136. margin-right: 4px;
  137. }
  138. }
  139. }
  140. }
  141. .user-info-row {
  142. margin: 27px 17px 0 17px;
  143. height: 78px;
  144. min-height: 78px;
  145. background: @bg-color1;
  146. box-shadow: 0px 4px 8px -2px rgba(25, 75, 137, 0.25);
  147. border-radius: 17px 17px 17px 17px;
  148. }
  149. .user-bar-icon-box{
  150. height: 100%;
  151. display: flex;
  152. flex-direction: column;
  153. align-items: center;
  154. justify-content: center;
  155. .user-bar-icon{
  156. width: 25px;
  157. height: 25px;
  158. }
  159. .user-info-text{
  160. font-weight: 400;
  161. font-size: 12px;
  162. color: #000000;
  163. margin-top: 5px;
  164. }
  165. }
  166. }
  167. .van-cell{
  168. height: 44px;
  169. background: @bg-color1;
  170. border-bottom: 1px solid @bg-color1;
  171. font-size: 15px;
  172. align-items: center;
  173. &::after{
  174. border-bottom: 1px solid #F2F2F2;
  175. }
  176. }
  177. :deep(.van-cell__title){
  178. font-family: PingFang SC, PingFang SC;
  179. font-weight: 500 ;
  180. font-size: 15px;
  181. color: #000000;
  182. }
  183. .user-bar-list-last::after{
  184. border-bottom: 0;
  185. }
  186. .user-bar-list{
  187. margin: 37px 17px 0 17px;
  188. border-radius: 12px 12px 12px 12px;
  189. overflow: hidden;
  190. .cell-icon{
  191. width: 21px;
  192. height: 21px;
  193. margin-right: 4px;
  194. }
  195. }
  196. </style>