NavTopBar.vue 8.7 KB

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