3 changed files with 158 additions and 0 deletions
@ -0,0 +1,58 @@ |
|||
<script> |
|||
import {defineComponent} from 'vue' |
|||
|
|||
export default { |
|||
data() { |
|||
return { |
|||
uploadUrl: '' |
|||
} |
|||
}, |
|||
|
|||
mounted() { |
|||
this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/sys/publisher/backend/publish` |
|||
|
|||
}, |
|||
|
|||
methods: { |
|||
// 图片上传前 |
|||
uploadBeforeUploadHandle (file) { |
|||
let fileName = file.name; |
|||
let dotIndex = fileName.indexOf(".") |
|||
// let baseName = fileName.substring(0, dotIndex); |
|||
let extension = fileName.substring(dotIndex); |
|||
|
|||
if ( |
|||
extension !== '.jar' |
|||
) { |
|||
this.$message.error(this.$t('upload.tip', { format: '.jar' })) |
|||
return false |
|||
} |
|||
}, |
|||
// 上传成功 |
|||
uploadSuccessHandle (res, file, fileList) { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<template> |
|||
<div> |
|||
<el-upload |
|||
:action="uploadUrl" |
|||
class="upload-demo" |
|||
drag |
|||
:before-upload="uploadBeforeUploadHandle" :on-success="uploadSuccessHandle" |
|||
multiple> |
|||
<i class="el-icon-upload"></i> |
|||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> |
|||
<div class="el-upload__tip" slot="tip">只能上传.jar文件</div> |
|||
</el-upload> |
|||
</div> |
|||
</template> |
|||
|
|||
<style scoped> |
|||
|
|||
</style> |
@ -0,0 +1,76 @@ |
|||
<script> |
|||
|
|||
export default { |
|||
data() { |
|||
return { |
|||
uploadUrl: '' |
|||
} |
|||
}, |
|||
|
|||
mounted() { |
|||
this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/sys/publisher/frontend/publish` |
|||
|
|||
}, |
|||
|
|||
methods: { |
|||
// 图片上传前 |
|||
async uploadBeforeUploadHandle (file) { |
|||
let fileName = file.name; |
|||
let dotIndex = fileName.indexOf(".") |
|||
// let baseName = fileName.substring(0, dotIndex); |
|||
let extension = fileName.substring(dotIndex); |
|||
|
|||
if ( |
|||
extension !== '.zip' && |
|||
extension !== '.tar.gz') { |
|||
this.$message.error(this.$t('upload.tip', { format: '.zip/.tar.gz' })) |
|||
return false |
|||
} |
|||
// let checkResult = await this.preCheck() |
|||
// console.log(":::", checkResult) |
|||
// return checkResult; |
|||
}, |
|||
// 上传成功 |
|||
uploadSuccessHandle (res, file, fileList) { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
}, |
|||
|
|||
// 预检 |
|||
async preCheck() { |
|||
let areYouOk = true; |
|||
await this.$http.get(`/sys/publisher/frontend/preCheck`).then(({ data: result, status: httpStatus }) => { |
|||
if (result.code !== 0) { |
|||
this.$message({ |
|||
type: 'error', |
|||
message: result.msg |
|||
}) |
|||
areYouOk = false; |
|||
} |
|||
}) |
|||
return areYouOk; |
|||
} |
|||
} |
|||
} |
|||
|
|||
</script> |
|||
|
|||
<template> |
|||
<div> |
|||
<el-upload |
|||
:action="uploadUrl" |
|||
class="upload-demo" |
|||
drag |
|||
:before-upload="uploadBeforeUploadHandle" :on-success="uploadSuccessHandle" |
|||
multiple> |
|||
<i class="el-icon-upload"></i> |
|||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> |
|||
<div class="el-upload__tip" slot="tip">只能上传.zip/.tar.gz文件</div> |
|||
</el-upload> |
|||
</div> |
|||
</template> |
|||
|
|||
<style scoped> |
|||
|
|||
</style> |
@ -0,0 +1,24 @@ |
|||
<script > |
|||
import {defineComponent} from 'vue' |
|||
import PublisherFrontend from './publisher-frontend' |
|||
import PublisherBackend from './publisher-backend' |
|||
|
|||
export default { |
|||
components: { |
|||
PublisherFrontend, PublisherBackend |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<template> |
|||
<div> |
|||
<el-tabs type="border-card"> |
|||
<el-tab-pane label="前端发布"><publisher-frontend></publisher-frontend></el-tab-pane> |
|||
<el-tab-pane label="后端发布"><publisher-backend></publisher-backend></el-tab-pane> |
|||
</el-tabs> |
|||
</div> |
|||
</template> |
|||
|
|||
<style scoped> |
|||
|
|||
</style> |
Loading…
Reference in new issue