商品分类
This commit is contained in:
@@ -16,8 +16,8 @@
|
||||
<el-input-number v-model="editPram.sort" :min="0" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-switch v-model="editPram.showFlag" active-text="显示" inactive-text="隐藏" :active-value="1"
|
||||
:inactive-value="2" />
|
||||
<el-switch v-model="editPram.showFlag" active-text="显示" inactive-text="隐藏" active-value="1"
|
||||
inactive-value="2" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" :loading="loadingBtn" @click="handlerSubmit">确定</el-button>
|
||||
@@ -43,7 +43,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
model:"add",
|
||||
model:"classifySave",
|
||||
loadingBtn: false,
|
||||
constants: [],
|
||||
editPram: {
|
||||
@@ -66,10 +66,13 @@ export default {
|
||||
// this.initEditData()
|
||||
},
|
||||
methods: {
|
||||
updateModel(e){
|
||||
this.model = e
|
||||
},
|
||||
uploadSuccess(e, res) {
|
||||
if (res.code == 20000) {
|
||||
({ publicUrl: this.editPram.icon } = res.data);
|
||||
}
|
||||
}
|
||||
},
|
||||
// 点击图标
|
||||
addIcon() { },
|
||||
@@ -84,6 +87,7 @@ export default {
|
||||
addTreeListLabelForCasCard(arr, child) {
|
||||
},
|
||||
handlerSubmit() {
|
||||
console.log(this.model,'454545')
|
||||
productApi[this.model](this.editPram).then((result) => {
|
||||
if(result.code==20000){
|
||||
this.$parent.$parent.editDialogConfig.visible=false;
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
<template>
|
||||
<div class="photo-container">
|
||||
<el-upload
|
||||
class="avatar-uploader"
|
||||
:action="uploadUrl"
|
||||
:limit="1"
|
||||
:show-file-list="false"
|
||||
:on-success="uploadSuccess"
|
||||
:on-remove="removeUrl"
|
||||
:data="{'code':code,'ossKey':'xingyou2','pathKey':'banner-group','encrypt':'PUBLIC'}"
|
||||
>
|
||||
<div>
|
||||
<el-upload class="avatar-uploader" :action="uploadUrl" :limit="1" :show-file-list="false" :on-success="uploadSuccess"
|
||||
:on-remove="removeUrl" :data="{ 'code': code, 'ossKey': 'xingyou2', 'pathKey': 'banner-group', 'encrypt': 'PUBLIC' }">
|
||||
<img v-if="photoUrl" :src="photoUrl" class="avatar">
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon" />
|
||||
</el-upload>
|
||||
</el-upload>
|
||||
<div @click="removeUrl" style="width: 100%;text-align: center;" v-if="photoUrl" >
|
||||
<i style="font-size: 20px;" class="el-icon-delete" />
|
||||
</div>
|
||||
</div>
|
||||
<span class="upload-span">
|
||||
<slot name="bottom">{{ tip }}</slot>
|
||||
</span>
|
||||
@@ -21,7 +19,7 @@
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
tip:{
|
||||
tip: {
|
||||
type: String,
|
||||
default: "请上传图片"
|
||||
},
|
||||
@@ -46,10 +44,10 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
photo: function(newVal, oldVal) {
|
||||
photo: function (newVal, oldVal) {
|
||||
this.photoUrl = newVal
|
||||
},
|
||||
isPrivate: function(newVal, oldVal) {
|
||||
isPrivate: function (newVal, oldVal) {
|
||||
this.changeUploadUrl
|
||||
}
|
||||
},
|
||||
@@ -64,16 +62,17 @@ export default {
|
||||
this.uploadUrl = process.env.VUE_APP_UPLOAD_URL
|
||||
}
|
||||
},
|
||||
removeUrl(file, fileList) {
|
||||
removeUrl(file, fileList) {
|
||||
this.$emit('success', "", {data:{publicUrl:""},code:20000});
|
||||
},
|
||||
uploadSuccess(res, file) {
|
||||
if (res.code === 20000) {
|
||||
this.$message.success(res.msg)
|
||||
this.photoUrl = res.data.url
|
||||
if (this.isPrivate) {
|
||||
this.$emit('success', this.res.path,res)
|
||||
this.$emit('success', this.res.path, res)
|
||||
} else {
|
||||
this.$emit('success', this.photoUrl,res)
|
||||
this.$emit('success', this.photoUrl, res)
|
||||
}
|
||||
} else {
|
||||
this.$message.error(res.msg)
|
||||
@@ -82,8 +81,9 @@ export default {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
<style >
|
||||
.avatar-uploader .el-upload {
|
||||
border: 1px dashed #d9d9d9;
|
||||
border-radius: 6px;
|
||||
@@ -91,9 +91,11 @@ export default {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.avatar-uploader .el-upload:hover {
|
||||
border-color: #409eff;
|
||||
}
|
||||
|
||||
.avatar-uploader-icon {
|
||||
font-size: 28px;
|
||||
color: #8c939d;
|
||||
@@ -102,6 +104,7 @@ export default {
|
||||
line-height: 178px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
|
||||
Reference in New Issue
Block a user