Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
hager
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2024-10-25 15:43:53 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b83412d7db81adaee61f986693561181cc988023
b83412d7
1 parent
38384ca2
头部组件显示登录状态接口联调
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
7 deletions
src/components/common/hagerHeader.vue
src/components/common/hagerHeader.vue
View file @
b83412d
<!--
* @Date: 2024-09-26 13:42:11
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-10-2
4 14:34:58
* @LastEditTime: 2024-10-2
5 14:21:41
* @FilePath: /hager/src/components/common/hagerHeader.vue
* @Description: 文件描述
-->
...
...
@@ -138,7 +138,7 @@ import mixin from 'common/mixin';
import { parseQueryString } from '@/utils/tools';
import $ from 'jquery';
import hagerMenu from '../hagerMenu.vue';
import { getProductCateAPI } from "@/api/hager.js";
import { getProductCateAPI
, getUserInfoAPI
} from "@/api/hager.js";
export default {
components: { hagerMenu },
...
...
@@ -154,7 +154,7 @@ export default {
margin_top: 0,
// choose_country: false, // 主动选择了国家地区
keyword: '',
is_login:
tru
e,
is_login:
fals
e,
show_border: false,
}
},
...
...
@@ -171,6 +171,8 @@ export default {
} else {
this.show_border = false;
}
// 检查登录状态
this.getUserInfo();
},
'is_xs' (val) {
if (!val) {
...
...
@@ -190,7 +192,8 @@ export default {
// 修改数据结构显示
this.product_info = this.splitProductList(this.product_info);
}
//
// 获取用户信息
this.getUserInfo();
// let margin_top = 5; // 默认高度
// let once_header_height = 5; // 选择国家地区高度
// // let hidden_header_height = 2; // 可隐藏高度s
...
...
@@ -215,6 +218,16 @@ export default {
},
methods: {
async getUserInfo () {
const { code, data } = await getUserInfoAPI();
if (code) {
if (data) {
this.is_login = true; // 已登录
} else {
this.is_login = false; // 未登录
}
}
},
splitProductList (products) {
const maxLength = 5; // 超过5个需要拆分
let result = [];
...
...
@@ -328,9 +341,15 @@ export default {
window.open('https://hager.com/', '_blank')
},
goToLogin () {
this.$router.push({
path: '/user/login'
});
if (this.is_login) {
this.$router.push({
path: '/user/info'
});
} else {
this.$router.push({
path: '/user/login'
});
}
},
openMenu () {
this.show_menu = !this.show_menu;
...
...
Please
register
or
login
to post a comment