Skip to content

Commit 8550680

Browse files
committed
article action
1 parent 95ae7ae commit 8550680

12 files changed

Lines changed: 58 additions & 19 deletions

File tree

‎console/assets/scss/_form.scss‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ label.checkbox {
142142
}
143143

144144
&--success {
145-
background-color: #00bcd4;
146-
border: 1px solid #00bcd4;
145+
background-color: $success;
146+
border: 1px solid $success;
147147

148148
&:active,
149149
&:focus {

‎console/assets/scss/_variables.scss‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ $border-color: rgba(120, 130, 140, 0.13) !default;
1313
$text-color: #67757c !default;
1414
$text-title: #455a64 !default;
1515
$red: #ef5350 !default;
16+
$success: #00bcd4 !default;
1617
$list-hover: rgba(0, 0, 0, 0.02) !default;
1718
$fade: rgba(0, 0, 0, .38) !default;
1819
$fade-lighter: rgba(0, 0, 0, .12) !default;

‎console/assets/scss/vuetify.scss‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,10 @@
386386
}
387387
}
388388
}
389+
390+
&.success .snack__content {
391+
background-color: $success;
392+
}
389393
}
390394

391395
// menu

‎console/components/Side.vue‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
{
4646
title: app.$t('manage', locale),
4747
icon: 'manage',
48-
active: true,
48+
active: app.$route.path.indexOf('management') > -1,
4949
items: [
5050
{
5151
title: app.$t('articleList', locale),
@@ -80,6 +80,7 @@
8080
{
8181
title: app.$t('setting', locale),
8282
icon: 'setting',
83+
active: app.$route.path.indexOf('setting') > -1,
8384
items: [
8485
{
8586
title: app.$t('configuration', locale),

‎console/layouts/default.vue‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
<v-snackbar
1212
:top="true"
1313
v-model="snack"
14+
:timeout="$store.state.snackModify === 'error' ? 6000 : 3000"
15+
:success="$store.state.snackModify === 'success'"
1416
>
1517
{{ $store.state.snackMsg }}
1618
<span @click="snack = false"><icon icon="close"/></span>

‎console/middleware/initialized.js‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,5 @@ export default function ({ redirect, store, route }) {
33
if (route.path.indexOf('/init') === -1) {
44
return redirect('/init')
55
}
6-
} else {
7-
if (route.path.indexOf('/init') > -1) {
8-
return redirect('/')
9-
}
106
}
117
}

‎console/mock/mock.json‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
],
2020
"mockFile": "articleList.json"
2121
},
22+
"console/articles/:id" : {
23+
"verbs": [
24+
"delete", "put"
25+
],
26+
"mockFile": "success.json"
27+
},
2228
"init": {
2329
"verbs": [
2430
"post"

‎console/nuxt.config.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ module.exports = {
66
** Headers of the page
77
*/
88
head: {
9-
title: 'Solo',
9+
title: 'solo.go',
1010
meta: [
1111
{ charset: 'utf-8' },
1212
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
13-
{ name: 'robots', content: 'none' },
13+
{ name: 'robots', content: 'none' }
1414
],
1515
link: [
16-
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
16+
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
1717
]
1818
},
1919
/*

‎console/pages/admin/articles/management/index.vue‎

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
},
7373
methods: {
7474
async getList (currentPage) {
75-
const responseData = await this.axios(`/console/articles?p=${currentPage}`)
75+
const responseData = await this.axios.get(`/console/articles?p=${currentPage}`)
7676
if (responseData) {
7777
this.$set(this, 'list', responseData.articles)
7878
this.$set(this, 'currentPageNum', responseData.pagination.currentPageNum)
@@ -83,11 +83,32 @@
8383
edit (id) {
8484
console.log('edit', id)
8585
},
86-
remove (id) {
87-
console.log('delete', id)
86+
async remove (id) {
87+
const responseData = await this.axios.delete(`/console/articles/${id}`)
88+
if (responseData === null) {
89+
this.$store.commit('setSnackBar', {
90+
snackBar: true,
91+
snackMsg: this.$t('deleteSuccess', this.$store.state.locale),
92+
snackModify: 'success'
93+
})
94+
this.getList(1)
95+
}
8896
},
89-
top (id) {
90-
console.log('top', id)
97+
async top (id) {
98+
const responseData = await this.axios.put(`/console/articles/${id}`)
99+
if (responseData.code === 0) {
100+
this.$store.commit('setSnackBar', {
101+
snackBar: true,
102+
snackMsg: this.$t('topSuccess', this.$store.state.locale),
103+
snackModify: 'success'
104+
})
105+
this.getList(1)
106+
} else {
107+
this.$store.commit('setSnackBar', {
108+
snackBar: true,
109+
snackMsg: responseData.msg
110+
})
111+
}
91112
}
92113
},
93114
mounted () {

‎console/plugins/axios.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ export default (ctx) => {
2121
})
2222

2323
customAxios.interceptors.response.use((response) => {
24-
if (response.config.method === 'get') {
25-
// get use snack tip
24+
if (response.config.method === 'get' || response.config.method === 'delete') {
25+
// get and delete use snack tip
2626
if (response.data.code === 0) {
2727
return response.data.data
2828
} else {

0 commit comments

Comments
 (0)