Merge pull request 'master' (#936) from master into prod
Reviewed-on: http://git.feashow.cn/clay/mosr-web/pulls/936
This commit is contained in:
@@ -42,7 +42,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="wrap">
|
<div id="wrap">
|
||||||
<div id="topbar"><button class="addfile primary">+ 添加文件</button><button class="upall primary">全部上传</button><button class="removeall">清空列表</button></div>
|
<div id="topbar"><button class="addfile primary">+ 添加文件</button><button class="removeall">清空列表</button></div>
|
||||||
<ul id="file_list"></ul>
|
<ul id="file_list"></ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -54,7 +54,6 @@
|
|||||||
blobInfo.blob = function(){return this.file;}
|
blobInfo.blob = function(){return this.file;}
|
||||||
var upload_handler = axupimgs.images_upload_handler;
|
var upload_handler = axupimgs.images_upload_handler;
|
||||||
var upload_base_path = axupimgs.images_upload_base_path;
|
var upload_base_path = axupimgs.images_upload_base_path;
|
||||||
|
|
||||||
//为列表添加排序
|
//为列表添加排序
|
||||||
function reSort(){
|
function reSort(){
|
||||||
document.querySelectorAll('#file_list li').forEach((el,i)=>{
|
document.querySelectorAll('#file_list li').forEach((el,i)=>{
|
||||||
@@ -74,8 +73,17 @@
|
|||||||
li.setAttribute('data-time',file.lastModified);
|
li.setAttribute('data-time',file.lastModified);
|
||||||
li.innerHTML='<div class="picbox"><img src="'+blobUrl+'"></div><div class="namebox"><span>'+file.name+'</span></div><div class="tools"><a class="remove"></a></div>';
|
li.innerHTML='<div class="picbox"><img src="'+blobUrl+'"></div><div class="namebox"><span>'+file.name+'</span></div><div class="tools"><a class="remove"></a></div>';
|
||||||
vDom.appendChild(li);
|
vDom.appendChild(li);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
document.querySelector('#file_list').appendChild(vDom);
|
document.querySelector('#file_list').appendChild(vDom);
|
||||||
|
if(axupimgs.res.length>0){
|
||||||
|
document.querySelectorAll('#file_list li.up-no').forEach((el,i)=>{
|
||||||
|
el.classList ? el.classList.add('up-now') : el.className+=' up-now';
|
||||||
|
});
|
||||||
|
upAllFiles(0);
|
||||||
|
}
|
||||||
|
|
||||||
//reSort();
|
//reSort();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +142,7 @@
|
|||||||
file_i = n;
|
file_i = n;
|
||||||
if(len == n){
|
if(len == n){
|
||||||
file_i=0;
|
file_i=0;
|
||||||
document.querySelector('#topbar .upall').innerText='全部上传';
|
// document.querySelector('#topbar .upall').innerText='全部上传';
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if( axupimgs.res[n].url!='' ){
|
if( axupimgs.res[n].url!='' ){
|
||||||
@@ -142,9 +150,8 @@
|
|||||||
upAllFiles(n)
|
upAllFiles(n)
|
||||||
}else{
|
}else{
|
||||||
blobInfo.file=axupimgs.res[n].file;
|
blobInfo.file=axupimgs.res[n].file;
|
||||||
upload_handler(blobInfo,function(url){
|
upload_handler(blobInfo,function(url,name){
|
||||||
if(upload_base_path){
|
if(upload_base_path){
|
||||||
|
|
||||||
if(upload_base_path.slice(-1)=='/' && url.substr(0,1)=='/' ){
|
if(upload_base_path.slice(-1)=='/' && url.substr(0,1)=='/' ){
|
||||||
url = upload_base_path + url.slice(1);
|
url = upload_base_path + url.slice(1);
|
||||||
}else if(upload_base_path.slice(-1)!='/' && url.substr(0,1)!='/' ){
|
}else if(upload_base_path.slice(-1)!='/' && url.substr(0,1)!='/' ){
|
||||||
@@ -154,33 +161,34 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
axupimgs.res[file_i].url = url;
|
axupimgs.res[file_i].url = url;
|
||||||
filename = url.split('/').pop();
|
// filename = url.split('/').pop();
|
||||||
|
filename = name
|
||||||
var li = document.querySelectorAll('#file_list li')[file_i];
|
var li = document.querySelectorAll('#file_list li')[file_i];
|
||||||
li.setAttribute('class','up-over');
|
li.setAttribute('class','up-over');
|
||||||
li.querySelector('.namebox span').innerText = filename;
|
li.querySelector('.namebox span').innerText = filename;
|
||||||
n++
|
n++
|
||||||
upAllFiles(n);
|
upAllFiles(n);
|
||||||
},function(err){
|
},function(err){
|
||||||
document.querySelector('#topbar .upall').innerText='全部上传';
|
// document.querySelector('#topbar .upall').innerText='全部上传';
|
||||||
document.querySelectorAll('#file_list li.up-now').forEach((el,i)=>{
|
// document.querySelectorAll('#file_list li.up-now').forEach((el,i)=>{
|
||||||
el.setAttribute('class','up-no');
|
// el.setAttribute('class','up-no');
|
||||||
});
|
// });
|
||||||
alert(err);
|
// alert(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//
|
||||||
document.querySelector('#topbar .upall').addEventListener('click',(e)=>{
|
// document.querySelector('#topbar .upall').addEventListener('click',(e)=>{
|
||||||
if(e.target.innerText!='全部上传'){return false;}
|
// if(e.target.innerText!='全部上传'){return false;}
|
||||||
if(axupimgs.res.length>0){
|
// if(axupimgs.res.length>0){
|
||||||
document.querySelectorAll('#file_list li.up-no').forEach((el,i)=>{
|
// document.querySelectorAll('#file_list li.up-no').forEach((el,i)=>{
|
||||||
el.classList ? el.classList.add('up-now') : el.className+=' up-now';
|
// el.classList ? el.classList.add('up-now') : el.className+=' up-now';
|
||||||
});
|
// });
|
||||||
e.target.innerText='上传中...';
|
// e.target.innerText='上传中...';
|
||||||
upAllFiles(0);
|
// upAllFiles(0);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
var observ_flist = new MutationObserver( (muList,observe)=>{
|
var observ_flist = new MutationObserver( (muList,observe)=>{
|
||||||
if(muList[0].addedNodes.length>0){
|
if(muList[0].addedNodes.length>0){
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ tinymce.PluginManager.add('axupimgs', function(editor, url) {
|
|||||||
|
|
||||||
// var baseURL=tinymce.baseURL;
|
// var baseURL=tinymce.baseURL;
|
||||||
var iframe1 = '/upfiles.html';
|
var iframe1 = '/upfiles.html';
|
||||||
axupimgs.images_upload_handler = editor.getParam('images_upload_handler', undefined, 'function');
|
console.log('editor',editor)
|
||||||
|
axupimgs.images_upload_handler = editor.getParam('images_upload_handler_not_loading', undefined, 'function');
|
||||||
axupimgs.images_upload_base_path = editor.getParam('images_upload_base_path', '', 'string');
|
axupimgs.images_upload_base_path = editor.getParam('images_upload_base_path', '', 'string');
|
||||||
axupimgs.axupimgs_filetype = editor.getParam('axupimgs_filetype', '.png,.gif,.jpg,.jpeg', 'string');
|
axupimgs.axupimgs_filetype = editor.getParam('axupimgs_filetype', '.png,.gif,.jpg,.jpeg', 'string');
|
||||||
axupimgs.res = [];
|
axupimgs.res = [];
|
||||||
|
|||||||
@@ -117,9 +117,15 @@ const init = reactive({
|
|||||||
let formData = new FormData()
|
let formData = new FormData()
|
||||||
formData.append('file', blobInfo.blob())
|
formData.append('file', blobInfo.blob())
|
||||||
//上传图片接口 上传成功后返回图片地址,用于显示在富文本中
|
//上传图片接口 上传成功后返回图片地址,用于显示在富文本中
|
||||||
uploadFile(formData, props.imageUrl, success)
|
uploadFile(formData, props.imageUrl, success, true)
|
||||||
// }),
|
// }),
|
||||||
},
|
},
|
||||||
|
images_upload_handler_not_loading: (blobInfo, success) => {
|
||||||
|
let formData = new FormData()
|
||||||
|
formData.append('file', blobInfo.blob())
|
||||||
|
//上传图片接口
|
||||||
|
uploadFile(formData, props.imageUrl, success, false)
|
||||||
|
},
|
||||||
file_picker_callback: (callback, value, meta) => {
|
file_picker_callback: (callback, value, meta) => {
|
||||||
// 使用案例http://tinymce.ax-z.cn/general/upload-images.php
|
// 使用案例http://tinymce.ax-z.cn/general/upload-images.php
|
||||||
// meta.filetype //根据这个判断点击的是什么file image media
|
// meta.filetype //根据这个判断点击的是什么file image media
|
||||||
@@ -192,12 +198,16 @@ const init = reactive({
|
|||||||
watch(() => {
|
watch(() => {
|
||||||
emit("update:value", content.value);
|
emit("update:value", content.value);
|
||||||
});
|
});
|
||||||
const uploadFile = (formData, url,success) => {
|
const uploadFile = (formData, url, success, isLoading) => {
|
||||||
let loading= ElLoading.service({
|
let loading = null
|
||||||
|
if (isLoading) {
|
||||||
|
loading = ElLoading.service({
|
||||||
lock: true,
|
lock: true,
|
||||||
text: '图片上传中...',
|
text: '图片上传中...',
|
||||||
background: 'rgba(0, 0, 0, 0.7)',
|
background: 'rgba(0, 0, 0, 0.7)',
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
axios.post(
|
axios.post(
|
||||||
import.meta.env.VITE_BASE_URL + url,
|
import.meta.env.VITE_BASE_URL + url,
|
||||||
formData,
|
formData,
|
||||||
@@ -214,11 +224,19 @@ const uploadFile = (formData, url,success) => {
|
|||||||
let data = res.data
|
let data = res.data
|
||||||
if (data.code !== 1000) {
|
if (data.code !== 1000) {
|
||||||
ElMessage.error(data.msg)
|
ElMessage.error(data.msg)
|
||||||
|
if (loading) {
|
||||||
loading.close()
|
loading.close()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (isLoading) {
|
||||||
success(data.data.url)
|
success(data.data.url)
|
||||||
|
} else {
|
||||||
|
success(data.data.url, data.data.originalFilename)
|
||||||
|
}
|
||||||
|
if (loading) {
|
||||||
loading.close()
|
loading.close()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -240,6 +258,7 @@ const uploadFile = (formData, url,success) => {
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.tinymce-boxz > textarea {
|
.tinymce-boxz > textarea {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<paging :current-page="pageInfo.pageNum" :page-size="pageInfo.pageSize" :page-sizes="[10, 20, 30, 40,50]"
|
<paging :current-page="pageInfo.pageNum" :page-size="pageInfo.pageSize" :page-sizes="[10, 20, 30, 40,50]"
|
||||||
:total="total" @changeSize="handleSizeChange" @goPage="handleCurrentChange"/>
|
:total="total" @changeSize="handleSizeChange" @goPage="handleCurrentChange"/>
|
||||||
<user-picker :multiple="true" ref="userPicker" title="请选择研发人员" v-model:value="userList" @ok="selected"/>
|
<user-picker :multiple="true" ref="userPicker" title="请选择次账号" v-model:value="userList" @ok="selected"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="jsx">
|
<script setup lang="jsx">
|
||||||
|
|||||||
Reference in New Issue
Block a user