-
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f3da02
commit 421d9e1
Showing
4 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<template> | ||
<div> | ||
<div class="card fn-clear card__body"> | ||
|
||
<v-form> | ||
<v-text-field | ||
multi-line | ||
label="Google AdSense ins" | ||
:rules="linkRules" | ||
:counter="255" | ||
v-model="googleAdSenseArticleEmbed" | ||
></v-text-field> | ||
<div class="alert alert--danger" v-show="error"> | ||
<v-icon>danger</v-icon> | ||
<span>{{ errorMsg }}</span> | ||
</div> | ||
</v-form> | ||
<v-btn class="fn-right btn--margin-t30 btn--info btn--space" @click="update"> | ||
{{ $t('confirm', $store.state.locale) }} | ||
</v-btn> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import {maxSize} from '~/plugins/validate' | ||
export default { | ||
data () { | ||
return { | ||
googleAdSenseArticleEmbed: '', | ||
linkRules: [ | ||
(v) => maxSize.call(this, v, 255) | ||
], | ||
error: false, | ||
errorMsg: '' | ||
} | ||
}, | ||
head () { | ||
return { | ||
title: `${this.$t('3rdStatistic', this.$store.state.locale)} - ${this.$store.state.blogTitle}` | ||
} | ||
}, | ||
methods: { | ||
async update () { | ||
const responseData = await this.axios.put('/console/settings/ad', { | ||
googleAdSenseArticleEmbed: this.googleAdSenseArticleEmbed | ||
}) | ||
if (responseData.code === 0) { | ||
this.$set(this, 'error', false) | ||
this.$set(this, 'errorMsg', '') | ||
this.$store.commit('setSnackBar', { | ||
snackBar: true, | ||
snackMsg: this.$t('setupSuccess', this.$store.state.locale), | ||
snackModify: 'success' | ||
}) | ||
} else { | ||
this.$set(this, 'error', true) | ||
this.$set(this, 'errorMsg', responseData.msg) | ||
} | ||
} | ||
}, | ||
async mounted () { | ||
const responseData = await this.axios.get('/console/settings/ad') | ||
if (responseData) { | ||
this.$set(this, 'googleAdSenseArticleEmbed', responseData.googleAdSenseArticleEmbed) | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"ad": "advertisement", | ||
"userName": "User Name", | ||
"popularBlog": "Popular Blog", | ||
"createdTime": "Created Time", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"ad": "广告", | ||
"month": "月", | ||
"useGitHub": "推荐通过 GitHub 进行", | ||
"userName": "用户名", | ||
|