Commit 4cbf4509 authored by 黄奎's avatar 黄奎

文件上传修改

parent be8e13eb
...@@ -550,15 +550,7 @@ ...@@ -550,15 +550,7 @@
spinner: 'el-icon-loading', spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)' background: 'rgba(0, 0, 0, 0.7)'
}); });
// this.UploadSelfFile(this.FileType().Video, file.file, res => {
// if (res.resultCode == 1) {
// that.addpageMsg.Image = res.VideoCoverImg;
// that.addpageMsg.Path = res.FileUrl;
// that.addpageMsg.Name = res.FileName;
// that.addPageList();
// that.$forceUpdate();
// }
// })
this.UploadFileToTencent(this.FileType().Video, file.file, res => { this.UploadFileToTencent(this.FileType().Video, file.file, res => {
if (res.resultCode == 1) { if (res.resultCode == 1) {
if (that.addpageMsg.Type == 2) { if (that.addpageMsg.Type == 2) {
......
...@@ -2,11 +2,7 @@ ...@@ -2,11 +2,7 @@
<div class="orderList"> <div class="orderList">
<div class="head-title"> <div class="head-title">
订单列表 订单列表
<!-- <el-upload class="upload-demo" ref="upload" :action="importFileUrl" :multiple="true" :on-success="successUpload"
:show-file-list="false" accept=".csv">
<el-button :loading="btnLoad" size="small" type="primary">
赞羊导入</el-button>
</el-upload> -->
<el-button @click="dialogVisible = true" style="float: right; margin-top: -5px" size="small" type="primary">批量导出 <el-button @click="dialogVisible = true" style="float: right; margin-top: -5px" size="small" type="primary">批量导出
</el-button> </el-button>
<el-button @click="ClearHsz" style="float: right; margin-top: -5px; margin-right: 20px" size="small" <el-button @click="ClearHsz" style="float: right; margin-top: -5px; margin-right: 20px" size="small"
...@@ -19,21 +15,7 @@ ...@@ -19,21 +15,7 @@
<el-date-picker v-model="dateList" @change="(msg.pageIndex = 1), getList()" size="small" type="datetimerange" <el-date-picker v-model="dateList" @change="(msg.pageIndex = 1), getList()" size="small" type="datetimerange"
range-separator="至" value-format="yyyy-MM-dd HH:mm:ss" start-placeholder="开始日期" end-placeholder="结束日期"> range-separator="至" value-format="yyyy-MM-dd HH:mm:ss" start-placeholder="开始日期" end-placeholder="结束日期">
</el-date-picker> </el-date-picker>
<!-- <span style="margin-left: 15px;font-size:14px">所属平台:</span>
<el-select class="w120" @change="(msg.pageIndex = 1), getList()" v-model="msg.OrderSource" size="small"
placeholder="请选择">
<el-option label="全部平台" :value="0"></el-option>
<el-option v-for="item in platList" :key="item.Id" :label="item.Name" :value="item.Id">
</el-option>
</el-select> -->
<!-- <span style="margin-left: 15px;font-size:14px">订单类型:</span>
<el-select class="w120" @change="(msg.pageIndex = 1), getList()" v-model="msg.OrderType" size="small"
placeholder="请选择">
<el-option label="全部订单" :value="0"></el-option>
<el-option v-for="item in orderTypeList" :key="item.Id" :label="item.Name" :value="item.Id">
</el-option>
</el-select> -->
<span style="margin-left: 15px;font-size:14px">配送方式:</span> <span style="margin-left: 15px;font-size:14px">配送方式:</span>
<el-select class="w120" @change="(msg.pageIndex = 1), getList()" v-model="msg.DeliveryMethod" size="small" <el-select class="w120" @change="(msg.pageIndex = 1), getList()" v-model="msg.DeliveryMethod" size="small"
placeholder="请选择"> placeholder="请选择">
......
...@@ -262,15 +262,6 @@ ...@@ -262,15 +262,6 @@
//上传视频 //上传视频
UploadVideo(file) { UploadVideo(file) {
var that = this; var that = this;
// this.UploadSelfFile(this.FileType().Video, file.file, res => {
// if (res.resultCode == 1) {
// that.addpageMsg.Image = res.VideoCoverImg;
// that.addpageMsg.Path = res.FileUrl;
// that.addpageMsg.Name = res.FileName;
// that.addPageList();
// that.$forceUpdate();
// }
// })
that.uploadLoadingObj = this.$loading({ that.uploadLoadingObj = this.$loading({
lock: true, lock: true,
text: '正在上传视频,请稍后...', text: '正在上传视频,请稍后...',
...@@ -285,7 +276,6 @@ ...@@ -285,7 +276,6 @@
that.addpageMsg.Path = res.FileUrl; that.addpageMsg.Path = res.FileUrl;
that.addpageMsg.Name = res.FileName; that.addpageMsg.Name = res.FileName;
that.cutPicture(res.FileUrl); that.cutPicture(res.FileUrl);
//that.addPageList();
} }
}) })
}, },
......
...@@ -3,79 +3,50 @@ ...@@ -3,79 +3,50 @@
<template v-if="!isShowAdd"> <template v-if="!isShowAdd">
<div class="head-title"> <div class="head-title">
奖项管理 奖项管理
<el-button <el-button style="float: right; margin-top: -5px" size="small" type="primary"
style="float: right; margin-top: -5px" @click="(isShowAdd = true), clearMsg()">
size="small" 新增</el-button>
type="primary"
@click="(isShowAdd = true), clearMsg()"
>
新增</el-button
>
</div> </div>
<div class="content"> <div class="content">
<div> <div>
<div class="searchInput" style="width: 250px"> <div class="searchInput" style="width: 250px">
<el-input <el-input @keyup.enter.native="(msg.pageIndex = 1), getList()" @clear="(msg.pageIndex = 1), getList()"
@keyup.enter.native="(msg.pageIndex = 1), getList()" style="display: inline-block; width: 225px; height: 30px" placeholder="请输入奖项名称" v-model="msg.Name"
@clear="(msg.pageIndex = 1), getList()" size="small" clearable>
style="display: inline-block; width: 225px; height: 30px"
placeholder="请输入奖项名称"
v-model="msg.Name"
size="small"
clearable
>
</el-input> </el-input>
<span <span @click="(msg.pageIndex = 1), getList()" class="el-icon-search" style="
@click="(msg.pageIndex = 1), getList()"
class="el-icon-search"
style="
color: #979dad; color: #979dad;
font-size: 14px; font-size: 14px;
position: relative; position: relative;
top: 1px; top: 1px;
" "></span>
></span>
</div> </div>
</div> </div>
<el-table <el-table :data="tableData" v-loading="loading" border style="width: 100%; margin: 20px 0">
:data="tableData"
v-loading="loading"
border
style="width: 100%; margin: 20px 0"
>
<el-table-column prop="Id" label="编号" width="100"> <el-table-column prop="Id" label="编号" width="100">
</el-table-column> </el-table-column>
<el-table-column prop="Name" label="奖项名称"> </el-table-column> <el-table-column prop="Name" label="奖项名称"> </el-table-column>
<el-table-column prop="BigIco" width="150" label="大奖章"> <el-table-column prop="BigIco" width="150" label="大奖章">
<template slot-scope="scope"> <template slot-scope="scope">
<div <div class="app-image" :style="{
class="app-image"
:style="{
backgroundImage: 'url(' + scope.row.BigIco + ')', backgroundImage: 'url(' + scope.row.BigIco + ')',
backgroundSize: 'cover', backgroundSize: 'cover',
}" }"></div>
></div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="SmallIco" width="150" label="小奖章"> <el-table-column prop="SmallIco" width="150" label="小奖章">
<template slot-scope="scope"> <template slot-scope="scope">
<div <div class="app-image" :style="{
class="app-image"
:style="{
backgroundImage: 'url(' + scope.row.SmallIco + ')', backgroundImage: 'url(' + scope.row.SmallIco + ')',
backgroundSize: 'cover', backgroundSize: 'cover',
}" }"></div>
></div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="YearInfo" width="200" label="年份"> <el-table-column prop="YearInfo" width="200" label="年份">
</el-table-column> </el-table-column>
<el-table-column prop="BrandCount" width="200" label="关联品牌数量"> <el-table-column prop="BrandCount" width="200" label="关联品牌数量">
<template slot-scope="scope"> <template slot-scope="scope">
<div <div @click="jumpBrandList(scope.row)" style="cursor: pointer; color: red">
@click="jumpBrandList(scope.row)"
style="cursor: pointer; color: red"
>
{{ scope.row.TotalCount }} {{ scope.row.TotalCount }}
</div> </div>
</template> </template>
...@@ -83,197 +54,74 @@ ...@@ -83,197 +54,74 @@
<el-table-column prop="address" width="200" label="操作"> <el-table-column prop="address" width="200" label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tooltip <el-tooltip class="item" effect="dark" content="编辑" placement="top">
class="item" <img @click="editNews(scope.row)" style="width: 32px; height: 32px"
effect="dark" src="../../assets/img/userman/edit.png" alt="" />
content="编辑"
placement="top"
>
<img
@click="editNews(scope.row)"
style="width: 32px; height: 32px"
src="../../assets/img/userman/edit.png"
alt=""
/>
</el-tooltip> </el-tooltip>
<el-tooltip <el-tooltip class="item" effect="dark" content="删除" placement="top-start">
class="item" <img @click="delNews(scope.row)" style="width: 32px; height: 32px; margin: 0 10px"
effect="dark" src="../../assets/img/userman/del.png" alt="" />
content="删除"
placement="top-start"
>
<img
@click="delNews(scope.row)"
style="width: 32px; height: 32px; margin: 0 10px"
src="../../assets/img/userman/del.png"
alt=""
/>
</el-tooltip> </el-tooltip>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination <el-pagination style="text-align: right" background @current-change="handleCurrentChange"
style="text-align: right" :page-size="msg.pageSize" :current-page.sync="msg.pageIndex" layout="total,prev, pager, next" :total="total">
background
@current-change="handleCurrentChange"
:page-size="msg.pageSize"
:current-page.sync="msg.pageIndex"
layout="total,prev, pager, next"
:total="total"
>
</el-pagination> </el-pagination>
</div> </div>
</template> </template>
<template v-else> <template v-else>
<div class="head-title"> <div class="head-title">
<span <span @click="isShowAdd = false" style="color: rgb(64, 158, 255); cursor: pointer">奖项列表</span><span
@click="isShowAdd = false" style="margin: 0 9px; color: #c0c4cc">/</span><span>编辑奖项</span>
style="color: rgb(64, 158, 255); cursor: pointer"
>奖项列表</span
><span style="margin: 0 9px; color: #c0c4cc">/</span
><span>编辑奖项</span>
</div> </div>
<div class="content"> <div class="content">
<el-form <el-form label-width="120px" :model="addMsg" :rules="rules" ref="addMsg">
label-width="120px"
:model="addMsg"
:rules="rules"
ref="addMsg"
>
<el-form-item label="奖项名称" class="is-required" prop="Name"> <el-form-item label="奖项名称" class="is-required" prop="Name">
<el-input <el-input type="text" class="w400" v-model="addMsg.Name" size="small" placeholder="奖项名称" maxlength="100">
type="text"
class="w400"
v-model="addMsg.Name"
size="small"
placeholder="奖项名称"
maxlength="100"
>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="大奖章" size="small" class="is-required" prop="BigIco">
label="大奖章"
size="small"
class="is-required"
prop="BigIco"
>
<!-- <el-button @click="openImageChoose(1)" size="small" <!-- <el-button @click="openImageChoose(1)" size="small"
>选择大奖章</el-button >选择大奖章</el-button
> --> > -->
<div <div class="app-gallery-item" style="
class="app-gallery-item"
style="
position: relative; position: relative;
width: 100px; width: 100px;
margin-top: 10px; margin-top: 10px;
border: none; border: none;
" ">
> <el-upload class="avatar-uploader" action :show-file-list="false" :http-request="UploadBig">
<!-- <img <i v-if="!addMsg.BigIco || addMsg.BigIco == ''" class="el-icon-plus avatar-uploader-icon"></i>
v-if="!addMsg.BigIco || addMsg.BigIco == ''"
src="../../assets/img/default.png"
style="width: 80px; height: 80px"
alt=""
/> -->
<!-- <img
v-else
style="width: 80px; height: 80px"
:src="addMsg.BigIco"
alt=""
/> -->
<el-upload
class="avatar-uploader"
action
:show-file-list="false"
:http-request="UploadBig"
>
<i
v-if="!addMsg.BigIco || addMsg.BigIco == ''"
class="el-icon-plus avatar-uploader-icon"
></i>
<img v-else :src="addMsg.BigIco" class="avatar" /> <img v-else :src="addMsg.BigIco" class="avatar" />
</el-upload> </el-upload>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="小奖章" size="small" class="is-required" prop="SmallIco">
label="小奖章"
size="small"
class="is-required"
prop="SmallIco"
>
<!-- <el-button @click="openImageChoose(2)" size="small" <!-- <el-button @click="openImageChoose(2)" size="small"
>选择小奖章</el-button >选择小奖章</el-button
> --> > -->
<div <div class="app-gallery-item" style="
class="app-gallery-item"
style="
position: relative; position: relative;
width: 100px; width: 100px;
margin-top: 10px; margin-top: 10px;
border: none; border: none;
" ">
>
<!-- <img <el-upload class="avatar-uploader" action :show-file-list="false" :http-request="UploadSmall">
v-if="!addMsg.SmallIco || addMsg.SmallIco == ''" <i v-if="!addMsg.SmallIco || addMsg.SmallIco == ''" class="el-icon-plus avatar-uploader-icon"></i>
src="../../assets/img/default.png"
style="width: 80px; height: 80px"
alt=""
/>
<img
v-else
style="width: 80px; height: 80px"
:src="addMsg.SmallIco"
alt=""
/> -->
<el-upload
class="avatar-uploader"
action
:show-file-list="false"
:http-request="UploadSmall"
>
<i
v-if="!addMsg.SmallIco || addMsg.SmallIco == ''"
class="el-icon-plus avatar-uploader-icon"
></i>
<img v-else :src="addMsg.SmallIco" class="avatar" /> <img v-else :src="addMsg.SmallIco" class="avatar" />
</el-upload> </el-upload>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="年份" size="small" class="is-required" prop="YearInfo">
label="年份" <el-input v-model="addMsg.YearInfo" placeholder="年份" type="number" style="width: 400px"></el-input>
size="small"
class="is-required"
prop="YearInfo"
>
<!-- <el-select
v-model="addMsg.YearInfo"
filterable
placeholder="请选择"
>
<el-option
v-for="item in yearOptions"
:key="item.name"
:label="item.name"
:value="item.name"
>
</el-option>
</el-select> -->
<el-input
v-model="addMsg.YearInfo"
placeholder="年份"
type="number"
style="width: 400px"
></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<el-button <el-button size="small" style="margin-top: 20px; padding: 9px 25px" type="primary" @click="submitform('addMsg')">
size="small" 保存
style="margin-top: 20px; padding: 9px 25px"
type="primary"
@click="submitform('addMsg')"
>保存
</el-button> </el-button>
</template> </template>
<!-- 选择文件 --> <!-- 选择文件 -->
...@@ -283,320 +131,320 @@ ...@@ -283,320 +131,320 @@
</div> </div>
</template> </template>
<script> <script>
import ChooseImg from "@/components/global/ChooseImg.vue"; import ChooseImg from "@/components/global/ChooseImg.vue";
import UE from "@/components/global/UE.vue"; import UE from "@/components/global/UE.vue";
export default { export default {
components: { components: {
ChooseImg, ChooseImg,
UE, UE,
}, },
data() { data() {
return { return {
loading: false, loading: false,
msg: { msg: {
pageIndex: 1, pageIndex: 1,
pageSize: 10, pageSize: 10,
Name: "", Name: "",
}, },
total: 0, total: 0,
tableData: [], //数据列表 tableData: [], //数据列表
isShowImage: false, //是否显示选择图片弹窗 isShowImage: false, //是否显示选择图片弹窗
isShowAdd: false, //是否显示新增 isShowAdd: false, //是否显示新增
addMsg: { addMsg: {
Id: 0, //主键编号 Id: 0, //主键编号
BigIco: "", //大奖章 BigIco: "", //大奖章
SmallIco: "", //小奖章 SmallIco: "", //小奖章
Name: "", //品牌分类标题 Name: "", //品牌分类标题
// BrandList: [], //关联的品牌列表 // BrandList: [], //关联的品牌列表
YearInfo: "", YearInfo: "",
}, },
rules: { rules: {
Name: [ Name: [{
{
required: true, required: true,
message: "请输入奖项名称", message: "请输入奖项名称",
trigger: "blur", trigger: "blur",
}, }, ],
], BigIco: [{
BigIco: [
{
required: true, required: true,
message: "请选择大奖章", message: "请选择大奖章",
trigger: "blur", trigger: "blur",
}, }, ],
], SmallIco: [{
SmallIco: [
{
required: true, required: true,
message: "请选择小奖章", message: "请选择小奖章",
trigger: "blur", trigger: "blur",
}, }, ],
], YearInfo: [{
YearInfo: [
{
required: true, required: true,
message: "请选择年份", message: "请选择年份",
trigger: "blur", trigger: "blur",
}, }, ],
],
},
brandMsg: {
pageIndex: 1,
pageSize: 9999,
BrandName: "", //品牌名
ProjectType: 0, //商铺性质
Plumbing: -1, //上下水(0-否1-有)
Caliber: -1, //管径(0-否1-有)
Sewage: -1, //排污(0-否1-有)
RanQi: -1, //燃气(0-否1-有)
DianLiang: "", //电量(0-否1-有)
PaiYan: -1, //排烟量(0-否1-有)
KongTiao: -1, //空调(0-否1-有)
XinFeng: -1, //新风(0-否1-有)
BrandClassId: 0, //分类
ExcelEnumIds: [],
UserId: 0, //用户认证
},
openImage: 1, //判断当前(大/小)奖章
yearOptions: [
{
name: 2010,
}, },
], brandMsg: {
}; pageIndex: 1,
}, pageSize: 9999,
created() { BrandName: "", //品牌名
this.getList(); ProjectType: 0, //商铺性质
// this.getBrandList(); Plumbing: -1, //上下水(0-否1-有)
this.getYearList(5); Caliber: -1, //管径(0-否1-有)
}, Sewage: -1, //排污(0-否1-有)
methods: { RanQi: -1, //燃气(0-否1-有)
SelectId(msg) { DianLiang: "", //电量(0-否1-有)
let url = this.getIconLink(msg.url); PaiYan: -1, //排烟量(0-否1-有)
if (this.openImage === 1) { KongTiao: -1, //空调(0-否1-有)
this.addMsg.BigIco = url; XinFeng: -1, //新风(0-否1-有)
} else if (this.openImage === 2) { BrandClassId: 0, //分类
this.addMsg.SmallIco = url; ExcelEnumIds: [],
} UserId: 0, //用户认证
this.isShowImage = false; },
}, openImage: 1, //判断当前(大/小)奖章
clearMsg() { yearOptions: [{
this.addMsg.Id = 0; name: 2010,
this.addMsg.BigIco = ""; }, ],
this.addMsg.SmallIco = ""; };
this.addMsg.BrandList = [];
this.addMsg.Name = "";
this.addMsg.YearInfo = "";
},
getList() {
this.loading = true;
this.apipost("/api/Trade/GetPrizePageList", this.msg, (res) => {
this.loading = false;
if (res.data.resultCode == 1) {
this.total = res.data.data.count;
let pageData = res.data.data.pageData;
this.tableData = pageData;
}
});
}, },
handleCurrentChange(val) { created() {
this.msg.pageIndex = val;
this.getList(); this.getList();
// this.getBrandList();
this.getYearList(5);
}, },
//删除品牌分类 methods: {
delNews(item) { SelectId(msg) {
let that = this; let url = this.getIconLink(msg.url);
that.Confirm("是否删除?", function () { if (this.openImage === 1) {
that.apipost( this.addMsg.BigIco = url;
"/api/Trade/RemovePrize", } else if (this.openImage === 2) {
{ this.addMsg.SmallIco = url;
Id: item.Id, }
}, this.isShowImage = false;
(res) => { },
if (res.data.resultCode == 1) { clearMsg() {
that.Success(res.data.message); this.addMsg.Id = 0;
that.getList(); this.addMsg.BigIco = "";
} else { this.addMsg.SmallIco = "";
that.Error(res.data.message); this.addMsg.BrandList = [];
this.addMsg.Name = "";
this.addMsg.YearInfo = "";
},
getList() {
this.loading = true;
this.apipost("/api/Trade/GetPrizePageList", this.msg, (res) => {
this.loading = false;
if (res.data.resultCode == 1) {
this.total = res.data.data.count;
let pageData = res.data.data.pageData;
this.tableData = pageData;
}
});
},
handleCurrentChange(val) {
this.msg.pageIndex = val;
this.getList();
},
//删除品牌分类
delNews(item) {
let that = this;
that.Confirm("是否删除?", function () {
that.apipost(
"/api/Trade/RemovePrize", {
Id: item.Id,
},
(res) => {
if (res.data.resultCode == 1) {
that.Success(res.data.message);
that.getList();
} else {
that.Error(res.data.message);
}
} }
);
});
},
//获取详情
editNews(item) {
this.isShowAdd = true;
this.addMsg.Id = item.Id;
this.apipost("/api/Trade/GetPrizeDetails", {
Id: item.Id
}, (res) => {
if (res.data.resultCode == 1) {
this.addMsg.BigIco = res.data.data.BigIco;
this.addMsg.SmallIco = res.data.data.SmallIco;
this.addMsg.Name = res.data.data.Name;
this.addMsg.YearInfo = res.data.data.YearInfo;
// this.addMsg.BrandList = [];
// res.data.data.BrandList.map((e) => {
// this.addMsg.BrandList.push(e.ID);
// });
} else {
this.Error(res.data.message);
} }
); });
}); }, //新增修改
}, submitform(formName) {
//获取详情 this.$refs[formName].validate((valid) => {
editNews(item) { if (valid) {
this.isShowAdd = true; // let msg = JSON.parse(JSON.stringify(this.addMsg));
this.addMsg.Id = item.Id; // msg.BrandList = [];
this.apipost("/api/Trade/GetPrizeDetails", { Id: item.Id }, (res) => {
if (res.data.resultCode == 1) {
this.addMsg.BigIco = res.data.data.BigIco;
this.addMsg.SmallIco = res.data.data.SmallIco;
this.addMsg.Name = res.data.data.Name;
this.addMsg.YearInfo = res.data.data.YearInfo;
// this.addMsg.BrandList = [];
// res.data.data.BrandList.map((e) => {
// this.addMsg.BrandList.push(e.ID);
// });
} else {
this.Error(res.data.message);
}
});
}, //新增修改
submitform(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
// let msg = JSON.parse(JSON.stringify(this.addMsg));
// msg.BrandList = [];
// this.addMsg.BrandList.forEach((e) => { // this.addMsg.BrandList.forEach((e) => {
// msg.BrandList.push({ ID: e }); // msg.BrandList.push({ ID: e });
// }); // });
this.apipost("/api/Trade/GetSetPrize", this.addMsg, (res) => { this.apipost("/api/Trade/GetSetPrize", this.addMsg, (res) => {
if (res.data.resultCode == 1) { if (res.data.resultCode == 1) {
this.isShowAdd = false; this.isShowAdd = false;
this.getList(); this.getList();
this.clearMsg(); this.clearMsg();
this.Success(res.data.message); this.Success(res.data.message);
} else { } else {
this.Error(res.data.message); this.Error(res.data.message);
} }
});
} else {
return false;
}
});
},
//获取品牌列表
getBrandList() {
this.apipost("/api/Trade/GetBrandPageList", this.brandMsg, (res) => {
if (res.data.resultCode == 1) {
this.brandOptions = res.data.data.pageData;
} else {
this.Error(res.data.message);
}
});
},
openImageChoose(type) {
this.isShowImage = true;
this.openImage = type;
},
jumpBrandList(item) {
if (item.TotalCount > 0) {
this.$router.push({
path: "/brandManagement",
query: {
PrizeId: item.Id,
readonly: 1
},
}); });
} else {
return false;
} }
}); },
}, getYearList(n) {
//获取品牌列表 let date = new Date();
getBrandList() { let year = date.getFullYear();
this.apipost("/api/Trade/GetBrandPageList", this.brandMsg, (res) => { this.yearOptions = [];
if (res.data.resultCode == 1) { for (let i = year - n; i < year + n; i++) {
this.brandOptions = res.data.data.pageData; this.yearOptions.push({
} else { name: i,
this.Error(res.data.message); });
} }
}); },
}, //选择图片
openImageChoose(type) { UploadBig(file) {
this.isShowImage = true; this.UploadFileToTencent(this.FileType().UserImg, file.file, (res) => {
this.openImage = type; if (res.resultCode == 1) {
}, this.addMsg.BigIco = res.FileUrl;
jumpBrandList(item) { }
if (item.TotalCount > 0) {
this.$router.push({
path: "/brandManagement",
query: { PrizeId: item.Id, readonly: 1 },
});
}
},
getYearList(n) {
let date = new Date();
let year = date.getFullYear();
this.yearOptions = [];
for (let i = year - n; i < year + n; i++) {
this.yearOptions.push({
name: i,
}); });
} },
}, UploadSmall(file) {
//选择图片 const isLt1M = file.file.size / 1024 / 1024 < 1;
UploadBig(file) { if (!isLt1M) {
this.UploadFileToTencent(this.FileType().UserImg, file.file, (res) => { this.$message.error("上传头像图片大小不能超过 1MB!");
if (res.resultCode == 1) { return;
this.addMsg.BigIco = res.FileUrl;
}
});
},
UploadSmall(file) {
const isLt1M = file.file.size / 1024 / 1024 < 1;
if (!isLt1M) {
this.$message.error("上传头像图片大小不能超过 1MB!");
return;
}
this.UploadFileToTencent(this.FileType().UserImg, file.file, (res) => {
if (res.resultCode == 1) {
this.addMsg.SmallIco = res.FileUrl;
} }
}); this.UploadFileToTencent(this.FileType().UserImg, file.file, (res) => {
if (res.resultCode == 1) {
this.addMsg.SmallIco = res.FileUrl;
}
});
},
}, },
}, mounted() {},
mounted() {}, };
};
</script> </script>
<style> <style>
.brandClassification .remark_name { .brandClassification .remark_name {
color: #888888; color: #888888;
font-size: 12px; font-size: 12px;
margin-left: 10px; margin-left: 10px;
float: right; float: right;
} }
.brandClassification .app-image {
background-position: center center;
width: 50px;
height: 50px;
border-radius: 0%;
float: left;
margin-right: 8px;
}
.brandClassification .blue {
color: #409eff;
}
.brandClassification .content .searchInput {
border: 1px solid #dcdfe6;
border-radius: 4px;
}
.brandClassification .content .searchInput .el-input__inner {
border: none;
outline: none;
height: 30px;
line-height: 30px;
}
.brandClassification .content .searchInput {
line-height: normal;
display: inline-table;
width: 100%;
border-collapse: separate;
border-spacing: 0;
width: 250px;
margin-right: 20px;
}
.brandClassification .app-image { .brandClassification .content {
background-position: center center; background: #fff;
width: 50px; margin-top: 10px;
height: 50px; padding: 20px;
border-radius: 0%; box-sizing: border-box;
float: left; }
margin-right: 8px;
}
.brandClassification .blue { .brandClassification .el-form-item__content {
color: #409eff; line-height: 0;
} }
.brandClassification .content .searchInput { .brandClassification .avatar-uploader .el-upload {
border: 1px solid #dcdfe6; border: 1px dashed #d9d9d9;
border-radius: 4px; border-radius: 6px;
} cursor: pointer;
position: relative;
overflow: hidden;
}
.brandClassification .content .searchInput .el-input__inner { .brandClassification .avatar-uploader .el-upload:hover {
border: none; border-color: #409eff;
outline: none; }
height: 30px;
line-height: 30px;
}
.brandClassification .content .searchInput { .avatar-uploader-icon {
line-height: normal; font-size: 28px;
display: inline-table; color: #8c939d;
width: 100%; width: 80px;
border-collapse: separate; height: 80px;
border-spacing: 0; line-height: 80px;
width: 250px; text-align: center;
margin-right: 20px; }
}
.brandClassification .content { .avatar {
background: #fff; width: 80px;
margin-top: 10px; height: 80px;
padding: 20px; display: block;
box-sizing: border-box; }
}
.brandClassification .el-form-item__content {
line-height: 0;
}
.brandClassification .avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.brandClassification .avatar-uploader .el-upload:hover {
border-color: #409eff;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 80px;
height: 80px;
line-height: 80px;
text-align: center;
}
.avatar {
width: 80px;
height: 80px;
display: block;
}
</style> </style>
...@@ -200,11 +200,10 @@ export default { ...@@ -200,11 +200,10 @@ export default {
if (upInfo.StoreType == 1) { if (upInfo.StoreType == 1) {
var cachaInfo = that.getLocalStorage(); var cachaInfo = that.getLocalStorage();
if (cachaInfo && cachaInfo.TenantId == 29) { if (cachaInfo && cachaInfo.TenantId == 29) {
that.uploadStart(path, fileObj, callback) that.RealUploadToTencent(path, fileObj, callback)
} else { } else {
that.uploadStart(path, newFile, callback) that.RealUploadToTencent(path, newFile, callback)
} }
console.log("cachaInfo", cachaInfo)
} }
if (upInfo.StoreType == 2) { if (upInfo.StoreType == 2) {
that.uploadToAli(path, newFile, callback) that.uploadToAli(path, newFile, callback)
...@@ -215,7 +214,7 @@ export default { ...@@ -215,7 +214,7 @@ export default {
}).catch(function (error) { }).catch(function (error) {
if (upInfo && upInfo.IsDefault == 1) { if (upInfo && upInfo.IsDefault == 1) {
if (upInfo.StoreType == 1) { if (upInfo.StoreType == 1) {
that.uploadStart(path, fileObj, callback) that.RealUploadToTencent(path, fileObj, callback)
} }
if (upInfo.StoreType == 2) { if (upInfo.StoreType == 2) {
that.uploadToAli(path, fileObj, callback) that.uploadToAli(path, fileObj, callback)
...@@ -229,7 +228,7 @@ export default { ...@@ -229,7 +228,7 @@ export default {
} else { } else {
if (upInfo && upInfo.IsDefault == 1) { if (upInfo && upInfo.IsDefault == 1) {
if (upInfo.StoreType == 1) { if (upInfo.StoreType == 1) {
this.uploadStart(path, fileObj, callback) this.RealUploadToTencent(path, fileObj, callback)
} }
if (upInfo.StoreType == 2) { if (upInfo.StoreType == 2) {
this.uploadToAli(path, fileObj, callback) this.uploadToAli(path, fileObj, callback)
...@@ -239,66 +238,46 @@ export default { ...@@ -239,66 +238,46 @@ export default {
} }
} }
}, },
Vue.prototype.uploadStart = function (path, fileObj, callback) { Vue.prototype.RealUploadToTencent = function (path, fileObj, callback) {
var upInfo = JSON.parse(localStorage.uploadInfo); var that = this;
//获取文件扩展名
var filename = fileObj.name;
var index = filename.lastIndexOf(".");
var suffix = filename.substr(index);
var timestamp1 = Date.parse(new Date()) + "_" + (Math.ceil(Math.random() * 1000));
let str = ''; let str = '';
if (this.isOnline()) { if (!this.isOnline()) {
str = "/Test" str = "/2024"
} }
var newFileName = str + '/Upload/' + path + "/" + timestamp1 + "" + suffix; var newFileName = str + '/Upload/' + path;
var uploadMsg = { var uploadUrl = that.domainManager().VTUploadUrl + "/Upload/UploadToTecent?isDomain=1&filePath=" + newFileName;
Bucket: upInfo.Bucket, var formData = new FormData();
Region: upInfo.Region, formData.append("myfile", fileObj);
SecretId: upInfo.SecretId, that.$http.post(uploadUrl, formData, {})
SecretKey: upInfo.SecretKey, .then(res => {
}; if (res && res.data.StatusCode == 1 && res.data.FilePath) {
var COS = require('cos-js-sdk-v5'); var uploadResult = {
var cos = new COS({ resultCode: 1,
SecretId: uploadMsg.SecretId, FileName: fileObj.name,
SecretKey: uploadMsg.SecretKey, FileUrl:res.data.FilePath,
}); VideoCoverImg: that.domainManager().VTViewUrl + res.data.VideoCoverImg
cos.putObject({ }
Bucket: uploadMsg.Bucket, if (callback) {
Region: uploadMsg.Region, //存储桶所在地域,必须字段 callback(uploadResult);
Key: newFileName, //文件名 }
StorageClass: 'STANDARD',
Body: fileObj, // 上传文件对象
onProgress: function (progressData) {}
}, function (err, data) {
if (data && data.statusCode == 200) {
var uploadResult = {
resultCode: 1,
FileName: fileObj.name,
FileUrl: "https://" + data.Location
}
if (callback) {
callback(uploadResult);
} }
} else { }).catch(function (reason) {
/*上传文件异常*/ console.log(reason)
console.log(err || data); });
}
});
}, },
//上传至阿里云【2024-05-20转为后台上传】 //上传至阿里云【2024-05-20转为后台上传】
Vue.prototype.uploadToAli = function (path, fileObj, successCall) { Vue.prototype.uploadToAli = function (path, fileObj, successCall) {
var that = this; var that = this;
let str = ''; let str = '';
if (this.isOnline()) { if (!this.isOnline()) {
str = "/2024" str = "/2024"
} }
var newFileName = str + '/Upload/' + path + "/"; var newFileName = str + '/Upload/' + path;
var uploadUrl = that.domainManager().VTUploadUrl + "/Upload/UploadToALiOSS?filePath=" + newFileName; var uploadUrl = that.domainManager().VTUploadUrl + "/Upload/UploadToALiOSS?isDomain=1&filePath=" + newFileName;
var formData = new FormData(); var formData = new FormData();
formData.append("myfile", fileObj); formData.append("myfile", fileObj);
that.$http.post(uploadUrl, formData, {}) that.$http.post(uploadUrl, formData, {})
.then(res => { .then(res => {
console.log("ali_res", res);
if (res && res.data.StatusCode == 1 && res.data.FilePath) { if (res && res.data.StatusCode == 1 && res.data.FilePath) {
var uploadResult = { var uploadResult = {
resultCode: 1, resultCode: 1,
......
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