Update option api

pull/9/head
johnniang 2019-04-01 15:16:57 +08:00
parent 02dca838a7
commit 745133a70b
4 changed files with 355 additions and 147 deletions

View File

@ -1,6 +1,6 @@
import service from '@/utils/service'
const baseUrl = '/admin/api/options'
const baseUrl = '/admin/api/options/map_view'
const optionApi = {}

View File

@ -1,35 +0,0 @@
const VueAxios = {
vm: {},
// eslint-disable-next-line no-unused-vars
install(Vue, instance) {
if (this.installed) {
return
}
this.installed = true
if (!instance) {
// eslint-disable-next-line no-console
console.error('You have to install axios')
return
}
Vue.axios = instance
Object.defineProperties(Vue.prototype, {
axios: {
get: function get() {
return instance
}
},
$http: {
get: function get() {
return instance
}
}
})
}
}
export {
VueAxios
}

View File

@ -35,7 +35,7 @@ service.interceptors.response.use(
const status = response ? response.status : -1
Vue.$log.error('Server response status', status)
const data = response.data
const data = response ? response.data : null
if (data) {
// Business response
Vue.$log.error('Business response status', data.status)

View File

@ -1,24 +1,48 @@
<template>
<div class="page-header-index-wide">
<a-row>
<a-col :xl="24" :lg="24" :md="24" :sm="24" :xs="24">
<a-col
:xl="24"
:lg="24"
:md="24"
:sm="24"
:xs="24"
>
<div class="card-container">
<a-tabs type="card">
<a-tab-pane tab="常规设置" key="general">
<a-tab-pane
tab="常规设置"
key="general"
>
<a-form layout="vertical">
<a-form-item label="博客标题:" :wrapper-col="wrapperCol">
<a-input v-model="options.blog_title"/>
<a-form-item
label="博客标题:"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.blog_title" />
</a-form-item>
<a-form-item label="博客地址:" :wrapper-col="wrapperCol">
<a-input v-model="options.blog_url"/>
<a-form-item
label="博客地址:"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.blog_url" />
</a-form-item>
<a-form-item label="LOGO" :wrapper-col="wrapperCol">
<a-input v-model="options.blog_logo"/>
<a-form-item
label="LOGO"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.blog_logo" />
</a-form-item>
<a-form-item label="Favicon" :wrapper-col="wrapperCol">
<a-input v-model="options.blog_favicon"/>
<a-form-item
label="Favicon"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.blog_favicon" />
</a-form-item>
<a-form-item label="页脚信息:" :wrapper-col="wrapperCol">
<a-form-item
label="页脚信息:"
:wrapper-col="wrapperCol"
>
<a-input
type="textarea"
:autosize="{ minRows: 5 }"
@ -26,60 +50,130 @@
/>
</a-form-item>
<a-form-item>
<a-button type="primary" @click="saveOptions"></a-button>
<a-button
type="primary"
@click="saveOptions"
>保存</a-button>
</a-form-item>
</a-form>
</a-tab-pane>
<a-tab-pane tab="SEO设置" key="seo">
<a-tab-pane
tab="SEO设置"
key="seo"
>
<a-form layout="vertical">
<a-form-item label="关键词: " :wrapper-col="wrapperCol">
<a-tooltip :trigger="['focus']" placement="right" title="多个关键词以英文逗号隔开">
<a-input v-model="options.seo_keywords"/>
<a-form-item
label="关键词: "
:wrapper-col="wrapperCol"
>
<a-tooltip
:trigger="['focus']"
placement="right"
title="多个关键词以英文逗号隔开"
>
<a-input v-model="options.seo_keywords" />
</a-tooltip>
</a-form-item>
<a-form-item label="博客描述:" :wrapper-col="wrapperCol">
<a-input v-model="options.seo_desc"/>
<a-form-item
label="博客描述:"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.seo_desc" />
</a-form-item>
<a-form-item label="百度推送 Token " :wrapper-col="wrapperCol">
<a-input v-model="options.seo_baidu_token"/>
<a-form-item
label="百度推送 Token "
:wrapper-col="wrapperCol"
>
<a-input v-model="options.seo_baidu_token" />
</a-form-item>
<a-form-item label="百度站点验证:" :wrapper-col="wrapperCol">
<a-input v-model="options.blog_verification_baidu"/>
<a-form-item
label="百度站点验证:"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.blog_verification_baidu" />
</a-form-item>
<a-form-item label="Google 站点验证:" :wrapper-col="wrapperCol">
<a-input v-model="options.blog_verification_google"/>
<a-form-item
label="Google 站点验证:"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.blog_verification_google" />
</a-form-item>
<a-form-item label="Bing 站点验证:" :wrapper-col="wrapperCol">
<a-input v-model="options.blog_verification_bing"/>
<a-form-item
label="Bing 站点验证:"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.blog_verification_bing" />
</a-form-item>
<a-form-item label="360 站点验证:" :wrapper-col="wrapperCol">
<a-input v-model="options.blog_verification_qihu"/>
<a-form-item
label="360 站点验证:"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.blog_verification_qihu" />
</a-form-item>
<a-form-item>
<a-button type="primary" @click="saveOptions"></a-button>
<a-button
type="primary"
@click="saveOptions"
>保存</a-button>
</a-form-item>
</a-form>
</a-tab-pane>
<a-tab-pane tab="文章设置" key="post">
<a-tab-pane
tab="文章设置"
key="post"
>
<a-form layout="vertical">
<a-form-item label="首页显示条数:" :wrapper-col="wrapperCol">
<a-input type="number" defaultValue="10" v-model="options.index_posts_size"/>
<a-form-item
label="首页显示条数:"
:wrapper-col="wrapperCol"
>
<a-input
type="number"
defaultValue="10"
v-model="options.index_posts_size"
/>
</a-form-item>
<a-form-item label="RSS 显示条数:" :wrapper-col="wrapperCol">
<a-input type="number" defaultValue="10" v-model="options.rss_posts_size"/>
<a-form-item
label="RSS 显示条数:"
:wrapper-col="wrapperCol"
>
<a-input
type="number"
defaultValue="10"
v-model="options.rss_posts_size"
/>
</a-form-item>
<a-form-item label="文章摘要字数:" :wrapper-col="wrapperCol">
<a-input type="number" defaultValue="200" v-model="options.post_summary_length"/>
<a-form-item
label="文章摘要字数:"
:wrapper-col="wrapperCol"
>
<a-input
type="number"
defaultValue="200"
v-model="options.post_summary_length"
/>
</a-form-item>
<a-form-item>
<a-button type="primary" @click="saveOptions"></a-button>
<a-button
type="primary"
@click="saveOptions"
>保存</a-button>
</a-form-item>
</a-form>
</a-tab-pane>
<a-tab-pane tab="评论设置" key="comment">
<a-tab-pane
tab="评论设置"
key="comment"
>
<a-form layout="vertical">
<a-form-item label="评论者头像:" :wrapper-col="wrapperCol">
<a-select defaultValue="mm" v-model="options.comment_gavatar_type">
<a-form-item
label="评论者头像:"
:wrapper-col="wrapperCol"
>
<a-select
defaultValue="mm"
v-model="options.comment_gavatar_type"
>
<a-select-option value="mm">默认</a-select-option>
<a-select-option value="identicon">抽象几何图形</a-select-option>
<a-select-option value="monsterid">小怪物</a-select-option>
@ -89,7 +183,10 @@
<a-select-option value="blank">不显示头像</a-select-option>
</a-select>
</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"
@ -99,7 +196,10 @@
<a-radio value="false">禁用</a-radio>
</a-radio-group>
</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"
@ -109,7 +209,10 @@
<a-radio value="false">禁用</a-radio>
</a-radio-group>
</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="false"
@ -119,7 +222,10 @@
<a-radio value="false">禁用</a-radio>
</a-radio-group>
</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="false"
@ -129,7 +235,10 @@
<a-radio value="false">禁用</a-radio>
</a-radio-group>
</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="false"
@ -139,13 +248,26 @@
<a-radio value="false">禁用</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="每页显示条数: " :wrapper-col="wrapperCol">
<a-input type="number" defaultValue="10" v-model="options.index_comments"/>
<a-form-item
label="每页显示条数: "
:wrapper-col="wrapperCol"
>
<a-input
type="number"
defaultValue="10"
v-model="options.index_comments"
/>
</a-form-item>
<a-form-item label="占位提示:" :wrapper-col="wrapperCol">
<a-input v-model="options.native_comment_placeholder"/>
<a-form-item
label="占位提示:"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.native_comment_placeholder" />
</a-form-item>
<a-form-item label="自定义样式:" :wrapper-col="wrapperCol">
<a-form-item
label="自定义样式:"
:wrapper-col="wrapperCol"
>
<a-input
type="textarea"
:autosize="{ minRows: 5 }"
@ -153,13 +275,22 @@
/>
</a-form-item>
<a-form-item>
<a-button type="primary" @click="saveOptions"></a-button>
<a-button
type="primary"
@click="saveOptions"
>保存</a-button>
</a-form-item>
</a-form>
</a-tab-pane>
<a-tab-pane tab="附件设置" key="attachment">
<a-tab-pane
tab="附件设置"
key="attachment"
>
<a-form layout="vertical">
<a-form-item label="存储位置:" :wrapper-col="wrapperCol">
<a-form-item
label="存储位置:"
:wrapper-col="wrapperCol"
>
<a-select
defaultValue="0"
@change="handleAttachChange"
@ -171,35 +302,65 @@
<a-select-option value="3">SM.MS</a-select-option>
</a-select>
</a-form-item>
<div class="upyunForm" v-show="upyunFormHidden">
<a-form-item label="域名:" :wrapper-col="wrapperCol">
<div
class="upyunForm"
v-show="upyunFormHidden"
>
<a-form-item
label="域名:"
:wrapper-col="wrapperCol"
>
<a-tooltip
:trigger="['focus']"
placement="right"
title="需要加上 http:// 或者 https://"
>
<a-input v-model="options.upyun_oss_domain"/>
<a-input v-model="options.upyun_oss_domain" />
</a-tooltip>
</a-form-item>
<a-form-item label="空间名称:" :wrapper-col="wrapperCol">
<a-input v-model="options.upyun_oss_bucket"/>
<a-form-item
label="空间名称:"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.upyun_oss_bucket" />
</a-form-item>
<a-form-item label="操作员名称:" :wrapper-col="wrapperCol">
<a-input v-model="options.upyun_oss_operator"/>
<a-form-item
label="操作员名称:"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.upyun_oss_operator" />
</a-form-item>
<a-form-item label="操作员密码:" :wrapper-col="wrapperCol">
<a-input v-model="options.upyun_oss_password"/>
<a-form-item
label="操作员密码:"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.upyun_oss_password" />
</a-form-item>
<a-form-item label="文件目录:" :wrapper-col="wrapperCol">
<a-input v-model="options.upyun_oss_src"/>
<a-form-item
label="文件目录:"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.upyun_oss_src" />
</a-form-item>
<a-form-item label="处理策略:" :wrapper-col="wrapperCol">
<a-input v-model="options.upyun_oss_small"/>
<a-form-item
label="处理策略:"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.upyun_oss_small" />
</a-form-item>
</div>
<div class="qiniuForm" v-show="qiniuFormHidden">
<a-form-item label="区域:" :wrapper-col="wrapperCol">
<a-select defaultValue="auto" v-model="options.qiniu_zone">
<div
class="qiniuForm"
v-show="qiniuFormHidden"
>
<a-form-item
label="区域:"
:wrapper-col="wrapperCol"
>
<a-select
defaultValue="auto"
v-model="options.qiniu_zone"
>
<a-select-option value="auto">自动选择</a-select-option>
<a-select-option value="z0">华东</a-select-option>
<a-select-option value="z1">华北</a-select-option>
@ -208,38 +369,65 @@
<a-select-option value="as0">东南亚</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="域名:" :wrapper-col="wrapperCol">
<a-form-item
label="域名:"
:wrapper-col="wrapperCol"
>
<a-tooltip
:trigger="['focus']"
placement="right"
title="需要加上 http:// 或者 https://"
>
<a-input v-model="options.qiniu_domain"/>
<a-input v-model="options.qiniu_domain" />
</a-tooltip>
</a-form-item>
<a-form-item label="Access Key" :wrapper-col="wrapperCol">
<a-input v-model="options.qiniu_access_key"/>
<a-form-item
label="Access Key"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.qiniu_access_key" />
</a-form-item>
<a-form-item label="Secret Key" :wrapper-col="wrapperCol">
<a-input v-model="options.qiniu_secret_key"/>
<a-form-item
label="Secret Key"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.qiniu_secret_key" />
</a-form-item>
<a-form-item label="Bucket" :wrapper-col="wrapperCol">
<a-input v-model="options.qiniu_bucket"/>
<a-form-item
label="Bucket"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.qiniu_bucket" />
</a-form-item>
<a-form-item label="处理策略:" :wrapper-col="wrapperCol">
<a-input v-model="options.qiniu_small_url"/>
<a-form-item
label="处理策略:"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.qiniu_small_url" />
</a-form-item>
</div>
<a-form-item>
<a-button type="primary" @click="saveOptions"></a-button>
<a-button
type="primary"
@click="saveOptions"
>保存</a-button>
</a-form-item>
</a-form>
</a-tab-pane>
<a-tab-pane tab="SMTP 服务" key="smtp">
<a-tab-pane
tab="SMTP 服务"
key="smtp"
>
<a-tabs defaultActiveKey="1">
<a-tab-pane tab="发信设置" key="1">
<a-tab-pane
tab="发信设置"
key="1"
>
<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="false"
@ -249,41 +437,81 @@
<a-radio value="false">禁用</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="SMTP 地址:" :wrapper-col="wrapperCol">
<a-input v-model="options.mail_smtp_host"/>
<a-form-item
label="SMTP 地址:"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.mail_smtp_host" />
</a-form-item>
<a-form-item label="发送协议:" :wrapper-col="wrapperCol">
<a-input v-model="options.mail_smtp_host"/>
<a-form-item
label="发送协议:"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.mail_smtp_host" />
</a-form-item>
<a-form-item label="SSL 端口:" :wrapper-col="wrapperCol">
<a-input v-model="options.mail_smtp_port"/>
<a-form-item
label="SSL 端口:"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.mail_smtp_port" />
</a-form-item>
<a-form-item label="邮箱账号:" :wrapper-col="wrapperCol">
<a-input v-model="options.mail_smtp_username"/>
<a-form-item
label="邮箱账号:"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.mail_smtp_username" />
</a-form-item>
<a-form-item label="邮箱密码:" :wrapper-col="wrapperCol">
<a-tooltip :trigger="['focus']" placement="right" title="部分邮箱可能是授权码">
<a-input v-model="options.mail_smtp_password"/>
<a-form-item
label="邮箱密码:"
:wrapper-col="wrapperCol"
>
<a-tooltip
:trigger="['focus']"
placement="right"
title="部分邮箱可能是授权码"
>
<a-input v-model="options.mail_smtp_password" />
</a-tooltip>
</a-form-item>
<a-form-item label="发件人:" :wrapper-col="wrapperCol">
<a-input v-model="options.mail_from_name"/>
<a-form-item
label="发件人:"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.mail_from_name" />
</a-form-item>
<a-form-item>
<a-button type="primary" @click="saveOptions"></a-button>
<a-button
type="primary"
@click="saveOptions"
>保存</a-button>
</a-form-item>
</a-form>
</a-tab-pane>
<a-tab-pane tab="发送测试" key="2">
<a-tab-pane
tab="发送测试"
key="2"
>
<a-form layout="vertical">
<a-form-item label="收件人:" :wrapper-col="wrapperCol">
<a-input/>
<a-form-item
label="收件人:"
:wrapper-col="wrapperCol"
>
<a-input />
</a-form-item>
<a-form-item label="主题:" :wrapper-col="wrapperCol">
<a-input/>
<a-form-item
label="主题:"
:wrapper-col="wrapperCol"
>
<a-input />
</a-form-item>
<a-form-item label="内容:" :wrapper-col="wrapperCol">
<a-input type="textarea" :autosize="{ minRows: 5 }"/>
<a-form-item
label="内容:"
:wrapper-col="wrapperCol"
>
<a-input
type="textarea"
:autosize="{ minRows: 5 }"
/>
</a-form-item>
<a-form-item>
<a-button type="primary">发送</a-button>
@ -292,9 +520,15 @@
</a-tab-pane>
</a-tabs>
</a-tab-pane>
<a-tab-pane tab="其他设置" key="other">
<a-tab-pane
tab="其他设置"
key="other"
>
<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="false"
@ -304,10 +538,16 @@
<a-radio value="false">禁用</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="Api Token" :wrapper-col="wrapperCol">
<a-input v-model="options.api_token"/>
<a-form-item
label="Api Token"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.api_token" />
</a-form-item>
<a-form-item label="统计代码:" :wrapper-col="wrapperCol">
<a-form-item
label="统计代码:"
:wrapper-col="wrapperCol"
>
<a-input
type="textarea"
:autosize="{ minRows: 5 }"
@ -315,7 +555,10 @@
/>
</a-form-item>
<a-form-item>
<a-button type="primary" @click="saveOptions"></a-button>
<a-button
type="primary"
@click="saveOptions"
>保存</a-button>
</a-form-item>
</a-form>
</a-tab-pane>