Commit 83def117 authored by zhengke's avatar zhengke

增加上传

parent aba56e77
...@@ -53,6 +53,9 @@ ...@@ -53,6 +53,9 @@
background-color: #ee4454; background-color: #ee4454;
border-color: #ee4454; border-color: #ee4454;
} }
.comType_Img{
max-height: 50px;
}
</style> </style>
<template> <template>
...@@ -77,6 +80,8 @@ ...@@ -77,6 +80,8 @@
<th width="120px">类型编号</th> <th width="120px">类型编号</th>
<th>商品类型名称</th> <th>商品类型名称</th>
<th>商品类型图标</th> <th>商品类型图标</th>
<th>商品类型logo</th>
<th>商品类型展示图片</th>
<th>商品类型状态</th> <th>商品类型状态</th>
<th>更新时间</th> <th>更新时间</th>
<th>操作</th> <th>操作</th>
...@@ -85,7 +90,13 @@ ...@@ -85,7 +90,13 @@
<td>{{item.id}}</td> <td>{{item.id}}</td>
<td>{{item.name}}</td> <td>{{item.name}}</td>
<td> <td>
<img :src="item.icon" alt> <img :src="item.icon" class="comType_Img" />
</td>
<td>
<img :src="item.miniLog" class="comType_Img" />
</td>
<td>
<img :src="item.typeImg" class="comType_Img" />
</td> </td>
<td>{{item.state === 1 ? '正常' : '禁用'}}</td> <td>{{item.state === 1 ? '正常' : '禁用'}}</td>
<td>{{item.updateTime.replace('T', ' ')}}</td> <td>{{item.updateTime.replace('T', ' ')}}</td>
...@@ -160,6 +171,67 @@ ...@@ -160,6 +171,67 @@
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="商品类型logo">
<div class="_addUpload_box">
<div class="_pic_upload">
<template v-if="addMsg.miniLog!==''">
<div>
<div
style="width:100%;height:100%;overflow: hidden;display: flex;align-items: center;"
>
<img :src="addMsg.miniLog">
<span
style="font-size:12px; color:#666666;cursor: pointer;line-height: 20px;"
@click="addMsg.miniLog=''"
>重新上传</span>
</div>
</div>
</template>
<el-upload
v-else
drag
:http-request="uploadLogoBtn"
:multiple="false"
:show-file-list="false"
action
>
<i class="el-icon-plus avatar-uploader-icon"></i>
<div class="el-upload__text">{{$t("active.ld_djscwj")}}</div>
</el-upload>
</div>
</div>
</el-form-item>
<el-form-item label="商品类型图片">
<div class="_addUpload_box">
<div class="_pic_upload">
<template v-if="addMsg.typeImg!==''">
<div>
<div
style="width:100%;height:100%;overflow: hidden;display: flex;align-items: center;"
>
<img :src="addMsg.typeImg">
<span
style="font-size:12px; color:#666666;cursor: pointer;line-height: 20px;"
@click="addMsg.typeImg=''"
>重新上传</span>
</div>
</div>
</template>
<el-upload
v-else
drag
:http-request="uploadTypeImgBtn"
:multiple="false"
:show-file-list="false"
action
>
<i class="el-icon-plus avatar-uploader-icon"></i>
<div class="el-upload__text">{{$t("active.ld_djscwj")}}</div>
</el-upload>
</div>
</div>
</el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<button <button
...@@ -185,7 +257,9 @@ export default { ...@@ -185,7 +257,9 @@ export default {
name: "", name: "",
state: 1, state: 1,
icon: "", icon: "",
id: 0 id: 0,
miniLog:'',
typeImg:''
}, },
rules: { rules: {
memberLevel: [ memberLevel: [
...@@ -251,22 +325,89 @@ export default { ...@@ -251,22 +325,89 @@ export default {
typeOk = true; typeOk = true;
} }
}); });
if (!typeOk) return this.$message.error(this.$t("tips.qsctpian")); if (!typeOk) return this.Error(this.$t("tips.qsctpian"));
let newArr = []; let newArr = [];
newArr.push(file.file); newArr.push(file.file);
let path = "/Upload/activity/"; let path = "/Upload/activity/";
this.$message.info(this.$t("tips.shangchuanzhong")); this.Success(this.$t("tips.shangchuanzhong"));
this.UploadSelfFileT(path, newArr, x => { this.UploadSelfFileT(path, newArr, x => {
let fileSize = let fileSize =
file.file.size < 1024 file.file.size < 1024
? file.file.size ? file.file.size
: (file.file.size / 1024).toFixed(0); : (file.file.size / 1024).toFixed(0);
this.addMsg.icon = this.domainManager().ViittoFileUrl + x.data.FilePath; this.addMsg.icon = this.domainManager().ViittoFileUrl + x.data.FilePath;
this.$message.success(this.$t("tips.scchenggong")); this.Success(this.$t("tips.scchenggong"));
this.$forceUpdate();
});
},
uploadLogoBtn(file){
//上传
if (file.file.size > 1024 * 1024 * 10) {
this.$message.warning(this.$t("tips.wjdxbncgsz"));
return;
}
// 1 文档 2 数据 3 图片
let typeArr = [{ stringArr: "GIF|JPG|JPEG|PNG|BMP", type: 3 }];
let ft = file.file.name
.substring(file.file.name.lastIndexOf(".") + 1, file.file.name.length)
.toUpperCase();
let fileTypeNumber = 2;
let typeOk = false;
typeArr.forEach(x => {
if (x.stringArr.indexOf(ft) != "-1") {
fileTypeNumber = x.type;
typeOk = true;
}
});
if (!typeOk) return this.Error(this.$t("tips.qsctpian"));
let newArr = [];
newArr.push(file.file);
let path = "/Upload/activity/";
this.Success(this.$t("tips.shangchuanzhong"));
this.UploadSelfFileT(path, newArr, x => {
let fileSize =
file.file.size < 1024
? file.file.size
: (file.file.size / 1024).toFixed(0);
this.addMsg.miniLog = this.domainManager().ViittoFileUrl + x.data.FilePath;
this.Success(this.$t("tips.scchenggong"));
this.$forceUpdate();
});
},
uploadTypeImgBtn(file){
//上传
if (file.file.size > 1024 * 1024 * 10) {
this.$message.warning(this.$t("tips.wjdxbncgsz"));
return;
}
// 1 文档 2 数据 3 图片
let typeArr = [{ stringArr: "GIF|JPG|JPEG|PNG|BMP", type: 3 }];
let ft = file.file.name
.substring(file.file.name.lastIndexOf(".") + 1, file.file.name.length)
.toUpperCase();
let fileTypeNumber = 2;
let typeOk = false;
typeArr.forEach(x => {
if (x.stringArr.indexOf(ft) != "-1") {
fileTypeNumber = x.type;
typeOk = true;
}
});
if (!typeOk) return this.Error(this.$t("tips.qsctpian"));
let newArr = [];
newArr.push(file.file);
let path = "/Upload/activity/";
this.Success(this.$t("tips.shangchuanzhong"));
this.UploadSelfFileT(path, newArr, x => {
let fileSize =
file.file.size < 1024
? file.file.size
: (file.file.size / 1024).toFixed(0);
this.addMsg.typeImg = this.domainManager().ViittoFileUrl + x.data.FilePath;
this.Success(this.$t("tips.scchenggong"));
this.$forceUpdate(); this.$forceUpdate();
}); });
}, },
//获取数据 //获取数据
getList() { getList() {
this.loading = true; this.loading = true;
......
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