Skip to content

Commit 78235ab

Browse files
authored
Merge pull request #25 from ZyqGitHub1/dev
启用新ui
2 parents c07389c + 06cd424 commit 78235ab

File tree

9 files changed

+444
-121
lines changed

9 files changed

+444
-121
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ module.exports = {
4343
'import/no-extraneous-dependencies': 'off',
4444
'import/prefer-default-export': 'off',
4545
'prefer-promise-reject-errors': 'off',
46+
'max-len': 'off',
4647

4748
// allow console.log during development only
4849
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',

quasar.conf.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ module.exports = function (ctx) {
6464
'QSeparator',
6565
'QChip',
6666
'QTooltip',
67+
'QBar',
68+
'QSpace',
69+
// table
70+
'QTable',
71+
'QTh',
72+
'QTr',
73+
'QTd',
74+
'QExpansionItem',
6775
],
6876

6977
directives: ['Ripple'],
@@ -73,8 +81,8 @@ module.exports = function (ctx) {
7381
config: {
7482
loadingBar: {
7583
color: 'purple',
76-
size: '10px',
77-
position: 'top',
84+
size: '5px',
85+
position: 'bottom',
7886
skipHijack: true,
7987
},
8088
},

src-electron/main-process/electron-main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ function createWindow() {
2222
width: 1000,
2323
height: 600,
2424
useContentSize: true,
25+
frame: false,
2526
webPreferences: {
2627
nodeIntegration: true,
2728
webSecurity: false,

src/components/scrollWarp.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<template>
2+
<div style="flex: auto" class="scroll-warp">
3+
<slot></slot>
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
name: 'ScrollWarp',
10+
};
11+
</script>
12+
13+
<style>
14+
</style>

src/components/viewArea.vue

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<template>
2+
<div :style="style">
3+
<slot></slot>
4+
</div>
5+
</template>
6+
7+
<script>
8+
import { dom, throttle } from 'quasar';
9+
10+
const { height } = dom;
11+
export default {
12+
name: 'viewArea',
13+
data() {
14+
return {
15+
style: {
16+
height: '0',
17+
},
18+
};
19+
},
20+
mounted() {
21+
this.setViewAreaHeight();
22+
this.$nextTick(() => {
23+
const config = {
24+
attributes: true,
25+
};
26+
this.observer = new MutationObserver(throttle(this.setViewAreaHeight, 500));
27+
this.observer.observe(document.querySelector('.q-page'), config);
28+
});
29+
},
30+
methods: {
31+
setViewAreaHeight() {
32+
const scrollWarpElement = document.querySelector('.scroll-warp');
33+
const viewAreaHeight = height(scrollWarpElement);
34+
this.style.height = `${viewAreaHeight}px`;
35+
},
36+
},
37+
};
38+
</script>
39+
40+
<style>
41+
</style>

src/layouts/Home.vue

Lines changed: 67 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,43 @@
77
elevated
88
class="bg-primary text-white"
99
>
10+
<q-bar class="q-electron-drag">
11+
<q-avatar
12+
square
13+
color="orange"
14+
>H</q-avatar>
15+
<div>H-PLAYER</div>
16+
17+
<q-space />
18+
19+
<q-btn
20+
dense
21+
flat
22+
round
23+
icon="settings"
24+
@click="right = !right"
25+
/>
26+
27+
<q-btn
28+
dense
29+
flat
30+
icon="minimize"
31+
@click="minimize"
32+
/>
33+
<q-btn
34+
dense
35+
flat
36+
icon="crop_square"
37+
@click="maximize"
38+
/>
39+
<q-btn
40+
dense
41+
flat
42+
icon="close"
43+
@click="closeApp"
44+
/>
45+
</q-bar>
46+
1047
<q-toolbar>
1148
<q-btn
1249
dense
@@ -16,20 +53,14 @@
1653
@click="left = !left"
1754
/>
1855

19-
<q-toolbar-title>
20-
<q-avatar
21-
square
22-
size="24px"
23-
color="orange"
24-
>H</q-avatar>
25-
</q-toolbar-title>
56+
<q-space></q-space>
2657

2758
<q-btn
2859
dense
2960
flat
3061
round
31-
icon="settings"
32-
@click="right = !right"
62+
icon="search"
63+
@click="left = !left"
3364
/>
3465
</q-toolbar>
3566

@@ -288,6 +319,29 @@ export default {
288319
this.$electronStore.clear();
289320
this.$router.replace('/import');
290321
},
322+
minimize() {
323+
if (process.env.MODE === 'electron') {
324+
this.$q.electron.remote.BrowserWindow.getFocusedWindow().minimize();
325+
}
326+
},
327+
328+
maximize() {
329+
if (process.env.MODE === 'electron') {
330+
const win = this.$q.electron.remote.BrowserWindow.getFocusedWindow();
331+
332+
if (win.isMaximized()) {
333+
win.unmaximize();
334+
} else {
335+
win.maximize();
336+
}
337+
}
338+
},
339+
340+
closeApp() {
341+
if (process.env.MODE === 'electron') {
342+
this.$q.electron.remote.BrowserWindow.getFocusedWindow().close();
343+
}
344+
},
291345
},
292346
computed: {
293347
...mapGetters(['currentSite']),
@@ -317,15 +371,14 @@ export default {
317371
</script>
318372

319373
<style lang="stylus">
320-
.q-layout, .q-page {
321-
min-height: inherit !important;
322-
}
323-
374+
// .q-layout, .q-page {
375+
// min-height: inherit !important;
376+
// }
324377
.serch {
325378
margin-top: 24px;
326379
}
327380
328381
.class-list {
329-
height: calc(100% - 100px)
382+
height: calc(100% - 100px);
330383
}
331384
</style>

src/layouts/Import.vue

Lines changed: 59 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,42 @@
22
<q-layout view="hHh Lpr fFf">
33
<!-- (Optional) The Header -->
44
<q-header elevated>
5-
<q-toolbar>
6-
<q-toolbar-title>
7-
<q-avatar
8-
square
9-
size="24px"
10-
color="orange"
11-
>H</q-avatar>
12-
</q-toolbar-title>
13-
</q-toolbar>
5+
<q-bar class="q-electron-drag">
6+
<q-avatar
7+
square
8+
color="orange"
9+
>H</q-avatar>
10+
<div>H-PLAYER</div>
11+
12+
<q-space />
13+
14+
<q-btn
15+
dense
16+
flat
17+
round
18+
icon="settings"
19+
@click="right = !right"
20+
/>
21+
22+
<q-btn
23+
dense
24+
flat
25+
icon="minimize"
26+
@click="minimize"
27+
/>
28+
<q-btn
29+
dense
30+
flat
31+
icon="crop_square"
32+
@click="maximize"
33+
/>
34+
<q-btn
35+
dense
36+
flat
37+
icon="close"
38+
@click="closeApp"
39+
/>
40+
</q-bar>
1441
</q-header>
1542
<!-- (Optional) The Footer -->
1643
<q-footer>
@@ -80,6 +107,29 @@ export default {
80107
this.$router.push('/');
81108
}
82109
},
110+
minimize() {
111+
if (process.env.MODE === 'electron') {
112+
this.$q.electron.remote.BrowserWindow.getFocusedWindow().minimize();
113+
}
114+
},
115+
116+
maximize() {
117+
if (process.env.MODE === 'electron') {
118+
const win = this.$q.electron.remote.BrowserWindow.getFocusedWindow();
119+
120+
if (win.isMaximized()) {
121+
win.unmaximize();
122+
} else {
123+
win.maximize();
124+
}
125+
}
126+
},
127+
128+
closeApp() {
129+
if (process.env.MODE === 'electron') {
130+
this.$q.electron.remote.BrowserWindow.getFocusedWindow().close();
131+
}
132+
},
83133
},
84134
};
85135
</script>

0 commit comments

Comments
 (0)