index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <div class="page" id="page">
  3. <div class="top-title wow fadeInUp" data-wow-duration="2s" data-wow-delay="0s" data-wow-offset="0">
  4. <div class="top-container">
  5. <n-icon :component="MdContact" size="40" style="vertical-align: middle" />
  6. <span>{{t('common.navigate.UserCenter')}}</span>
  7. </div>
  8. </div>
  9. <div class="page-nav-container wow fadeInLeft" data-wow-duration="2s" data-wow-delay="0s" data-wow-offset="0">
  10. <div class="nav-txt">
  11. <n-breadcrumb separator=">">
  12. <n-breadcrumb-item> <n-icon :component="MdHome" /><router-link to="/home">{{t('common.navigate.home')}}</router-link> </n-breadcrumb-item>
  13. <n-breadcrumb-item> <n-icon :component="MdContact" />{{t('common.navigate.UserCenter')}} </n-breadcrumb-item>
  14. </n-breadcrumb>
  15. </div>
  16. </div>
  17. <div class="user-container">
  18. <div class="container" v-if="pcShow">
  19. <div class="user-main">
  20. <div class="left">
  21. <img src="@/assets/images/avatar.png" alt="avatar" />
  22. <!-- <n-image width="96" src="@/assets/images/avatar.png">
  23. <template #error>
  24. <n-icon :size="96" :component="MdImage"></n-icon>
  25. </template>
  26. </n-image> -->
  27. <div class="name">{{ user?.name }}</div>
  28. <ul>
  29. <template v-for="(item, index) in tabList" :key="item.value">
  30. <li :class="{ 'active-li': currentTab.index == index }" v-if="!(item.value == 2&&lang!='zh-CN')" @click="handleTab(item, index)">
  31. {{ item.label }}
  32. </li>
  33. </template>
  34. </ul>
  35. </div>
  36. <div class="right">
  37. <div class="sub-title">
  38. <span>{{ currentTab.title }}</span>
  39. <div class="search" v-if="currentTab.index == 1">
  40. <n-input v-model:value="researchBriefReportId" clearable :placeholder="t('myInfo.orderSearch')">
  41. <template #prefix>
  42. <span class="bqfl-iconfont icon-sousuo color80"></span>
  43. </template>
  44. </n-input>
  45. <n-button class="btn" type="primary" color="#18A058" @click="handleSearch"> {{t('myInfo.search')}} </n-button>
  46. </div>
  47. </div>
  48. <div class="content">
  49. <UserInfo v-if="currentTab.index == 0"></UserInfo>
  50. <OrderList ref="orderRef" v-if="currentTab.index == 1"></OrderList>
  51. <DownList v-if="currentTab.index == 2&&lang=='zh-CN'"></DownList>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. <div class="mobile-container" v-if="!pcShow">
  57. <n-tabs justify-content="space-evenly" type="line" size="large" class="custom-tabs" :name="currentTab.index">
  58. <n-tab-pane v-for="(item, index) in tabList" :name="index" :tab="item.label" :key="item.value">
  59. <UserInfo isMobile v-if="index == 0"></UserInfo>
  60. <OrderList ref="orderRef" isMobile v-if="index == 1"></OrderList>
  61. <DownList isMobile v-if="index == 2&&lang=='zh-CN'"></DownList>
  62. </n-tab-pane>
  63. </n-tabs>
  64. </div>
  65. </div>
  66. </div>
  67. </template>
  68. <script lang="ts" setup>
  69. import { useI18n } from "#imports";
  70. import { ref, reactive, onMounted, computed, watch } from "vue";
  71. import {
  72. NIcon,
  73. NBreadcrumb,
  74. NBreadcrumbItem,
  75. NButton,
  76. NInput,
  77. NImage,
  78. NTabs,
  79. NTabPane,
  80. createDiscreteApi,
  81. } from "naive-ui";
  82. import { MdContact, MdHome, MdImage } from "@vicons/ionicons4";
  83. import UserInfo from "./modules/user-info.vue";
  84. import OrderList from "./modules/order.vue";
  85. import DownList from "./modules/down.vue";
  86. import { useUserStore } from "@/store/user";
  87. import { useRouter, useRoute } from "vue-router";
  88. import ClientOnly from "@duannx/vue-client-only";
  89. const { t } = useI18n();
  90. const userStore = useUserStore();
  91. const lang = userStore.getLang;
  92. const route = useRoute();
  93. const pcShow = ref<boolean>(true);
  94. const user = computed(() => userStore.getUserInfo);
  95. const tabList = reactive<object[]>([
  96. {
  97. label: t('myInfo.myInformation'),
  98. value: 0,
  99. name: "user",
  100. },
  101. {
  102. label: t('myInfo.myOrders'),
  103. value: 1,
  104. name: "order",
  105. },
  106. {
  107. label: t('myInfo.myDownload'),
  108. value: 2,
  109. name: "down",
  110. },
  111. ]);
  112. interface currentTabObj {
  113. index?: number;
  114. title?: string;
  115. }
  116. const currentTab = reactive<currentTabObj>({
  117. index: 0,
  118. title: t('myInfo.myInformation'),
  119. });
  120. const researchBriefReportId = ref("");
  121. const orderRef = ref();
  122. const isShow = ref(false);
  123. watch(
  124. () => route.params.active,
  125. (val) => {
  126. currentTab.index = val || 0;
  127. currentTab.title = t('myInfo.myInformation');
  128. }
  129. );
  130. const handleTab = (item: any, index: number) => {
  131. if (currentTab.index == index) {
  132. return false;
  133. }
  134. currentTab.index = index;
  135. currentTab.title = item.label;
  136. };
  137. const handleSearch = () => {
  138. orderRef.value.searchData(researchBriefReportId.value);
  139. };
  140. // onMounted(async () => {
  141. // pcShow.value = !isMobile();
  142. isShow.value = true;
  143. currentTab.index = route.params.active || 0;
  144. currentTab.title = t('myInfo.myInformation');
  145. // });
  146. </script>
  147. <style lang="scss">
  148. .user-container {
  149. background: #ffffff;
  150. .user-main {
  151. display: flex;
  152. flex-wrap: wrap;
  153. height: 800px;
  154. border-radius: 16px;
  155. box-shadow: 0 0 10px 10px #f3f3f3;
  156. .left {
  157. width: 250px;
  158. height: 100%;
  159. padding: 25px 0;
  160. background: #f8f8f8;
  161. border-radius: 16px 0px 0px 16px;
  162. text-align: center;
  163. .n-image {
  164. border-radius: 50%;
  165. }
  166. .name {
  167. margin-bottom: 35px;
  168. font-size: 18px;
  169. color: #1a1a1a;
  170. line-height: 44px;
  171. }
  172. ul {
  173. padding: 0;
  174. li {
  175. margin: 0;
  176. list-style: none;
  177. padding: 0;
  178. p {
  179. padding: 0;
  180. margin: 0;
  181. }
  182. }
  183. }
  184. li {
  185. position: relative;
  186. height: 75px;
  187. line-height: 75px;
  188. cursor: pointer;
  189. }
  190. .active-li {
  191. color: #18a058;
  192. font-weight: bold;
  193. background-color: #fff;
  194. &::before {
  195. position: absolute;
  196. top: 0;
  197. left: 0;
  198. content: "";
  199. width: 6px;
  200. height: 100%;
  201. border-left: 6px solid #18a058;
  202. }
  203. }
  204. }
  205. .right {
  206. flex: 1;
  207. height: 100%;
  208. padding: 50px 50px 50px 70px;
  209. .sub-title {
  210. display: flex;
  211. padding-bottom: 15px;
  212. font-size: 24px;
  213. font-weight: bold;
  214. color: #1a1a1a;
  215. border-bottom: 1px solid #e6e6e6;
  216. }
  217. .search {
  218. display: flex;
  219. width: 500px;
  220. height: 60px;
  221. margin-left: auto;
  222. border-radius: 8px;
  223. .n-input {
  224. height: 100%;
  225. border-radius: 8px 0 0 8px;
  226. .n-input__input-el {
  227. height: 100%;
  228. }
  229. }
  230. .btn {
  231. width: 80px;
  232. height: 60px;
  233. border-radius: 0;
  234. }
  235. }
  236. .content {
  237. height: calc(100% - 75px);
  238. padding-top: 30px;
  239. }
  240. }
  241. }
  242. .mobile-container {
  243. .custom-tabs {
  244. .n-tab-pane {
  245. padding: 20px;
  246. }
  247. }
  248. }
  249. }
  250. </style>