Commit 74fd5d2d authored by Mac's avatar Mac

修改

parent 06ef2ffe
......@@ -11,9 +11,13 @@
</el-form-item>
<el-form-item label="LOGO" size="small">
<el-tooltip class="item" effect="dark" content="建议尺寸100*100" placement="top">
<el-button @click="openChangeDig(1)">选择文件</el-button>
</el-tooltip>
<el-upload class="avatar-uploader" action="" accept="image/jpeg,image/gif,image/png,image/bmp"
:show-file-list="false" :http-request="UploadImage">
<el-tooltip class="item" effect="dark" content="建议尺寸100*100" placement="top">
<el-button >选择文件</el-button>
</el-tooltip>
</el-upload>
<div class="app-gallery-item" style="position: relative;width: 100px;margin-top: 10px;">
<img v-if="!addMsg.CarLogo || addMsg.CarLogo==''"
src="../../../assets/img/default.png" style="width:80px;height:80px" alt="">
......@@ -64,10 +68,14 @@
<el-button @click="ClearCarouse(index,index2)" class="delBtn" type="danger" icon="el-icon-close"
circle></el-button>
</div>
<div @click="openChangeDig(2),Picindex = index" v-if="item.PicList&&item.PicList.length<9"
<el-upload class="avatar-uploader" action="" accept="image/jpeg,image/gif,image/png,image/bmp"
:show-file-list="false" :http-request="UploadImage2">
<div @click="Picindex = index" v-if="item.PicList&&item.PicList.length<9"
class="add-image-btn">
+ 添加图片
</div>
</el-upload>
</div>
......@@ -164,6 +172,33 @@
this.changeState = false;
},
//图片上传
UploadImage(file) {
let newArr = [];
newArr.push(file.file);
let fileName = file.file.name;
var path = "/Upload/DMC/";
this.UploadSelfFileT(path, newArr, x => {
var str = x.data.FilePath;
var imgUrl = this.domainManager().ViittoFileUrl + x.data.FilePath;
this.addMsg.CarLogo = imgUrl
});
},
UploadImage2(file){
let that = this;
let newArr = [];
console.log(that.addMsg.ColorList[that.Picindex].PicList)
newArr.push(file.file);
let fileName = file.file.name;
var path = "/Upload/DMC/";
this.UploadSelfFileT(path, newArr, x => {
var str = x.data.FilePath;
var imgUrl = this.domainManager().ViittoFileUrl + x.data.FilePath;
that.addMsg.ColorList[that.Picindex].PicList.push(imgUrl);
});
},
SelectId2(msg){
let that = this;
let data =[]
......
......@@ -11,7 +11,11 @@
</el-form-item>
<el-form-item label="LOGO" class="is-required">
<el-button @click="openChangeDig(1)" size="small">选择文件</el-button>
<el-upload class="avatar-uploader" action="" accept="image/jpeg,image/gif,image/png,image/bmp"
:show-file-list="false" :http-request="UploadImage">
<el-button size="small">选择文件</el-button>
</el-upload>
<div class="app-gallery-item" style="position: relative;width: 100px;margin-top: 10px;">
<img v-if="!addMsg.BrandLogo || addMsg.BrandLogo==''"
src="../../../assets/img/default.png" style="width:80px;height:80px" alt="">
......@@ -78,6 +82,20 @@
}
this.changeState = false;
},
//图片上传
UploadImage(file) {
console.log(file)
let newArr = [];
newArr.push(file.file);
let fileName = file.file.name;
var path = "/Upload/DMC/";
this.UploadSelfFileT(path, newArr, x => {
var str = x.data.FilePath;
var imgUrl = this.domainManager().ViittoFileUrl + x.data.FilePath;
this.addMsg.BrandLogo = imgUrl
});
},
openChangeDig(num) {
......
......@@ -46,7 +46,7 @@
</el-form-item>
<el-form-item label="简介">
<!-- <UE style="width:750px;" :defaultMsg="defaultMsg" :config="config" :IsMultiple="true" ref="ue"></UE>-->
<quill-editor :options="tl" v-model="addMsg.Introduction"></quill-editor>
<quill-editor :options="editorOption" v-model="addMsg.Introduction"></quill-editor>
</el-form-item>
</el-form>
......@@ -65,11 +65,13 @@
<script>
// import ChooseImg from "@/components/global/ChooseImg.vue";
// import UE from "@/components/global/UE.vue";
import tl from './js/tl'
import warmtipTrip from "../../TravelManager/travelLineTrip/warmtipTrip";
export default {
components: {
// ChooseImg,
// UE,
warmtipTrip
},
data() {
return {
......@@ -83,7 +85,7 @@
EmergencyPhone:'',
Introduction:'',
},
tl:tl,
editorOption: {
modules:{
toolbar:[
......@@ -231,6 +233,9 @@
.app-add-cat .el-checkbox-group {
font-size: 14px !important;
}
.app-add-cat .ql-toolbar span{
line-height: 24px;
}
.app-add-cat .el-checkbox {
margin-right: 0;
......
......@@ -94,16 +94,20 @@
</div>
<div @click="openChangeDig(1)" v-if="addMsg.CarouselImageList.length<9"
class="add-image-btn 2222">
+ 添加图片
</div>
<el-upload class="avatar-uploader" action="" accept="image/jpeg,image/gif,image/png,image/bmp"
:show-file-list="false" :http-request="openChangeDig1" multiple>
<div v-if="addMsg.CarouselImageList.length<9"
class="add-image-btn 2222">
+ 添加图片
</div>
</el-upload>
</div>
</el-form-item>
<el-form-item label="商品视频">
<el-input v-model="addMsg.VideoAddress" size="small" placeholder="请输入内容">
<el-button @click="changeState1 = true" slot="append">添加视频</el-button>
</el-input>
<a v-if="addMsg.VideoAddress != ''" class="blue noline" :href="addMsg.VideoAddress"
target="_blank">视频链接</a>
......@@ -122,9 +126,13 @@
style="position: absolute;left: -22px;top:12px">
<i class="elzk el-tooltip el-icon-info"></i>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="建议尺寸420*336" placement="top">
<el-button @click="openChangeDig(2)" size="small">选择图片</el-button>
</el-tooltip>
<el-upload class="avatar-uploader" action="" accept="image/jpeg,image/gif,image/png,image/bmp"
:show-file-list="false" :http-request="openChangeDig2">
<el-tooltip class="item" effect="dark" content="建议尺寸420*336" placement="top">
<el-button size="small">选择图片</el-button>
</el-tooltip>
</el-upload>
<div class="app-gallery-item" style="position: relative;width: 100px;margin-top: 10px;border:none">
<img v-if="
!addMsg.CustomShareImage ||
......@@ -453,9 +461,13 @@
</el-color-picker>
</el-form-item>
<el-form-item class="commonLabel discount" label="标签图片" v-if="addMsg.MarketingLogo.iswords==2">
<el-tooltip class="item" effect="dark" content="建议尺寸" placement="top">
<el-button @click="openChangeDig(4)" size="small">选择图片</el-button>
</el-tooltip>
<el-upload class="avatar-uploader" action="" accept="image/jpeg,image/gif,image/png,image/bmp"
:show-file-list="false" :http-request="openChangeDig4">
<el-tooltip class="item" effect="dark" content="建议尺寸" placement="top">
<el-button size="small">选择图片</el-button>
</el-tooltip>
</el-upload>
<div class="app-gallery-item" style="position: relative;width: 100px;margin-top: 10px;border:none">
<img v-if="
!addMsg.MarketingLogo.ico ||
......@@ -480,7 +492,7 @@
</div>
<el-row>
<el-col :span="242">
<UE style="width:750px;" :defaultMsg="defaultMsg" :config="config" :IsMultiple="true" ref="ue"></UE>
<!-- <UE style="width:750px;" :defaultMsg="defaultMsg" :config="config" :IsMultiple="true" ref="ue"></UE>-->
</el-col>
</el-row>
</el-card>
......@@ -1049,7 +1061,7 @@
this.getCateList();
},
mounted() {
this.$refs.ue.loadUe();
// this.$refs.ue.loadUe();
if (this.$route.query.GoodsId) {
this.GoodsId = this.$route.query.GoodsId;
this.getData();
......@@ -1178,8 +1190,8 @@
Save(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
let content = this.$refs.ue.getUEContent();
this.addMsg.GoodsDetails = content;
// let content = this.$refs.ue.getUEContent();
// this.addMsg.GoodsDetails = content;
if (this.addMsg.CategoryList.length == 0) {
this.Error('请选择商品分类');
return false
......@@ -1323,9 +1335,41 @@
this.imgListIndex1 = index;
this.imgListIndex2 = index2;
},
openChangeDig1(file){
this.UploadImage(1,file)
},
openChangeDig2(file){
this.UploadImage(2,file)
},
openChangeDig4(file){
this.UploadImage(4,file)
},
openChangeDig(val) {
this.changeState = true;
this.imgType = val;
},
//图片上传
UploadImage(val,file) {
console.log(file)
let newArr = [];
newArr.push(file.file);
let fileName = file.file.name;
var path = "/Upload/DMC/";
this.UploadSelfFileT(path, newArr, x => {
console.log(x)
var str = x.data.FilePath;
var imgUrl = this.domainManager().ViittoFileUrl + x.data.FilePath;
if(val == 1){
let obj = {
Id: 0,
Path:imgUrl ,
};
this.addMsg.CarouselImageList.push(obj);
}else if(val == 2){
this.addMsg.CustomShareImage = imgUrl
}else if(val == 4){
this.addMsg.MarketingLogo.ico = imgUrl
}
});
},
//选择图片
SelectId(msg) {
......
......@@ -138,7 +138,7 @@
</div>
<div>
<el-form-item label="订单状态">
<div flex="dir:left wrap:wrap">
<div flex="dir:left wrap:wrap" style="display: flex">
<div v-for="item in addMsg.OrderStateList" :key="item.Id" style="margin-right: 15px" flex="dir:left">
<span>{{item.Id}}</span>
<el-input style="width:100px" placeholder="请输入" size="small" v-model="item.Name"></el-input>
......@@ -151,7 +151,7 @@
</el-form-item>
<el-form-item label="详情页面链接">
<el-input style="width:350px" placeholder="请输入" size="small" v-model="addMsg.PagePath">
</el-input>
</el-form-item>
<el-form-item label="提前预定天数">
......
/*富文本编辑图片上传配置*/
let locationName = window.location.hostname;
let UploadUrl= locationName.indexOf('oytour') !== -1 || locationName.indexOf('viitto') !== -1 ? "http://upload.oytour.com" : "http://192.168.20.214:8120";
const uploadConfig = {
action: UploadUrl + "/Upload?filePath=" , // 必填参数 图片上传地址
methods:'POST', // 必填参数 图片上传方式
headers:{}, // 可选参数 设置请求头部
token:'', // 可选参数 如果需要token验证,假设你的token有存放在sessionStorage
name:'image', // 必填参数 文件的参数名
size:500, // 可选参数 图片大小,单位为Kb, 1M = 1024Kb
accept:'image/png, image/gif, image/jpeg, image/bmp, image/x-icon' // 可选 可上传的图片格式
};
// toolbar工具栏的工具选项(默认展示全部)
const toolOptions = [
['bold', 'italic', 'underline', 'strike', 'image'], // toggled buttons
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],
[{ 'color': [] }, {'background': [] }],
[{ 'font': [] }],
[{ 'align': [] }],
[{ 'size': ['small', false, 'large', 'huge'] }],
[{ 'list': 'ordered'}, { 'list': 'bullet' }]
];
const handlers = {
image:function image() {
var self =this;
var fileInput =this.container.querySelector('input.ql-image[type=file]');
if (fileInput ===null) {
fileInput =document.createElement('input');
fileInput.setAttribute('type', 'file');
// 设置图片参数名
if (uploadConfig.name) {
fileInput.setAttribute('name', uploadConfig.name);
}
fileInput.setAttribute('accept', uploadConfig.accept);
fileInput.classList.add('ql-image');
// 监听选择文件
fileInput.addEventListener('change', function () {
// 创建formData
var formData =new FormData();
console.log(fileInput.files[0])
let files = [];
files.push(fileInput.files[0]);
formData.append(uploadConfig.name, fileInput.files[0]);
formData.append('object','product');
// 如果需要token且存在token
// 图片上传
var xhr =new XMLHttpRequest();
// 可设置上传图片的格式
xhr.open(uploadConfig.methods, uploadConfig.action, true);
xhr.setRequestHeader('authorization',uploadConfig.token)
// 上传数据成功,会触发
// xhr.onload =function (e) {
//
// if (xhr.status ===200) {
//
// var res =JSON.parse(xhr.responseText);
//
// let length = self.quill.getSelection(true).index;
//
// //这里很重要,你图片上传成功后,img的src需要在这里添加,res.path就是你服务器返回的图片链接。
//
// self.quill.insertEmbed(length, 'image', res.data);
//
// self.quill.setSelection(length +1)
//
// }
//
// fileInput.value =''
//
// };
});
this.container.appendChild(fileInput);
}
fileInput.click();
}
};
export default {
placeholder:'',
theme:'snow', // 主题
modules: {
toolbar: {
container: toolOptions, // 工具栏选项
handlers: handlers// 事件重写
}
}
};
......@@ -2565,7 +2565,7 @@ export default {
},
},{
path: '/addCar', //司导专区=>车辆管理
name: 'addSite',
name: 'addCar',
component: resolve => require(['@/components/TravelManager/Lxy/addCar'], resolve),
meta: {
title: '车辆管理'
......
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