Skip to content

Commit

Permalink
fix: minor bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
cern committed Apr 25, 2023
1 parent 66e97b8 commit 0821faf
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 19 deletions.
5 changes: 5 additions & 0 deletions middleware/redirect-to-song.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default ({ $axios, store, redirect }) => {
if (!store.state.user.userTatus) {
redirect('/song')
}
}
14 changes: 6 additions & 8 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ export default {
{ hid: 'description', name: 'description', content: '' },
{ name: 'format-detection', content: 'telephone=no' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }]
},

// Global CSS: https://go.nuxtjs.dev/config-css
css: [
'ant-design-vue/dist/antd.css'
],
css: ['ant-design-vue/dist/antd.css'],

router: {
},

// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
Expand Down Expand Up @@ -55,8 +54,7 @@ export default {
},

// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
},
build: {},
env: {
NODE_ENV: env[process.env.NODE_ENV].NODE_ENV,
API_URL: env[process.env.NODE_ENV].API_URL
Expand Down
21 changes: 15 additions & 6 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<div class="cotent-search">
<div>
<a-select
class="cotent-search-select"
:default-value="selectionDefaultValue"
style="width: 120px"
@change="handleChange"
>
<a-select-option value="all">
Expand All @@ -47,8 +47,8 @@
</div>
<a-input-search
v-model="inputVal"
class="cotent-search-search"
placeholder="请输入歌名"
style="width: 200px"
@search="onSearch"
/>
</div>
Expand Down Expand Up @@ -100,7 +100,9 @@ export default {
})
}
},
created () {},
created () {
this.$router.push('/song')
},
mounted () {
if (this.checkIfSupportLocalstorage()) {
this.handleData()
Expand Down Expand Up @@ -168,7 +170,6 @@ body,
.ant-layout {
display: flex;
min-width: 375px;
min-height: 100%;
}
Expand All @@ -183,7 +184,7 @@ body,
}
.logo {
height: 100px;
max-height: 90px;
display: flex;
justify-content: space-between;
align-items: center;
Expand All @@ -198,7 +199,7 @@ body,
}
.ant-layout-content {
height: calc(100vh - 100px - 69px);
height: calc(100vh - 80px - 69px);
padding: 0 10% !important;
background: #fff;
overflow: auto;
Expand All @@ -219,4 +220,12 @@ body,
justify-content: space-between;
align-items: center;
}
.cotent-search-select {
min-width: 80px;
}
.cotent-search-search {
min-width: 150px;
}
</style>
15 changes: 10 additions & 5 deletions pages/index/song.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ export default {
pageSize: 10,
showSizeChanger: true,
pageSizeOptions: ['10', '20', '30', '40', '50'],
showTotal: total => `${total} 首歌曲`,
onShowSizeChange: (current, pageSize) => this.onSizeChange(current, pageSize),
// showTotal: total => `共 ${total} 首歌曲`,
onShowSizeChange: (current, pageSize) =>
this.onSizeChange(current, pageSize),
style: {
textAlign: 'center !important',
display: 'flex',
Expand Down Expand Up @@ -74,15 +75,15 @@ export default {
mounted () {
const currentPageSize = localStorage.getItem('pageSize')
if (currentPageSize !== null) {
this.pagination.pageSize = currentPageSize
this.pagination.pageSize = parseInt(currentPageSize)
}
},
methods: {
onPageChange (current) {
console.log(current)
},
onSizeChange (current, pageSize) {
localStorage.setItem('pageSize', pageSize)
localStorage.setItem('pageSize', pageSize.toString())
},
rowClick (record, index) {
return {
Expand Down Expand Up @@ -110,13 +111,17 @@ export default {
</script>

<style lang="less" scoped>
.ant-layout {
min-width: 320px;
}
.ant-layout-content {
height: 75%;
background-color: #fff;
padding: 0 0 !important;
}
.a-list {
.a-table {
display: flex;
justify-content: center;
align-items: center;
Expand Down

0 comments on commit 0821faf

Please sign in to comment.