提交 d25a8f50 authored 作者: 王天霸's avatar 王天霸

1

上级 bb11853a
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
ENV = 'development' ENV = 'development'
# 正式环境 # 正式环境
#VUE_APP_BASE_API = 'http://sjapi.jxhh.com' VUE_APP_BASE_API = 'http://sjapi.jxhh.com'
# 开发环境 # 开发环境
VUE_APP_BASE_API = 'http://192.168.111.34:8200' #VUE_APP_BASE_API = 'http://192.168.111.36:8200'
# 路由懒加载 # 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true VUE_CLI_BABEL_TRANSPILE_MODULES = true
...@@ -67,7 +67,8 @@ ...@@ -67,7 +67,8 @@
"vue-router": "3.0.2", "vue-router": "3.0.2",
"vue-splitpane": "1.0.4", "vue-splitpane": "1.0.4",
"vuedraggable": "2.20.0", "vuedraggable": "2.20.0",
"vuex": "3.1.0" "vuex": "3.1.0",
"xlsx": "^0.17.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "7.0.0", "@babel/core": "7.0.0",
......
...@@ -131,12 +131,15 @@ ...@@ -131,12 +131,15 @@
<el-upload <el-upload
class="avatar-uploader2" class="avatar-uploader2"
action="#" action="#"
auto-upload
:http-request="uploadSectionFile" :http-request="uploadSectionFile"
name="file" name="file"
multiple
:show-file-list="false" :show-file-list="false"
:file-list="ruleFormdialogImageUrl" :file-list="ruleFormdialogImageUrl"
:before-upload="beforeUploadEdit"> :before-upload="beforeUploadEdit">
</el-upload> </el-upload>
<input class="uploadImg" style="display: none;" type="file" ref="file" accept="image/*" @change="fileChange($event)" name="file" multiple id="file">
<quill-editor ref="myTextEditor" v-model="content" :options="editorOption" @change="onEditorChange" style="height:500px;margin-top:-30px;"></quill-editor> <quill-editor ref="myTextEditor" v-model="content" :options="editorOption" @change="onEditorChange" style="height:500px;margin-top:-30px;"></quill-editor>
</el-form-item> </el-form-item>
<el-form-item style="margin-bottom: 0;"> <el-form-item style="margin-bottom: 0;">
...@@ -248,6 +251,8 @@ ...@@ -248,6 +251,8 @@
freightList: [], freightList: [],
options1: [], options1: [],
/*8888888888888*/ /*8888888888888*/
index:0,
indexall:0,
editorOption: { editorOption: {
placeholder: '', placeholder: '',
theme: 'snow', // or 'bubble' theme: 'snow', // or 'bubble'
...@@ -258,7 +263,7 @@ ...@@ -258,7 +263,7 @@
'image': function (value) { 'image': function (value) {
if (value) { if (value) {
// 触发input框选择图片文件 // 触发input框选择图片文件
document.querySelector('.avatar-uploader2 input').click() document.querySelector('#file').click()
} else { } else {
this.quill.format('image', false); this.quill.format('image', false);
} }
...@@ -325,6 +330,45 @@ ...@@ -325,6 +330,45 @@
this.getBrands(); this.getBrands();
}, },
methods: { methods: {
fileChange(e){
const list = this.$refs.file.files;
console.log(list)
this.indexall = list.length
this.uplonds()
},
uplonds(){
this.getBase64(this.$refs.file.files[this.index]).then((res) => {
let result = res.split(",");
this.Base64img = result[1];
let data = {"image": this.Base64img}
this.quillUpdateImg = true;
UploadImg(data).then(res => {
if (res && res.data.code == 1) {
this.index++
this.ruleFormdialogImageUrl.push({'url': res.data.data.imageUrl});
this.$message({ message:'上传成功',type:'success'});
// 获取富文本组件实例
let quill = this.$refs.myTextEditor.quill;
let length = quill.getSelection().index;
// 插入图片 res.data.url为服务器返回的图片地址
quill.insertEmbed(length, 'image', res.data.data.imageUrl)
// 调整光标到最后
quill.setSelection(length + 1)
if(this.index<this.indexall){
this.uplonds()
}else{
this.index = 0
this.quillUpdateImg = false;
}
}else {
this.$message({ message:'上传失败,请重新上传',type:'error'});
this.quillUpdateImg = false;
}
})
});
},
/*************************/ /*************************/
// 上传图片前 // 上传图片前
beforeUploadEdit(res, file) { beforeUploadEdit(res, file) {
...@@ -332,12 +376,13 @@ ...@@ -332,12 +376,13 @@
this.quillUpdateImg = true this.quillUpdateImg = true
}, },
// 上传图片成功 // 上传图片成功
uploadSectionFile(param) { uploadSectionFile(param, file, fileList) {
this.quillUpdateImg = true;
this.getBase64(param.file).then((res) => { this.getBase64(param.file).then((res) => {
let result = res.split(","); let result = res.split(",");
this.Base64img = result[1]; this.Base64img = result[1];
let data = {"image": this.Base64img} let data = {"image": this.Base64img}
this.quillUpdateImg = true;
UploadImg(data).then(res => { UploadImg(data).then(res => {
if (res && res.data.code == 1) { if (res && res.data.code == 1) {
this.ruleFormdialogImageUrl.push({'url': res.data.data.imageUrl}); this.ruleFormdialogImageUrl.push({'url': res.data.data.imageUrl});
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论