NavTopBar.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  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">
  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 } 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 L = lang_zn;
  85. const filtersStore = useFiltersStore();
  86. const loginFlag = filtersStore.getLoginFlag;
  87. const memberInfo = filtersStore.getMemberInfo;
  88. const L = getCurLanguage();
  89. // 获取系统配置信息
  90. const configInfo = reactive({ data: {} });
  91. const getSystemConfigInfo = async () => {
  92. const { data: value } = await useFetchRaw(
  93. apiUrl + "v3/system/front/setting/getSettings",
  94. {
  95. params: {
  96. names:
  97. "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",
  98. },
  99. }
  100. );
  101. let res = value._rawValue;
  102. if (res.state) {
  103. filtersStore.setSiteLogo(res.data[0]);
  104. configInfo.data = {
  105. main_site_logo: res.data[0],
  106. main_user_center_logo: res.data[1],
  107. main_user_logon_bg: res.data[2],
  108. main_user_register_bg: res.data[3],
  109. pc_home_bottom_adv: res.data[4],
  110. main_user_forget_password_bg: res.data[5],
  111. basic_site_name: res.data[6],
  112. basic_site_icp: res.data[7],
  113. basic_site_copyright: res.data[8],
  114. basic_site_technical_support: res.data[9],
  115. platform_customer_service_name: res.data[10],
  116. platform_customer_service_logo: res.data[11],
  117. };
  118. }
  119. };
  120. getSystemConfigInfo();
  121. //前往具体的页面,type为具体的页面地址,param为参数对象
  122. const goToByPush = (type, param = {}) => {
  123. router.push({
  124. path: type,
  125. query: param,
  126. });
  127. };
  128. //退出登录
  129. const loginOut = async () => {
  130. filtersStore.setMemberInfo({});
  131. filtersStore.setLoginStatus(false);
  132. filtersStore.setToken("");
  133. filtersStore.setRefreshToken("");
  134. filtersStore.setTime(new Date().getTime().toString()); //存储refresh_token更新时间
  135. window.location.reload();
  136. };
  137. </script>
  138. <style >
  139. .goog-te-gadget-simple{
  140. white-space: nowrap!important;
  141. border: none!important;
  142. padding: 0!important;
  143. background-color: transparent!important;
  144. line-height: 1;
  145. }
  146. </style>
  147. <style lang="scss" scoped>
  148. $colorMain: #e2231a !default; //主色、文字选中、搜索
  149. .header_wrap {
  150. width: 100%;
  151. height: 33px;
  152. background: #f7f7f7;
  153. display: flex;
  154. align-items: center;
  155. justify-content: center;
  156. .header {
  157. width: 1210px;
  158. height: 33px;
  159. display: flex;
  160. justify-content: space-between;
  161. align-items: center;
  162. .header_left {
  163. height: 100%;
  164. font-size: 13px;
  165. color: #333;
  166. line-height: 36px;
  167. display: flex;
  168. .hello {
  169. margin-right: 20px;
  170. color: #333;
  171. }
  172. .h1 {
  173. margin: 0 5px;
  174. cursor: pointer;
  175. &:hover {
  176. color: $colorMain;
  177. }
  178. }
  179. }
  180. .header_right {
  181. height: 100%;
  182. ul {
  183. width: 100%;
  184. height: 100%;
  185. display: flex;
  186. align-items: center;
  187. .personal_center {
  188. width: 121px;
  189. height: 30px;
  190. display: flex;
  191. align-items: center;
  192. justify-content: center;
  193. }
  194. li {
  195. float: left;
  196. text-align: center;
  197. border-right: 1px solid #ddd;
  198. padding: 0 10px;
  199. height: 33px;
  200. line-height: 33px;
  201. .li_item {
  202. position: relative;
  203. cursor: pointer;
  204. font-size: 13px;
  205. color: #333;
  206. &:hover {
  207. color: $colorMain;
  208. &.has_more {
  209. &:before {
  210. border-top-color: $colorMain;
  211. }
  212. }
  213. .li_item_more {
  214. display: block;
  215. }
  216. }
  217. &.has_more {
  218. padding-right: 12px;
  219. &:before,
  220. &:after {
  221. position: absolute;
  222. right: -2px;
  223. display: block;
  224. width: 0;
  225. height: 0;
  226. content: " ";
  227. border: 4px solid transparent;
  228. border-radius: 2px;
  229. }
  230. &:before {
  231. top: 16px;
  232. border-top: 5px solid #888;
  233. }
  234. &:after {
  235. top: 14px;
  236. border-top: 5px solid #f7f7f7;
  237. }
  238. }
  239. .li_item_more {
  240. position: absolute;
  241. width: 120px;
  242. padding: 5px 3px;
  243. left: 50%;
  244. transform: translateX(-50%);
  245. top: 21px;
  246. background: #fff;
  247. box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
  248. z-index: 999;
  249. display: none;
  250. &:before,
  251. &:after {
  252. position: absolute;
  253. top: -11px;
  254. left: 50%;
  255. transform: translateX(-50%);
  256. -webkit-transform: translateX(-50%);
  257. display: block;
  258. content: " ";
  259. width: 0;
  260. height: 0;
  261. border: 5px solid transparent;
  262. border-bottom: 6px solid #dedede;
  263. }
  264. &:after {
  265. top: -10px;
  266. border-bottom: 6px solid #fff;
  267. }
  268. .li_item_more_item {
  269. display: block;
  270. text-align: center;
  271. color: #333;
  272. line-height: 12px;
  273. padding: 8px 0;
  274. &:hover {
  275. color: $colorMain;
  276. }
  277. }
  278. }
  279. }
  280. &:last-child {
  281. border-right-width: 0;
  282. padding-right: 0;
  283. }
  284. }
  285. }
  286. }
  287. }
  288. }
  289. </style>