NavTopBar.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. // 头部登陆注册导航栏
  2. <template>
  3. <div class="header_wrap">
  4. <div class="header">
  5. <div class="header_left">
  6. <span class="hello">
  7. <!-- {{ L["您好,欢迎来到"] }}-->
  8. {{ configInfo.data.basic_site_name }}
  9. </span>
  10. <div v-show="loginFlag">
  11. <span class="register h1" @click="goToByPush('/member/home')" style="font-weight:bold;color:#444;" >{{
  12. memberInfo.memberNickName || memberInfo.memberName
  13. }}</span>
  14. <span class="register h1 login_out" @click="loginOut()"
  15. >[{{ L["退出"] }}]</span
  16. >
  17. </div>
  18. <div v-show="!loginFlag && !isRegisterStatus">
  19. <span class="register h1" @click="goToByPush('/login')" style="border-right: 1px solid #c1c1c1; padding-right: 15px;">{{
  20. L["登录"]
  21. }}</span>
  22. <span class="register h1" @click="goToByPush('/register')">{{
  23. L["注册"]
  24. }}</span>
  25. </div>
  26. </div>
  27. <div class="header_right">
  28. <ul>
  29. <li >
  30. <Nuxt-link to="/">
  31. <div class="li_item">{{ L["商城首页"] }}</div>
  32. </Nuxt-link>
  33. </li>
  34. <li @click="goToByPush('/member/home')">
  35. <div class="li_item">{{ L["个人中心"] }}</div>
  36. </li>
  37. <li>
  38. <div class="has_more li_item">
  39. {{ L["我的收藏"] }}
  40. <div class="li_item_more">
  41. <a
  42. href="javascript:void(0)"
  43. class="li_item_more_item"
  44. @click="goToByPush('/member/collect')"
  45. >{{ L["商品收藏"] }}</a
  46. >
  47. <a
  48. href="javascript:void(0)"
  49. class="li_item_more_item"
  50. @click="goToByPush('/member/collect', { type: 'store' })"
  51. >{{ L["店铺收藏"] }}</a
  52. >
  53. <a
  54. href="javascript:void(0)"
  55. class="li_item_more_item"
  56. @click="goToByPush('/member/footprint')"
  57. >{{ L["我的足迹"] }}</a
  58. >
  59. </div>
  60. </div>
  61. </li>
  62. <!-- <li @click="goToByPush('/service', { vid: 0 })">
  63. <div class="li_item">官方客服</div>
  64. </li> -->
  65. <li @click="goToByPush('/article')">
  66. <div class="li_item">{{ L["服务中心"] }}</div>
  67. </li>
  68. <li>
  69. <div class="li_item">
  70. <div id=google_translate_element></div>
  71. </div>
  72. </li>
  73. </ul>
  74. </div>
  75. </div>
  76. </div>
  77. </template>
  78. <script setup>
  79. import { reactive, computed } from "vue";
  80. // import { lang_zn } from "@/assets/language/zh";
  81. import { useFiltersStore } from "@/store/filter.js";
  82. import { getCurLanguage } from "@/composables/common.js";
  83. const router = useRouter();
  84. const route = useRoute()
  85. // const L = lang_zn;
  86. const filtersStore = useFiltersStore();
  87. const loginFlag = computed(() => filtersStore.getLoginFlag)
  88. const memberInfo = computed(() => filtersStore.getMemberInfo);
  89. const L = getCurLanguage();
  90. // 判断当前页面是否为注册页面
  91. const isRegisterStatus = computed(() => route.name === 'register')
  92. // 获取系统配置信息
  93. const configInfo = reactive({ data: {} });
  94. const getSystemConfigInfo = async () => {
  95. const { data: value } = await useFetchRaw(
  96. apiUrl + "v3/system/front/setting/getSettings",
  97. {
  98. params: {
  99. names:
  100. "main_site_logo,main_user_center_logo,main_user_logon_bg,main_user_register_bg,pc_home_bottom_adv,main_user_forget_password_bg,basic_site_name,basic_site_icp,basic_site_copyright,basic_site_technical_support,platform_customer_service_name,platform_customer_service_logo,sys_seo_title,sys_seo_desc,sys_seo_keywords,pt_map_parameter",
  101. },
  102. }
  103. );
  104. let res = value._rawValue;
  105. if (res.state) {
  106. filtersStore.setSiteLogo(res.data[0]);
  107. configInfo.data = {
  108. main_site_logo: res.data[0],
  109. main_user_center_logo: res.data[1],
  110. main_user_logon_bg: res.data[2],
  111. main_user_register_bg: res.data[3],
  112. pc_home_bottom_adv: res.data[4],
  113. main_user_forget_password_bg: res.data[5],
  114. basic_site_name: res.data[6],
  115. basic_site_icp: res.data[7],
  116. basic_site_copyright: res.data[8],
  117. basic_site_technical_support: res.data[9],
  118. platform_customer_service_name: res.data[10],
  119. platform_customer_service_logo: res.data[11],
  120. };
  121. }
  122. };
  123. getSystemConfigInfo();
  124. //前往具体的页面,type为具体的页面地址,param为参数对象
  125. const goToByPush = (type, param = {}) => {
  126. router.push({
  127. path: type,
  128. query: param,
  129. });
  130. };
  131. //退出登录
  132. const loginOut = async () => {
  133. filtersStore.setMemberInfo({});
  134. filtersStore.setLoginStatus(false);
  135. filtersStore.setToken("");
  136. filtersStore.setRefreshToken("");
  137. filtersStore.setTime(new Date().getTime().toString()); //存储refresh_token更新时间
  138. sessionStorage.setItem('noRefresh', 'true')
  139. localStorage.setItem('isLoggedIn', 'false');
  140. // window.location.reload();
  141. };
  142. </script>
  143. <style >
  144. .goog-te-gadget-simple{
  145. white-space: nowrap!important;
  146. border: none!important;
  147. padding: 0!important;
  148. background-color: transparent!important;
  149. line-height: 1;
  150. }
  151. </style>
  152. <style lang="scss" scoped>
  153. $colorMain: #e2231a !default; //主色、文字选中、搜索
  154. .header_wrap {
  155. width: 100%;
  156. height: 33px;
  157. background: #f7f7f7;
  158. display: flex;
  159. align-items: center;
  160. justify-content: center;
  161. .header {
  162. width: 1210px;
  163. height: 33px;
  164. display: flex;
  165. justify-content: space-between;
  166. align-items: center;
  167. .header_left {
  168. height: 100%;
  169. font-size: 13px;
  170. color: #333;
  171. line-height: 36px;
  172. display: flex;
  173. .hello {
  174. margin-right: 20px;
  175. color: #333;
  176. }
  177. .h1 {
  178. margin: 0 5px;
  179. cursor: pointer;
  180. &:hover {
  181. color: $colorMain;
  182. }
  183. }
  184. }
  185. .header_right {
  186. height: 100%;
  187. ul {
  188. width: 100%;
  189. height: 100%;
  190. display: flex;
  191. align-items: center;
  192. .personal_center {
  193. width: 121px;
  194. height: 30px;
  195. display: flex;
  196. align-items: center;
  197. justify-content: center;
  198. }
  199. li {
  200. float: left;
  201. text-align: center;
  202. border-right: 1px solid #ddd;
  203. padding: 0 10px;
  204. height: 33px;
  205. line-height: 33px;
  206. .li_item {
  207. position: relative;
  208. cursor: pointer;
  209. font-size: 13px;
  210. color: #333;
  211. &:hover {
  212. color: $colorMain;
  213. &.has_more {
  214. &:before {
  215. border-top-color: $colorMain;
  216. }
  217. }
  218. .li_item_more {
  219. display: block;
  220. }
  221. }
  222. &.has_more {
  223. padding-right: 12px;
  224. &:before,
  225. &:after {
  226. position: absolute;
  227. right: -2px;
  228. display: block;
  229. width: 0;
  230. height: 0;
  231. content: " ";
  232. border: 4px solid transparent;
  233. border-radius: 2px;
  234. }
  235. &:before {
  236. top: 16px;
  237. border-top: 5px solid #888;
  238. }
  239. &:after {
  240. top: 14px;
  241. border-top: 5px solid #f7f7f7;
  242. }
  243. }
  244. .li_item_more {
  245. position: absolute;
  246. width: 120px;
  247. padding: 5px 3px;
  248. left: 50%;
  249. transform: translateX(-50%);
  250. top: 21px;
  251. background: #fff;
  252. box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
  253. z-index: 999;
  254. display: none;
  255. &:before,
  256. &:after {
  257. position: absolute;
  258. top: -11px;
  259. left: 50%;
  260. transform: translateX(-50%);
  261. -webkit-transform: translateX(-50%);
  262. display: block;
  263. content: " ";
  264. width: 0;
  265. height: 0;
  266. border: 5px solid transparent;
  267. border-bottom: 6px solid #dedede;
  268. }
  269. &:after {
  270. top: -10px;
  271. border-bottom: 6px solid #fff;
  272. }
  273. .li_item_more_item {
  274. display: block;
  275. text-align: center;
  276. color: #333;
  277. line-height: 12px;
  278. padding: 8px 0;
  279. &:hover {
  280. color: $colorMain;
  281. }
  282. }
  283. }
  284. }
  285. &:last-child {
  286. border-right-width: 0;
  287. padding-right: 0;
  288. }
  289. }
  290. }
  291. }
  292. }
  293. }
  294. </style>