Skip to content

Commit 725596a

Browse files
committed
optimize the display
1 parent d9b2a87 commit 725596a

File tree

4 files changed

+33
-19
lines changed

4 files changed

+33
-19
lines changed

web/src/js/module/header/index.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,4 +235,10 @@
235235
color: $primary-color;
236236
}
237237
}
238+
239+
.workspace-title {
240+
display: inline-flex;
241+
width: 100px;
242+
overflow: hidden;
243+
}
238244
}

web/src/js/module/header/index.vue

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
<div
55
class="layout-header-menu-icon"
66
@click="goHome"
7-
@mouseleave="mouseleave"
8-
@mouseover="mouseover">
9-
<div style="margin-top:5px; display:inline-block;">
7+
>
8+
<div style="margin-top:5px; display:inline-block;"
9+
@mouseleave="mouseleave"
10+
@mouseover="mouseover">
1011
<svg t="1572957725118" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1115" width="20" height="20">
1112
<path d="M896 1024h-213.333333a128 128 0 0 1-128-128v-213.333333a128 128 0 0 1 128-128h213.333333a128 128 0 0 1 128 128v213.333333a128 128 0 0 1-128 128z m-213.333333-384a42.666667 42.666667 0 0 0-42.666667 42.666667v213.333333a42.666667 42.666667 0 0 0 42.666667 42.666667h213.333333a42.666667 42.666667 0 0 0 42.666667-42.666667v-213.333333a42.666667 42.666667 0 0 0-42.666667-42.666667z m-341.333334 384H128a128 128 0 0 1-128-128v-213.333333a128 128 0 0 1 128-128h213.333333a128 128 0 0 1 128 128v213.333333a128 128 0 0 1-128 128z m-213.333333-384a42.666667 42.666667 0 0 0-42.666667 42.666667v213.333333a42.666667 42.666667 0 0 0 42.666667 42.666667h213.333333a42.666667 42.666667 0 0 0 42.666667-42.666667v-213.333333a42.666667 42.666667 0 0 0-42.666667-42.666667z m768-170.666667h-213.333333a128 128 0 0 1-128-128V128a128 128 0 0 1 128-128h213.333333a128 128 0 0 1 128 128v213.333333a128 128 0 0 1-128 128z m-213.333333-384a42.666667 42.666667 0 0 0-42.666667 42.666667v213.333333a42.666667 42.666667 0 0 0 42.666667 42.666667h213.333333a42.666667 42.666667 0 0 0 42.666667-42.666667V128a42.666667 42.666667 0 0 0-42.666667-42.666667z m-341.333334 384H128a128 128 0 0 1-128-128V128a128 128 0 0 1 128-128h213.333333a128 128 0 0 1 128 128v213.333333a128 128 0 0 1-128 128zM128 85.333333a42.666667 42.666667 0 0 0-42.666667 42.666667v213.333333a42.666667 42.666667 0 0 0 42.666667 42.666667h213.333333a42.666667 42.666667 0 0 0 42.666667-42.666667V128a42.666667 42.666667 0 0 0-42.666667-42.666667z" p-id="1116" fill="#00FFFF">
1213
</path>
@@ -22,7 +23,7 @@
2223
</div>
2324
</div>
2425

25-
<workspaceMenu v-if="$route.path.indexOf('workspace')!==-1" :projectList="workspaces" :currentId="parseInt($route.query.workspaceId, 10)" :changeWorkSpace="changeWorkspace"></workspaceMenu>
26+
<workspaceMenu v-if="isShowWorkspaceMenu" :projectList="workspaces" :currentId="parseInt($route.query.workspaceId, 10)" :changeWorkSpace="changeWorkspace"></workspaceMenu>
2627
<span
2728
v-if="currentProject.id"
2829
class="proj-select"
@@ -51,7 +52,7 @@
5152
</div>
5253
</DropdownMenu>
5354
</Dropdown>
54-
<ul v-if="$route.path.indexOf('workspace')!==-1" class="menu">
55+
<ul v-if="$route.query&&$route.query.workspaceId" class="menu">
5556
<li class="menu-item" @click="goSpaceHome">首页</li>
5657
<li class="menu-item" @click="goConsole">控制台</li>
5758
</ul>
@@ -156,9 +157,16 @@ export default {
156157
'$route'(newValue) {
157158
this.projectID = newValue.query.projectID;
158159
this.getCurrentProject();
160+
this.getWorkSpace();
159161
}
160162
},
161163
methods: {
164+
isShowWorkspaceMenu(){
165+
return (!this.currentProject.id && this.isShowHomeNav());
166+
},
167+
isShowHomeNav(){
168+
return (this.$route.query && this.$route.query.workspaceId|| this.$route.path.indexOf('workspace')!==-1);
169+
},
162170
init() {
163171
api.fetch('/dss/getBaseInfo', 'get').then((rst) => {
164172
if (!isEmpty(rst)) {
@@ -170,14 +178,15 @@ export default {
170178
171179
this.$emit('set-init');
172180
}
173-
api.fetch(`/dss/workspaces`, 'get').then(rst=>{
174-
if (!isEmpty(rst)) {
175-
this.workspaces = rst.workspaces;
176-
}
177-
})
181+
this.getWorkSpace();
178182
});
179-
180-
183+
},
184+
getWorkSpace(){
185+
api.fetch(`/dss/workspaces`, 'get').then(rst=>{
186+
if (!isEmpty(rst)) {
187+
this.workspaces = rst.workspaces;
188+
}
189+
})
181190
},
182191
goto(name) {
183192
this.$router.push({
@@ -265,15 +274,13 @@ export default {
265274
}, 500);
266275
},
267276
goSpaceHome(){
268-
console.log('workspaceId', this.$route.query.workspaceId)
269-
this.$router.push({path: '/home',query: Object.assign({}, this.$route.query)});
277+
this.$router.push({path: '/workspace',query: Object.assign({}, this.$route.query)});
270278
},
271279
goConsole(){
272-
console.log('workspaceId', this.$route.query.workspaceId)
273280
this.$router.push({path: '/console',query: Object.assign({}, this.$route.query)});
274281
},
275282
changeWorkspace(data){
276-
this.$router.push({path: '/workspace',query: Object.assign({}, this.$route.query, {workspaceId: data.id})});
283+
this.$router.push({query: Object.assign({}, this.$route.query, {workspaceId: data.id})});
277284
}
278285
},
279286
};

web/src/js/module/header/workspaceMenu.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<span>
2+
<span v-if="currentProject.id">
33
<span
44
class="proj-select"
55
>
@@ -10,7 +10,7 @@
1010
placement="bottom-start"
1111
>
1212
<div style="font-size:14px">
13-
{{ currentProject.name }}
13+
<p class="workspace-title">{{ currentProject.name }}</p>
1414
<Icon type="ios-arrow-down" style="margin-left: 5px"></Icon>
1515
</div>
1616
<DropdownMenu slot="list" class="proj-list">

web/src/js/view/newhome/module/workspace/index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ export default {
218218
this.changePage(this.pageNum);
219219
},
220220
gotoWorkspace(workspace) {
221-
this.$router.push({ path: '/workspace', query: { workspaceId: workspace.id }});
221+
const workspaceId = workspace.workspaceId || workspace.id;
222+
this.$router.push({ path: '/workspace', query: { workspaceId: workspaceId}});
222223
},
223224
workspaceShowAction(val) {
224225
this.workspaceShow = val;

0 commit comments

Comments
 (0)