完成设置页面

pull/9/head
ruibaby 6 years ago
parent a97d0e8671
commit 359eb1bb84

@ -1,4 +1,4 @@
import service from '@/util/service' import service from '@/utils/service'
const baseUrl = '/admin/api/options' const baseUrl = '/admin/api/options'

@ -7,19 +7,19 @@
<a-tab-pane tab="常规设置" key="general"> <a-tab-pane tab="常规设置" key="general">
<a-form layout="vertical"> <a-form layout="vertical">
<a-form-item label="博客标题:" :wrapper-col="wrapperCol"> <a-form-item label="博客标题:" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.blog_title"/>
</a-form-item> </a-form-item>
<a-form-item label="博客地址:" :wrapper-col="wrapperCol"> <a-form-item label="博客地址:" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.blog_url"/>
</a-form-item> </a-form-item>
<a-form-item label="LOGO" :wrapper-col="wrapperCol"> <a-form-item label="LOGO" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.blog_logo"/>
</a-form-item> </a-form-item>
<a-form-item label="Favicon" :wrapper-col="wrapperCol"> <a-form-item label="Favicon" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.blog_favicon"/>
</a-form-item> </a-form-item>
<a-form-item label="页脚信息:" :wrapper-col="wrapperCol"> <a-form-item label="页脚信息:" :wrapper-col="wrapperCol">
<a-input type="textarea" :autosize="{ minRows: 5 }" /> <a-input type="textarea" :autosize="{ minRows: 5 }" v-model="options.blog_footer_info"/>
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
<a-button type="primary" @click="saveOptions"></a-button> <a-button type="primary" @click="saveOptions"></a-button>
@ -30,26 +30,26 @@
<a-form layout="vertical"> <a-form layout="vertical">
<a-form-item label="关键词: " :wrapper-col="wrapperCol"> <a-form-item label="关键词: " :wrapper-col="wrapperCol">
<a-tooltip :trigger="['focus']" placement="right" title="多个关键词以英文逗号隔开"> <a-tooltip :trigger="['focus']" placement="right" title="多个关键词以英文逗号隔开">
<a-input /> <a-input v-model="options.seo_keywords"/>
</a-tooltip> </a-tooltip>
</a-form-item> </a-form-item>
<a-form-item label="博客描述:" :wrapper-col="wrapperCol"> <a-form-item label="博客描述:" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.seo_desc"/>
</a-form-item> </a-form-item>
<a-form-item label="百度推送 Token " :wrapper-col="wrapperCol"> <a-form-item label="百度推送 Token " :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.seo_baidu_token"/>
</a-form-item> </a-form-item>
<a-form-item label="百度站点验证:" :wrapper-col="wrapperCol"> <a-form-item label="百度站点验证:" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.blog_verification_baidu"/>
</a-form-item> </a-form-item>
<a-form-item label="Google 站点验证:" :wrapper-col="wrapperCol"> <a-form-item label="Google 站点验证:" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.blog_verification_google"/>
</a-form-item> </a-form-item>
<a-form-item label="Bing 站点验证:" :wrapper-col="wrapperCol"> <a-form-item label="Bing 站点验证:" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.blog_verification_bing"/>
</a-form-item> </a-form-item>
<a-form-item label="360 站点验证:" :wrapper-col="wrapperCol"> <a-form-item label="360 站点验证:" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.blog_verification_qihu"/>
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
<a-button type="primary" @click="saveOptions"></a-button> <a-button type="primary" @click="saveOptions"></a-button>
@ -59,13 +59,13 @@
<a-tab-pane tab="文章设置" key="post"> <a-tab-pane tab="文章设置" key="post">
<a-form layout="vertical"> <a-form layout="vertical">
<a-form-item label="首页显示条数:" :wrapper-col="wrapperCol"> <a-form-item label="首页显示条数:" :wrapper-col="wrapperCol">
<a-input type="number" defaultValue="10"/> <a-input type="number" defaultValue="10" v-model="options.index_posts_size"/>
</a-form-item> </a-form-item>
<a-form-item label="RSS 显示条数:" :wrapper-col="wrapperCol"> <a-form-item label="RSS 显示条数:" :wrapper-col="wrapperCol">
<a-input type="number" defaultValue="10"/> <a-input type="number" defaultValue="10" v-model="options.rss_posts_size"/>
</a-form-item> </a-form-item>
<a-form-item label="文章摘要字数:" :wrapper-col="wrapperCol"> <a-form-item label="文章摘要字数:" :wrapper-col="wrapperCol">
<a-input type="number" defaultValue="200"/> <a-input type="number" defaultValue="200" v-model="options.post_summary_length"/>
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
<a-button type="primary" @click="saveOptions"></a-button> <a-button type="primary" @click="saveOptions"></a-button>
@ -75,7 +75,7 @@
<a-tab-pane tab="评论设置" key="comment"> <a-tab-pane tab="评论设置" key="comment">
<a-form layout="vertical"> <a-form layout="vertical">
<a-form-item label="评论者头像:" :wrapper-col="wrapperCol"> <a-form-item label="评论者头像:" :wrapper-col="wrapperCol">
<a-select defaultValue="mm"> <a-select defaultValue="mm" v-model="options.comment_gavatar_type">
<a-select-option value="mm"> <a-select-option value="mm">
默认 默认
</a-select-option> </a-select-option>
@ -100,7 +100,7 @@
</a-select> </a-select>
</a-form-item> </a-form-item>
<a-form-item label="评论审核后才显示:" :wrapper-col="wrapperCol"> <a-form-item label="评论审核后才显示:" :wrapper-col="wrapperCol">
<a-radio-group v-decorator="['radio-group']" defaultValue="true"> <a-radio-group v-decorator="['radio-group']" defaultValue="true" v-model="options.new_comment_need_check">
<a-radio value="true"> <a-radio value="true">
启用 启用
</a-radio> </a-radio>
@ -110,7 +110,7 @@
</a-radio-group> </a-radio-group>
</a-form-item> </a-form-item>
<a-form-item label="新评论通知:" :wrapper-col="wrapperCol"> <a-form-item label="新评论通知:" :wrapper-col="wrapperCol">
<a-radio-group v-decorator="['radio-group']" defaultValue="true"> <a-radio-group v-decorator="['radio-group']" defaultValue="true" v-model="options.new_comment_notice">
<a-radio value="true"> <a-radio value="true">
启用 启用
</a-radio> </a-radio>
@ -120,7 +120,7 @@
</a-radio-group> </a-radio-group>
</a-form-item> </a-form-item>
<a-form-item label="评论审核通过通知对方:" :wrapper-col="wrapperCol"> <a-form-item label="评论审核通过通知对方:" :wrapper-col="wrapperCol">
<a-radio-group v-decorator="['radio-group']" defaultValue="true"> <a-radio-group v-decorator="['radio-group']" defaultValue="false" v-model="options.comment_pass_notice">
<a-radio value="true"> <a-radio value="true">
启用 启用
</a-radio> </a-radio>
@ -130,7 +130,7 @@
</a-radio-group> </a-radio-group>
</a-form-item> </a-form-item>
<a-form-item label="评论回复通知对方:" :wrapper-col="wrapperCol"> <a-form-item label="评论回复通知对方:" :wrapper-col="wrapperCol">
<a-radio-group v-decorator="['radio-group']" defaultValue="true"> <a-radio-group v-decorator="['radio-group']" defaultValue="false" v-model="options.comment_reply_notice">
<a-radio value="true"> <a-radio value="true">
启用 启用
</a-radio> </a-radio>
@ -140,7 +140,7 @@
</a-radio-group> </a-radio-group>
</a-form-item> </a-form-item>
<a-form-item label="API 评论开关:" :wrapper-col="wrapperCol"> <a-form-item label="API 评论开关:" :wrapper-col="wrapperCol">
<a-radio-group v-decorator="['radio-group']" defaultValue="true"> <a-radio-group v-decorator="['radio-group']" defaultValue="false" v-model="options.comment_api_switch">
<a-radio value="true"> <a-radio value="true">
启用 启用
</a-radio> </a-radio>
@ -150,13 +150,13 @@
</a-radio-group> </a-radio-group>
</a-form-item> </a-form-item>
<a-form-item label="每页显示条数: " :wrapper-col="wrapperCol"> <a-form-item label="每页显示条数: " :wrapper-col="wrapperCol">
<a-input type="number" defaultValue="10"/> <a-input type="number" defaultValue="10" v-model="options.index_comments"/>
</a-form-item> </a-form-item>
<a-form-item label="占位提示:" :wrapper-col="wrapperCol"> <a-form-item label="占位提示:" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.native_comment_placeholder"/>
</a-form-item> </a-form-item>
<a-form-item label="自定义样式:" :wrapper-col="wrapperCol"> <a-form-item label="自定义样式:" :wrapper-col="wrapperCol">
<a-input type="textarea" :autosize="{ minRows: 5 }" /> <a-input type="textarea" :autosize="{ minRows: 5 }" v-model="options.comment_custom_style"/>
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
<a-button type="primary" @click="saveOptions"></a-button> <a-button type="primary" @click="saveOptions"></a-button>
@ -166,44 +166,44 @@
<a-tab-pane tab="附件设置" key="attachment"> <a-tab-pane tab="附件设置" key="attachment">
<a-form layout="vertical"> <a-form layout="vertical">
<a-form-item label="存储位置:" :wrapper-col="wrapperCol"> <a-form-item label="存储位置:" :wrapper-col="wrapperCol">
<a-select defaultValue="LOCAL" @change="handleAttachChange"> <a-select defaultValue="0" @change="handleAttachChange" v-model="options.attachment_type">
<a-select-option value="LOCAL"> <a-select-option value="0">
本地 本地
</a-select-option> </a-select-option>
<a-select-option value="SMMS"> <a-select-option value="1">
SM.MS
</a-select-option>
<a-select-option value="UPYUN">
又拍云 又拍云
</a-select-option> </a-select-option>
<a-select-option value="QNYUN"> <a-select-option value="2">
七牛云 七牛云
</a-select-option> </a-select-option>
<a-select-option value="3">
SM.MS
</a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
<div class="upyunForm" v-show="upyunFormHidden"> <div class="upyunForm" v-show="upyunFormHidden">
<a-form-item label="域名:" :wrapper-col="wrapperCol"> <a-form-item label="域名:" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.upyun_oss_domain"/>
</a-form-item> </a-form-item>
<a-form-item label="空间名称:" :wrapper-col="wrapperCol"> <a-form-item label="空间名称:" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.upyun_oss_bucket"/>
</a-form-item> </a-form-item>
<a-form-item label="操作员名称:" :wrapper-col="wrapperCol"> <a-form-item label="操作员名称:" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.upyun_oss_operator"/>
</a-form-item> </a-form-item>
<a-form-item label="操作员密码:" :wrapper-col="wrapperCol"> <a-form-item label="操作员密码:" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.upyun_oss_password"/>
</a-form-item> </a-form-item>
<a-form-item label="文件目录:" :wrapper-col="wrapperCol"> <a-form-item label="文件目录:" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.upyun_oss_src"/>
</a-form-item> </a-form-item>
<a-form-item label="处理策略:" :wrapper-col="wrapperCol"> <a-form-item label="处理策略:" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.upyun_oss_small"/>
</a-form-item> </a-form-item>
</div> </div>
<div class="qiniuForm" v-show="qiniuFormHidden"> <div class="qiniuForm" v-show="qiniuFormHidden">
<a-form-item label="区域:" :wrapper-col="wrapperCol"> <a-form-item label="区域:" :wrapper-col="wrapperCol">
<a-select defaultValue="auto"> <a-select defaultValue="auto" v-model="options.qiniu_zone">
<a-select-option value="auto"> <a-select-option value="auto">
自动选择 自动选择
</a-select-option> </a-select-option>
@ -225,19 +225,19 @@
</a-select> </a-select>
</a-form-item> </a-form-item>
<a-form-item label="域名:" :wrapper-col="wrapperCol"> <a-form-item label="域名:" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.qiniu_domain"/>
</a-form-item> </a-form-item>
<a-form-item label="Access Key" :wrapper-col="wrapperCol"> <a-form-item label="Access Key" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.qiniu_access_key"/>
</a-form-item> </a-form-item>
<a-form-item label="Secret Key" :wrapper-col="wrapperCol"> <a-form-item label="Secret Key" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.qiniu_secret_key"/>
</a-form-item> </a-form-item>
<a-form-item label="Bucket" :wrapper-col="wrapperCol"> <a-form-item label="Bucket" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.qiniu_bucket"/>
</a-form-item> </a-form-item>
<a-form-item label="处理策略:" :wrapper-col="wrapperCol"> <a-form-item label="处理策略:" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.qiniu_small_url"/>
</a-form-item> </a-form-item>
</div> </div>
<a-form-item> <a-form-item>
@ -250,7 +250,7 @@
<a-tab-pane tab="发信设置" key="1"> <a-tab-pane tab="发信设置" key="1">
<a-form layout="vertical"> <a-form layout="vertical">
<a-form-item label="是否启用:" :wrapper-col="wrapperCol"> <a-form-item label="是否启用:" :wrapper-col="wrapperCol">
<a-radio-group v-decorator="['radio-group']" defaultValue="true"> <a-radio-group v-decorator="['radio-group']" defaultValue="false" v-model="options.smtp_email_enable">
<a-radio value="true"> <a-radio value="true">
启用 启用
</a-radio> </a-radio>
@ -260,22 +260,22 @@
</a-radio-group> </a-radio-group>
</a-form-item> </a-form-item>
<a-form-item label="SMTP 地址:" :wrapper-col="wrapperCol"> <a-form-item label="SMTP 地址:" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.mail_smtp_host"/>
</a-form-item> </a-form-item>
<a-form-item label="发送协议:" :wrapper-col="wrapperCol"> <a-form-item label="发送协议:" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.mail_smtp_host"/>
</a-form-item> </a-form-item>
<a-form-item label="SSL 端口:" :wrapper-col="wrapperCol"> <a-form-item label="SSL 端口:" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.mail_smtp_port"/>
</a-form-item> </a-form-item>
<a-form-item label="邮箱账号:" :wrapper-col="wrapperCol"> <a-form-item label="邮箱账号:" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.mail_smtp_username"/>
</a-form-item> </a-form-item>
<a-form-item label="邮箱密码:" :wrapper-col="wrapperCol"> <a-form-item label="邮箱密码:" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.mail_smtp_password"/>
</a-form-item> </a-form-item>
<a-form-item label="发件人:" :wrapper-col="wrapperCol"> <a-form-item label="发件人:" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.mail_from_name"/>
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
<a-button type="primary" @click="saveOptions"></a-button> <a-button type="primary" @click="saveOptions"></a-button>
@ -303,7 +303,7 @@
<a-tab-pane tab="其他设置" key="other"> <a-tab-pane tab="其他设置" key="other">
<a-form layout="vertical"> <a-form layout="vertical">
<a-form-item label="API服务" :wrapper-col="wrapperCol"> <a-form-item label="API服务" :wrapper-col="wrapperCol">
<a-radio-group v-decorator="['radio-group']" defaultValue="true"> <a-radio-group v-decorator="['radio-group']" defaultValue="false" v-model="options.api_status">
<a-radio value="true"> <a-radio value="true">
启用 启用
</a-radio> </a-radio>
@ -313,10 +313,10 @@
</a-radio-group> </a-radio-group>
</a-form-item> </a-form-item>
<a-form-item label="Api Token" :wrapper-col="wrapperCol"> <a-form-item label="Api Token" :wrapper-col="wrapperCol">
<a-input /> <a-input v-model="options.api_token"/>
</a-form-item> </a-form-item>
<a-form-item label="统计代码:" :wrapper-col="wrapperCol"> <a-form-item label="统计代码:" :wrapper-col="wrapperCol">
<a-input type="textarea" :autosize="{ minRows: 5 }" /> <a-input type="textarea" :autosize="{ minRows: 5 }" v-model="options.statistics_code"/>
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
<a-button type="primary" @click="saveOptions"></a-button> <a-button type="primary" @click="saveOptions"></a-button>
@ -330,6 +330,7 @@
</div> </div>
</template> </template>
<script> <script>
import optionApi from '@/api/option'
export default { export default {
data() { data() {
return { return {
@ -339,12 +340,24 @@ export default {
xs: { span: 24 } xs: { span: 24 }
}, },
upyunFormHidden: false, upyunFormHidden: false,
qiniuFormHidden: false qiniuFormHidden: false,
options: []
} }
}, },
mounted() {
this.loadOptions()
},
methods: { methods: {
saveOptions(e) { loadOptions() {
this.$message.success('保存成功!') optionApi.listAll().then(response => {
this.options = response.data.data
})
},
saveOptions() {
optionApi.save(this.options).then(response => {
this.loadOptions()
this.$message.success('保存成功!')
})
}, },
handleAttachChange(e) { handleAttachChange(e) {
switch (e) { switch (e) {

Loading…
Cancel
Save