mirror of https://github.com/halo-dev/halo-admin
Refactor option api
parent
55b12ca6b0
commit
38fb0306b6
|
@ -0,0 +1,15 @@
|
|||
import service from '@/utils/service'
|
||||
|
||||
const baseUrl = '/api/admin/mails'
|
||||
|
||||
const mailApi = {}
|
||||
|
||||
mailApi.test = mailData => {
|
||||
return service({
|
||||
url: `${baseUrl}/test`,
|
||||
method: 'post',
|
||||
data: mailData
|
||||
})
|
||||
}
|
||||
|
||||
export default mailApi
|
|
@ -1,40 +1,25 @@
|
|||
import service from '@/utils/service'
|
||||
|
||||
const baseUrl = '/api/admin/options/map_view'
|
||||
const baseUrl = '/api/admin/options'
|
||||
|
||||
const optionApi = {}
|
||||
|
||||
optionApi.listAll = () => {
|
||||
optionApi.listAll = keys => {
|
||||
return service({
|
||||
url: baseUrl,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
optionApi.listByKeys = keys => {
|
||||
return service({
|
||||
url: `/api/admin/options/map_keys`,
|
||||
method: 'get',
|
||||
url: `${baseUrl}/map_view`,
|
||||
params: {
|
||||
keys: keys
|
||||
}
|
||||
key: keys
|
||||
},
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
optionApi.save = options => {
|
||||
return service({
|
||||
url: `${baseUrl}/saving`,
|
||||
url: `${baseUrl}/map_view/saving`,
|
||||
method: 'post',
|
||||
data: options
|
||||
})
|
||||
}
|
||||
|
||||
optionApi.testMail = param => {
|
||||
return service({
|
||||
url: `/api/admin/options/test_mail`,
|
||||
method: 'post',
|
||||
data: param
|
||||
})
|
||||
}
|
||||
|
||||
export default optionApi
|
||||
|
|
|
@ -69,7 +69,7 @@ export default {
|
|||
optionVisible: true,
|
||||
user: {},
|
||||
options: [],
|
||||
keys: 'blog_url'
|
||||
keys: ['blog_url']
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
@ -114,7 +114,7 @@ export default {
|
|||
})
|
||||
},
|
||||
loadOptions() {
|
||||
optionApi.listByKeys(this.keys).then(response => {
|
||||
optionApi.listAll(this.keys).then(response => {
|
||||
this.options = response.data.data
|
||||
})
|
||||
}
|
||||
|
|
|
@ -288,7 +288,7 @@
|
|||
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-divider class="divider-transparent"/>
|
||||
<a-divider class="divider-transparent" />
|
||||
<div class="bottom-control">
|
||||
<a-popconfirm
|
||||
title="你确定要清空所有操作日志?"
|
||||
|
|
|
@ -490,13 +490,13 @@
|
|||
label="收件人:"
|
||||
:wrapper-col="wrapperCol"
|
||||
>
|
||||
<a-input v-model="mailParam.to"/>
|
||||
<a-input v-model="mailParam.to" />
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
label="主题:"
|
||||
:wrapper-col="wrapperCol"
|
||||
>
|
||||
<a-input v-model="mailParam.subject"/>
|
||||
<a-input v-model="mailParam.subject" />
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
label="内容:"
|
||||
|
@ -509,7 +509,10 @@
|
|||
/>
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
<a-button type="primary" @click="handleTestMailClick">发送</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
@click="handleTestMailClick"
|
||||
>发送</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-tab-pane>
|
||||
|
@ -570,7 +573,9 @@
|
|||
<script>
|
||||
import AttachmentSelectDrawer from '../attachment/components/AttachmentSelectDrawer'
|
||||
import optionApi from '@/api/option'
|
||||
import mailApi from '@/api/mail'
|
||||
import attachmentApi from '@/api/attachment'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
AttachmentSelectDrawer
|
||||
|
@ -610,7 +615,7 @@ export default {
|
|||
})
|
||||
},
|
||||
handleAttachChange(e) {
|
||||
switch (e) {
|
||||
switch (e.toUppper()) {
|
||||
case 'LOCAL':
|
||||
case 'SMMS':
|
||||
this.upyunFormHidden = false
|
||||
|
@ -645,7 +650,7 @@ export default {
|
|||
this.faviconDrawerVisible = true
|
||||
},
|
||||
handleTestMailClick() {
|
||||
optionApi.testMail(this.mailParam).then(response => {
|
||||
mailApi.testMail(this.mailParam).then(response => {
|
||||
this.$message.info(response.data.message)
|
||||
})
|
||||
},
|
||||
|
|
|
@ -166,7 +166,7 @@ export default {
|
|||
},
|
||||
attachment: {},
|
||||
options: [],
|
||||
keys: 'blog_url'
|
||||
keys: ['blog_url']
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -190,7 +190,7 @@ export default {
|
|||
})
|
||||
},
|
||||
loadOptions() {
|
||||
optionApi.listByKeys(this.keys).then(response => {
|
||||
optionApi.listAll(this.keys).then(response => {
|
||||
this.options = response.data.data
|
||||
})
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue