Add ability to upload file from an url

This commit is contained in:
Angelina Filippova 2019-10-23 01:07:45 +02:00
parent f060155fdb
commit 6aab2dd664

View file

@ -7,20 +7,20 @@
<el-input v-model="customFileName" :placeholder="$t('settings.optional')"/> <el-input v-model="customFileName" :placeholder="$t('settings.optional')"/>
</el-form-item> </el-form-item>
<el-form-item :label="$t('settings.uploadFile')"> <el-form-item :label="$t('settings.uploadFile')">
<!-- <div class="upload-file-url"> <div class="upload-file-url">
<el-input v-model="imageUploadURL" :placeholder="$t('settings.url')"/> <el-input v-model="imageUploadURL" :placeholder="$t('settings.url')"/>
<el-button :disabled="shortcodePresent" class="upload-button" @click="uploadEmoji">{{ $t('settings.upload') }}</el-button> <el-button :disabled="shortcodePresent" type="primary" class="upload-button" @click="uploadEmoji">{{ $t('settings.upload') }}</el-button>
</div> </div>
<div class="upload-container"> <div class="upload-container">
<p class="text">or</p>--> <p class="text">or</p>
<el-upload <el-upload
:http-request="uploadEmoji" :http-request="uploadEmoji"
:multiple="false" :multiple="false"
:show-file-list="false" :show-file-list="false"
action="add"> action="add">
<el-button :disabled="shortcodePresent" type="primary">{{ $t('settings.clickToUpload') }}</el-button> <el-button :disabled="shortcodePresent" type="primary">{{ $t('settings.clickToUpload') }}</el-button>
</el-upload> </el-upload>
<!-- </div> --> </div>
</el-form-item> </el-form-item>
</el-form> </el-form>
</template> </template>
@ -75,11 +75,12 @@ export default {
action: 'add', action: 'add',
packName: this.packName, packName: this.packName,
shortcode: this.shortcode, shortcode: this.shortcode,
file, file: file || this.imageUploadURL,
fileName: this.customFileName fileName: this.customFileName
}).then(() => { }).then(() => {
this.shortcode = '' this.shortcode = ''
this.imageUploadURL = '' this.imageUploadURL = ''
this.customFileName = ''
this.$store.dispatch('ReloadEmoji') this.$store.dispatch('ReloadEmoji')
}) })