NavTopBar.vue 9.3 KB

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