MemberLeftNav.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <!--个人中心左侧公共导航 @zjf-2020-12-26-->
  2. <template>
  3. <div class="sld_member_left_nav">
  4. <template v-for="(item, index) in leftNavMenu" :key="index">
  5. <router-link :to="{ path: item.path }" class="menu">
  6. <i :class="{ iconfont: true, [item.icon]: true }"></i>
  7. {{ item.name }}
  8. </router-link>
  9. <template v-if="item.child.length">
  10. <template
  11. v-for="(item_child, index_child) in item.child"
  12. :key="index_child"
  13. >
  14. <router-link
  15. v-if="testIfShow(item_child)"
  16. :to="{ path: item_child.path, query: item_child.query }"
  17. :class="{
  18. submenu: true,
  19. cur_code_active: curCode == item_child.code,
  20. }"
  21. >{{ item_child.name }}</router-link
  22. >
  23. </template>
  24. </template>
  25. </template>
  26. </div>
  27. </template>
  28. <script setup>
  29. // import { lang_zn } from "@/assets/language/zh";
  30. import { getCurLanguage } from '@/composables/common.js';
  31. import { useFiltersStore } from "@/store/filter.js";
  32. const filtersStore = useFiltersStore();
  33. // const L = lang_zn;
  34. const L = getCurLanguage();
  35. const router = useRouter();
  36. const { proxy } = getCurrentInstance();
  37. const curCode = ref("");
  38. const memberInfo = filtersStore.getMemberInfo;
  39. watchEffect(() => {
  40. let tmpPath = router.currentRoute.value.fullPath;
  41. if (
  42. router.currentRoute.value.name != undefined &&
  43. router.currentRoute.value.name
  44. ) {
  45. curCode.value = router.currentRoute.value.name;
  46. if (tmpPath == "/member/collect?type=store") {
  47. curCode.value = "memberCollectStore"; //关注店铺
  48. } else if (
  49. tmpPath == "/member/order/aftersales?type=return" ||
  50. tmpPath.indexOf("/member/order/refund/detail?curTitleId=2") > -1
  51. ) {
  52. curCode.value = "AfterSalesListReturn"; //我的退货
  53. } else if (
  54. tmpPath == "/member/order/aftersales" ||
  55. tmpPath.indexOf("/member/order/refund/detail?curTitleId=1") > -1
  56. ) {
  57. curCode.value = "AfterSalesList"; //我的退款
  58. }
  59. }
  60. });
  61. const leftNavMenu = [
  62. {
  63. code: "collect",
  64. icon: "icon-gerenzhongxinguanzhu",
  65. name: L["关注中心"],
  66. path: "/member/home",
  67. child: [
  68. {
  69. code: "member-collect",
  70. name: L["我的收藏"],
  71. path: "/member/collect",
  72. },
  73. {
  74. code: "memberCollectStore",
  75. query: { type: "store" },
  76. name: L["店铺收藏"],
  77. path: "/member/collect",
  78. },
  79. {
  80. code: "member-footprint",
  81. name: L["我的足迹"],
  82. path: "/member/footprint",
  83. },
  84. ],
  85. },
  86. {
  87. code: "member",
  88. icon: "icon-gerenzhongxinhuiyuanzhongxin",
  89. name: L["会员中心"],
  90. path: "/member/home",
  91. child: [
  92. {
  93. code: "member-info",
  94. name: L["会员信息"],
  95. path: "/member/info",
  96. },
  97. {
  98. code: "member-account",
  99. name: L["账号安全"],
  100. path: "/member/account",
  101. },
  102. // {
  103. // code: "member-email",
  104. // name: L["邮箱管理"],
  105. // path: "/member/email",
  106. // },
  107. // {
  108. // code: "member-pwd-login",
  109. // name: L["登录密码"],
  110. // path: "/member/pwd/login",
  111. // },
  112. {
  113. code: "member-enquiry-list",
  114. name: L["我的询盘"],
  115. path: "/member/enquiry/list"
  116. },
  117. {
  118. code: "member-download-center",
  119. name: L["下载中心"],
  120. path: "/member/download/center"
  121. },
  122. // {
  123. // code: "member-address-list",
  124. // name: L["收货地址"],
  125. // path: "/member/address/list",
  126. // },
  127. ],
  128. },
  129. ];
  130. const testIfShow = (nav_info) => {
  131. if (nav_info.code == "MemberResetPassword") {
  132. if (filtersStore.getMemberInfo.hasPayPassword == 1) {
  133. return true;
  134. } else {
  135. return false;
  136. }
  137. } else {
  138. return true;
  139. }
  140. };
  141. </script>
  142. <style lang="scss" scoped>
  143. @import "@/assets/style/theme.scss";
  144. .sld_member_left_nav {
  145. float: left;
  146. width: 240px;
  147. color: #666;
  148. font-size: 12px;
  149. /*font-family: MicrosoftYaHei;*/
  150. background-color: #fff;
  151. border: 1px solid #ebebeb;
  152. border-top: 1px solid #fff;
  153. margin-top: -1px;
  154. margin-bottom: 20px;
  155. padding-bottom: 40px;
  156. .menu {
  157. display: block;
  158. color: #333333;
  159. font-size: 16px;
  160. /*font-family: Microsoft YaHei;*/
  161. font-weight: bold;
  162. margin-top: 15px;
  163. margin-bottom: 10px;
  164. padding-left: 15px;
  165. padding-top: 22px;
  166. border-top: 1px solid #ebebeb;
  167. &:nth-child(1) {
  168. margin-top: 0;
  169. border-top: none;
  170. }
  171. i {
  172. color: #888;
  173. font-size: 16px;
  174. font-weight: 400;
  175. margin-right: 5px;
  176. }
  177. }
  178. .submenu {
  179. display: block;
  180. line-height: 30px;
  181. color: #777777;
  182. font-size: 14px;
  183. /*font-family: Microsoft YaHei;*/
  184. font-weight: 400;
  185. padding-left: 41px;
  186. &:hover {
  187. font-weight: bold;
  188. color: $colorMain2;
  189. }
  190. &.cur_code_active {
  191. font-weight: bold;
  192. color: $colorMain2;
  193. }
  194. }
  195. }
  196. </style>