Ai
4 Star 4 Fork 5

WeiboGe2012/自动化测试平台vue

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
test2.vue 2.86 KB
一键复制 编辑 原始数据 按行查看 历史
WeiboGe2012 提交于 2021-02-01 17:48 +08:00 . 1.用户管理头像优化
<template>
<div>
<el-dialog
v-if="editFormVisible"
:title="title"
:visible.sync="editFormVisible"
width="50%"
:close-on-click-modal="false"
>
<el-form ref="editShopImg" :model="editShopImg" :rules="rules" label-width="150px">
<el-form-item label="适用门店组图片上传" prop="fileList">
<el-upload
class="upload-demo"
action=""
:headers="dataObj"
:on-preview="handlePreview"
:on-remove="handleRemove"
:before-upload="beforeUpload"
:file-list="fileList"
list-type="picture"
>
<el-button size="small" type="primary">
点击上传
</el-button>
<div slot="tip" class="el-upload__tip">
只能上传jpg/png文件,且不超500kb
</div>
</el-upload>
</el-form-item>
<div class="save-btn">
<el-button type="primary" size="small" @click="submitFile">
保存
</el-button>
</div>
</el-form>
<!-- <div slot="footer" class="dialog-footer">
<el-button size="small" @click="closeDialog">
取消
</el-button>
<el-button size="small" type="primary" :loading="loading" class="title" @click="submitForm('editForm')">
保存
</el-button>
</div> -->
</el-dialog>
</div>
</template>
<script>
import axios from 'axios'
export default {
data () {
return {
editFormVisible: [],
fileList: [],
logo: ''
}
},
methods: {
submitFile () {
const formData = new FormData()
formData.append('file', this.uploadFile)
axios({
method: 'put',
url: '/upload/setFileUpload',
data: formData,
headers: {
// eslint-disable-next-line no-undef
// Authorization: Cookies.get('loginToken')
}
}).then((res) => {
// eslint-disable-next-line no-console
console.log(res.data, 'res.data')
this.dialogVisibleShopImg = false
if (res.data.code === 200 & res.data.success === true) {
this.$message({
message: '提交成功',
type: 'success'
})
} else {
this.$message({
message: '保存失败',
type: 'error'
})
}
})
}
}
}
</script>
<style lang="scss">
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409EFF;
}
.avatar-uploader-icon {
font-size: 18px;
color: #8c939d;
width: 100px;
height: 100px;
line-height: 100px;
text-align: center;
}
.avatar {
width: 100px;
height: 100px;
display: block;
}
</style>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/WeiboGe2012/automated-test-platform-vue.git
git@gitee.com:WeiboGe2012/automated-test-platform-vue.git
WeiboGe2012
automated-test-platform-vue
自动化测试平台vue
master

搜索帮助