Add theme fetching feature

pull/9/head
johnniang 2019-04-19 16:02:00 +08:00
parent 2e27b3947b
commit 95fcc2e49e
2 changed files with 27 additions and 5 deletions

View File

@ -90,4 +90,14 @@ themeApi.upload = (formData, uploadProgress, cancelToken) => {
}) })
} }
themeApi.fetching = url => {
return service({
url: `${baseUrl}/fetching`,
params: {
uri: url
},
method: 'post'
})
}
export default themeApi export default themeApi

View File

@ -142,7 +142,12 @@
<div class="upload-button"> <div class="upload-button">
<a-button type="primary" shape="circle" icon="plus" size="large" @click="showUploadModal"></a-button> <a-button type="primary" shape="circle" icon="plus" size="large" @click="showUploadModal"></a-button>
</div> </div>
<a-modal title="安装主题" v-model="uploadVisible" :footer="null" :bodyStyle="{ padding: '0 24px 24px' }"> <a-modal
title="安装主题"
v-model="uploadVisible"
:footer="null"
:bodyStyle="{ padding: '0 24px 24px' }"
>
<a-tabs defaultActiveKey="1"> <a-tabs defaultActiveKey="1">
<a-tab-pane tab="本地上传" key="1"> <a-tab-pane tab="本地上传" key="1">
<a-upload-dragger <a-upload-dragger
@ -162,10 +167,10 @@
<a-tab-pane tab="远程拉取" key="2"> <a-tab-pane tab="远程拉取" key="2">
<a-form layout="vertical"> <a-form layout="vertical">
<a-form-item label="远程地址:"> <a-form-item label="远程地址:">
<a-input /> <a-input v-model="fetchingUrl"/>
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
<a-button type="primary">确定</a-button> <a-button type="primary" @click="handleFetching"></a-button>
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-tab-pane> </a-tab-pane>
@ -192,7 +197,8 @@ export default {
visible: false, visible: false,
themeConfiguration: null, themeConfiguration: null,
themeSettings: [], themeSettings: [],
themeProperty: null themeProperty: null,
fetchingUrl: null
} }
}, },
computed: { computed: {
@ -305,6 +311,12 @@ export default {
source.cancel('Upload operation canceled by the user.') source.cancel('Upload operation canceled by the user.')
} }
} }
},
handleFetching() {
themeApi.fetching(this.fetchingUrl).then(response => {
this.$message.success('上传成功')
this.loadThemes()
})
} }
} }
} }