Commit a7db2c73 authored by lixy's avatar lixy

车型封面图

parent 16e92f89
......@@ -366,6 +366,9 @@ import ElRow from "element-ui/packages/row/src/row";
},
},
methods: {
/**
* 封面图
* */
uploadProcess(event, file, fileList) {
this.imgFlag = true;
console.log(event.percent);
......
......@@ -74,10 +74,14 @@
<span>{{scope.row.leasableQuantity}}</span>
</template>
</el-table-column>
<el-table-column align="center" width="100" label="操作" fixed="right">
<el-table-column align="center" width="200" label="操作" fixed="right">
<template scope="scope">
<el-button size="small" class="el-button el-button--text el-button--small" @click="handleUpdate(scope.row)">{{vehicleTypeList_btn_edit?'编辑':'查看'}}
</el-button>
<el-button size="small"class="el-button el-button--text el-button--small" style="color: #6ce26c;" v-if="scope.row.status==2|| scope.row.status==0" @click="upStatus(scope.row)">上架
</el-button>
<el-button size="small" class="el-button el-button--text el-button--small" style="color: #1d90e6" v-if="scope.row.status==1" @click="upStatus(scope.row)">下架
</el-button>
<el-button class="el-button el-button--text el-button--small" style="color:red;" size="small" @click="deleteHandler(scope.row)" v-if="vehicleTypeList_btn_del">删除</el-button>
</template>
</el-table-column>
......@@ -121,6 +125,7 @@
delVehicleModel,
getLabelList,
getLabelByParentId,
upStatusChange
} from 'api/vehicleType';
import Element1 from "../admin/menu/components/element";
......@@ -198,6 +203,33 @@
this.oneRow = {};
this.oneTypeDialogVisible = true;
},
/**
* 上架、下架 参数 id status 1-上架;0-下架 post
*/
upStatus(row){
let params = {
id: row.id,
status: row.status==1?0:1
};
upStatusChange(params).then(response => {
if (response.status === 200) {
this.$notify({
title: '成功',
message: '成功',
type: 'success',
duration: 2000
});
this.getList();
} else {
this.$notify({
title: '失败',
message: '操作失败!',
type: 'error',
duration: 2000
});
}
});
},
/**
* 删除
* */
......
......@@ -134,6 +134,21 @@
</el-form-item>
</el-col>
</el-form-item>
<el-form-item label="封面图">
<el-upload
class="upload-demo"
:headers="getHeaderWithToken"
:action="BASE_API+'/api/universal/file/app/unauth/admin/upload'"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:on-progress="uploadProcess"
list-type="picture">
<div slot="tip" class="el-upload__tip"> <span style="color: red;">建议尺寸:320*228px</span></div>
<el-progress v-show="imgFlag == true" type="circle" :percentage="percent" style="margin-top: 20px"></el-progress>
<img v-if="$utils.isString(form.coverPic) && !$utils.isEmpty(form.coverPic) && !imgFlag" :src="form.coverPic" style="width:300px;max-height:300px;">
<i v-else-if="!imgFlag" class="el-icon-plus avatar-uploader-icon" style="lineHeight:100px;width:300px;height: 100px;border: 1px dashed #ccc;"></i>
</el-upload>
</el-form-item>
<el-form-item label="轮播图" :style="{display:'block'}">
<el-upload
class="upload-demo"
......@@ -242,6 +257,8 @@ import UE from '../../modal/Ueditor';//百度ue富文本
data() {
return {
BASE_API: process.env.BASE_API,
percent: 0,//上传进度
imgFlag: false,
config: {
initialFrameWidth: null,
initialFrameHeight: 350
......@@ -404,6 +421,22 @@ import UE from '../../modal/Ueditor';//百度ue富文本
}
});
},
/**
* 封面图上传进度
* */
uploadProcess(event, file, fileList) {
this.imgFlag = true;
console.log(event.percent);
this.percent = Math.floor(event.percent);
},
/**
* 封面图上传
* **/
handleAvatarSuccess(res, file){
this.percent = 0;
this.imgFlag = false;
this.form.cover_pic = res.data;
},
/**
* 创建
* */
......@@ -417,6 +450,7 @@ import UE from '../../modal/Ueditor';//百度ue富文本
modelsDetails: this.form.modelsDetails,//房车详情
modelParam: JSON.stringify(this.form.modelParam),//房车参数
picture: this.form.picture,//轮播图
coverPic: this.form.coverPic,//封面图
price: this.form.price,//租车价格
deposit: this.form.deposit,//总押金
vioDeposit: this.form.vioDeposit,
......@@ -463,6 +497,7 @@ import UE from '../../modal/Ueditor';//百度ue富文本
modelParam: JSON.stringify(this.form.modelParam),//房车参数
picture: this.form.picture,//轮播图
price: this.form.price,//租车价格
coverPic: this.form.coverPic,//封面图
deposit: this.form.deposit,//总押金
vioDeposit: this.form.vioDeposit,
hotSign: this.form.hotSign,//热门车型
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment