NavTopBar.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  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. let url = supplierUrl;
  138. window.open(url, '_blank');
  139. };
  140. //退出登录
  141. const loginOut = async () => {
  142. filtersStore.setMemberInfo({});
  143. filtersStore.setLoginStatus(false);
  144. filtersStore.setToken("");
  145. filtersStore.setRefreshToken("");
  146. filtersStore.setTime(new Date().getTime().toString()); //存储refresh_token更新时间
  147. localStorage.setItem('isLoggedIn', 'false');
  148. setTimeout(() => {
  149. localStorage.removeItem('isLoggedIn');
  150. window.location.reload();
  151. }, 200)
  152. };
  153. </script>
  154. <style >
  155. .goog-te-gadget-simple{
  156. white-space: nowrap!important;
  157. border: none!important;
  158. padding: 0!important;
  159. background-color: transparent!important;
  160. line-height: 1;
  161. }
  162. </style>
  163. <style lang="scss" scoped>
  164. $colorMain: #e2231a !default; //主色、文字选中、搜索
  165. .header_wrap {
  166. width: 100%;
  167. height: 33px;
  168. background-color: #fff;
  169. display: flex;
  170. align-items: center;
  171. justify-content: center;
  172. .header {
  173. width: 1210px;
  174. height: 33px;
  175. display: flex;
  176. justify-content: space-between;
  177. align-items: center;
  178. .header_left {
  179. height: 100%;
  180. font-weight: bold;
  181. font-size: 16px;
  182. color: #282E30;
  183. line-height: 36px;
  184. display: flex;
  185. .hello {
  186. margin-right: 20px;
  187. }
  188. .h1 {
  189. margin: 0 5px;
  190. padding: 5px 10px;
  191. cursor: pointer;
  192. &:hover {
  193. background: $colorMain;
  194. color: #fff;
  195. }
  196. }
  197. }
  198. .header_right {
  199. height: 100%;
  200. font-weight: 400;
  201. font-size: 16px;
  202. color: #282E30;
  203. ul {
  204. width: 100%;
  205. height: 100%;
  206. display: flex;
  207. align-items: center;
  208. .personal_center {
  209. width: 121px;
  210. height: 30px;
  211. display: flex;
  212. align-items: center;
  213. justify-content: center;
  214. }
  215. li {
  216. float: left;
  217. text-align: center;
  218. border-right: 1px solid #ddd;
  219. padding: 0 10px;
  220. height: 33px;
  221. line-height: 33px;
  222. .li_item {
  223. position: relative;
  224. cursor: pointer;
  225. font-weight: 400;
  226. font-size: 16px;
  227. color: #282E30;
  228. &:hover {
  229. color: $colorMain;
  230. &.has_more {
  231. &:before {
  232. border-top-color: $colorMain;
  233. }
  234. }
  235. .li_item_more {
  236. display: block;
  237. }
  238. }
  239. &.has_more {
  240. padding-right: 12px;
  241. &:before,
  242. &:after {
  243. position: absolute;
  244. right: -2px;
  245. display: block;
  246. width: 0;
  247. height: 0;
  248. content: " ";
  249. border: 4px solid transparent;
  250. border-radius: 2px;
  251. }
  252. &:before {
  253. top: 16px;
  254. border-top: 5px solid #888;
  255. }
  256. &:after {
  257. top: 14px;
  258. border-top: 5px solid #f7f7f7;
  259. }
  260. }
  261. .li_item_more {
  262. position: absolute;
  263. width: 120px;
  264. padding: 5px 3px;
  265. left: 50%;
  266. transform: translateX(-50%);
  267. top: 21px;
  268. background: #fff;
  269. box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
  270. z-index: 999;
  271. display: none;
  272. &:before,
  273. &:after {
  274. position: absolute;
  275. top: -11px;
  276. left: 50%;
  277. transform: translateX(-50%);
  278. -webkit-transform: translateX(-50%);
  279. display: block;
  280. content: " ";
  281. width: 0;
  282. height: 0;
  283. border: 5px solid transparent;
  284. border-bottom: 6px solid #dedede;
  285. }
  286. &:after {
  287. top: -10px;
  288. border-bottom: 6px solid #fff;
  289. }
  290. .li_item_more_item {
  291. display: block;
  292. text-align: center;
  293. color: #333;
  294. line-height: 12px;
  295. padding: 8px 0;
  296. &:hover {
  297. color: $colorMain;
  298. }
  299. }
  300. }
  301. }
  302. &:last-child {
  303. border-right-width: 0;
  304. padding-right: 0;
  305. }
  306. }
  307. }
  308. }
  309. }
  310. }
  311. </style>