index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <div class="page" id="page">
  3. <div class="location">
  4. <div class="location_l"> <span class="iconfont icon-weizhi"></span></div>
  5. <div class="location_r"> Current Location : Home <span class="iconfont icon-dkw_guanbi-"></span> <span>User Center</span></div>
  6. </div>
  7. <div class="content" v-if="pcShow">
  8. <div>
  9. <div class="content_l">
  10. <div class="content_l_t">
  11. <img src="@/assets/images/avatar.png" alt="">
  12. <div>Linda</div>
  13. </div>
  14. <div class="content_l_b">
  15. <div class="content_l_b_item" :class="{active:currentTab.index==0}" @click="handleTab(0)">
  16. <span class="iconfont icon-wo_wodexinxi"></span>
  17. My information
  18. </div>
  19. <div class="content_l_b_item" :class="{active:currentTab.index==1}" @click="handleTab(1)">
  20. <span class="iconfont icon-wodedingdan-dingdan"></span>
  21. My order
  22. </div>
  23. <div class="content_l_b_item" :class="{active:currentTab.index==2}" @click="handleTab(2)">
  24. <span class="iconfont icon-wodexiazai"></span>
  25. My download
  26. </div>
  27. </div>
  28. </div>
  29. <div class="content_r">
  30. <ClientOnly>
  31. <UserInfo v-if="currentTab.index == 0"></UserInfo>
  32. <OrderList ref="orderRef" v-if="currentTab.index == 1"></OrderList>
  33. <DownList v-if="currentTab.index == 2"></DownList>
  34. </ClientOnly>
  35. </div>
  36. </div>
  37. </div>
  38. <div class="mobile-container" v-if="!pcShow">
  39. <n-tabs justify-content="space-evenly" type="line" size="large" class="custom-tabs" :name="currentTab.index">
  40. <n-tab-pane v-for="(item, index) in tabList" :name="index" :tab="item.label" :key="item.value">
  41. <UserInfo isMobile v-if="index == 0"></UserInfo>
  42. <OrderList ref="orderRef" isMobile v-if="index == 1"></OrderList>
  43. <DownList isMobile v-if="index == 2"></DownList>
  44. </n-tab-pane>
  45. </n-tabs>
  46. </div>
  47. </div>
  48. </template>
  49. <script lang="ts" setup>
  50. import { useI18n } from "#imports";
  51. import { ref, reactive, onMounted, computed, watch } from "vue";
  52. import {
  53. NIcon,
  54. NBreadcrumb,
  55. NBreadcrumbItem,
  56. NButton,
  57. NInput,
  58. NImage,
  59. NTabs,
  60. NTabPane,
  61. createDiscreteApi,
  62. } from "naive-ui";
  63. import { MdContact, MdHome, MdImage } from "@vicons/ionicons4";
  64. import UserInfo from "./modules/user-info.vue";
  65. import OrderList from "./modules/order.vue";
  66. import DownList from "./modules/down.vue";
  67. import { useUserStore } from "@/store/user";
  68. import { useRouter, useRoute } from "vue-router";
  69. import ClientOnly from "@duannx/vue-client-only";
  70. const { t } = useI18n();
  71. const userStore = useUserStore();
  72. const lang = userStore.getLang;
  73. const route = useRoute();
  74. const pcShow = ref<boolean>(true);
  75. const user = computed(() => userStore.getUserInfo);
  76. const tabList = reactive<object[]>([
  77. {
  78. label: "My information",
  79. value: 0,
  80. name: "user",
  81. },
  82. {
  83. label: "My order",
  84. value: 1,
  85. name: "order",
  86. },
  87. {
  88. label: "My download",
  89. value: 2,
  90. name: "down",
  91. },
  92. ]);
  93. interface currentTabObj {
  94. index?: number;
  95. title?: string;
  96. }
  97. const currentTab = reactive<currentTabObj>({
  98. index: 0,
  99. // title: t("myInfo.myInformation"),
  100. });
  101. const researchBriefReportId = ref("");
  102. const orderRef = ref();
  103. const isShow = ref(false);
  104. watch(
  105. () => route.params.active,
  106. (val) => {
  107. currentTab.index = val || 0;
  108. currentTab.title = t("myInfo.myInformation");
  109. }
  110. );
  111. const handleTab = (index: number) => {
  112. if (currentTab.index == index) {
  113. return false;
  114. }
  115. currentTab.index = index;
  116. };
  117. const handleSearch = () => {
  118. orderRef.value.searchData(researchBriefReportId.value);
  119. };
  120. isShow.value = true;
  121. // currentTab.index = route.params.active || 0;
  122. currentTab.title = t("myInfo.myInformation");
  123. onMounted(() => {
  124. pcShow.value = !isMobile();
  125. });
  126. </script>
  127. <style lang="scss" scoped>
  128. @import "~/assets/css/tool.scss";
  129. .page {
  130. margin-top: var(--size-130);
  131. .location {
  132. display: flex;
  133. border-bottom: 1px solid #e6e6e6;
  134. padding: 0 var(--size-160);
  135. background: #ffffff;
  136. .location_l {
  137. width: var(--size-60);
  138. height: var(--size-60);
  139. background: #dcdcdc;
  140. color: #383838;
  141. font-size: var(--size-16);
  142. text-align: center;
  143. line-height: var(--size-60);
  144. margin-right: var(--size-30);
  145. }
  146. .location_r {
  147. font-size: var(--size-14);
  148. font-family: Arial, Arial-Regular;
  149. color: #666666;
  150. line-height: var(--size-59);
  151. span {
  152. color: #639e57;
  153. font-family: Microsoft YaHei, Microsoft YaHei-Regular;
  154. }
  155. .icon-dkw_guanbi- {
  156. color: #666666;
  157. font-size: var(--size-12);
  158. }
  159. }
  160. }
  161. .content {
  162. padding: 50px 175px;
  163. > div {
  164. background: #f4f7f9;
  165. border-radius: 20px;
  166. padding: 18px 20px;
  167. display: flex;
  168. .content_l {
  169. .content_l_t {
  170. width: 343px;
  171. height: 220px;
  172. background: linear-gradient(180deg, #60ab91, #84a86c);
  173. border-radius: 20px;
  174. text-align: center;
  175. padding-top: 32px;
  176. img {
  177. width: 100px;
  178. height: 100px;
  179. background: rgba(0, 0, 0, 0);
  180. border: 2px solid #ffffff;
  181. border-radius: 50%;
  182. }
  183. > div {
  184. font-size: 28px;
  185. font-family: Microsoft YaHei, Microsoft YaHei-Regular;
  186. text-align: center;
  187. color: #ffffff;
  188. line-height: 44px;
  189. letter-spacing: 0.08px;
  190. }
  191. }
  192. .content_l_b {
  193. margin-top: 20px;
  194. .content_l_b_item {
  195. width: 343px;
  196. height: 70px;
  197. border-radius: 20px;
  198. color: #1a1a1a;
  199. line-height: 70px;
  200. letter-spacing: 0.05px;
  201. font-size: 18px;
  202. padding-left: 63px;
  203. cursor: pointer;
  204. span {
  205. display: inline-block;
  206. margin-right: 15px;
  207. font-size: 20px;
  208. color: #1a1a1a;
  209. }
  210. }
  211. .active {
  212. background: linear-gradient(180deg, #60ab91, #84a86c);
  213. color: #ffffff;
  214. span {
  215. color: #ffffff;
  216. }
  217. }
  218. }
  219. }
  220. .content_r {
  221. flex: 1;
  222. background: #ffffff;
  223. border-radius: 20px;
  224. margin-left: 45px;
  225. padding: 30px 30px;
  226. }
  227. }
  228. }
  229. }
  230. @include responseTo("phone") {
  231. .page {
  232. .location {
  233. padding: 0;
  234. .location_l {
  235. margin-right: 15px;
  236. }
  237. }
  238. .mobile-container {
  239. .custom-tabs {
  240. .n-tab-pane {
  241. padding: 15px;
  242. }
  243. }
  244. }
  245. }
  246. }
  247. </style>