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>
|
||||
<body>
|
||||
<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>
|
||||
</div>
|
||||
|
||||
@@ -54,7 +54,6 @@
|
||||
blobInfo.blob = function(){return this.file;}
|
||||
var upload_handler = axupimgs.images_upload_handler;
|
||||
var upload_base_path = axupimgs.images_upload_base_path;
|
||||
|
||||
//为列表添加排序
|
||||
function reSort(){
|
||||
document.querySelectorAll('#file_list li').forEach((el,i)=>{
|
||||
@@ -74,8 +73,17 @@
|
||||
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>';
|
||||
vDom.appendChild(li);
|
||||
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -134,7 +142,7 @@
|
||||
file_i = n;
|
||||
if(len == n){
|
||||
file_i=0;
|
||||
document.querySelector('#topbar .upall').innerText='全部上传';
|
||||
// document.querySelector('#topbar .upall').innerText='全部上传';
|
||||
return true;
|
||||
}
|
||||
if( axupimgs.res[n].url!='' ){
|
||||
@@ -142,9 +150,8 @@
|
||||
upAllFiles(n)
|
||||
}else{
|
||||
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.slice(-1)=='/' && url.substr(0,1)=='/' ){
|
||||
url = upload_base_path + url.slice(1);
|
||||
}else if(upload_base_path.slice(-1)!='/' && url.substr(0,1)!='/' ){
|
||||
@@ -154,33 +161,34 @@
|
||||
}
|
||||
}
|
||||
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];
|
||||
li.setAttribute('class','up-over');
|
||||
li.querySelector('.namebox span').innerText = filename;
|
||||
n++
|
||||
upAllFiles(n);
|
||||
},function(err){
|
||||
document.querySelector('#topbar .upall').innerText='全部上传';
|
||||
document.querySelectorAll('#file_list li.up-now').forEach((el,i)=>{
|
||||
el.setAttribute('class','up-no');
|
||||
});
|
||||
alert(err);
|
||||
// document.querySelector('#topbar .upall').innerText='全部上传';
|
||||
// document.querySelectorAll('#file_list li.up-now').forEach((el,i)=>{
|
||||
// el.setAttribute('class','up-no');
|
||||
// });
|
||||
// alert(err);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
document.querySelector('#topbar .upall').addEventListener('click',(e)=>{
|
||||
if(e.target.innerText!='全部上传'){return false;}
|
||||
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';
|
||||
});
|
||||
e.target.innerText='上传中...';
|
||||
upAllFiles(0);
|
||||
}
|
||||
});
|
||||
//
|
||||
// document.querySelector('#topbar .upall').addEventListener('click',(e)=>{
|
||||
// if(e.target.innerText!='全部上传'){return false;}
|
||||
// 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';
|
||||
// });
|
||||
// e.target.innerText='上传中...';
|
||||
// upAllFiles(0);
|
||||
// }
|
||||
// });
|
||||
|
||||
var observ_flist = new MutationObserver( (muList,observe)=>{
|
||||
if(muList[0].addedNodes.length>0){
|
||||
|
||||
@@ -5,7 +5,8 @@ tinymce.PluginManager.add('axupimgs', function(editor, url) {
|
||||
|
||||
// var baseURL=tinymce.baseURL;
|
||||
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.axupimgs_filetype = editor.getParam('axupimgs_filetype', '.png,.gif,.jpg,.jpeg', 'string');
|
||||
axupimgs.res = [];
|
||||
|
||||
@@ -117,9 +117,15 @@ const init = reactive({
|
||||
let formData = new FormData()
|
||||
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) => {
|
||||
// 使用案例http://tinymce.ax-z.cn/general/upload-images.php
|
||||
// meta.filetype //根据这个判断点击的是什么file image media
|
||||
@@ -192,12 +198,16 @@ const init = reactive({
|
||||
watch(() => {
|
||||
emit("update:value", content.value);
|
||||
});
|
||||
const uploadFile = (formData, url,success) => {
|
||||
let loading= ElLoading.service({
|
||||
const uploadFile = (formData, url, success, isLoading) => {
|
||||
let loading = null
|
||||
if (isLoading) {
|
||||
loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '图片上传中...',
|
||||
background: 'rgba(0, 0, 0, 0.7)',
|
||||
})
|
||||
}
|
||||
|
||||
axios.post(
|
||||
import.meta.env.VITE_BASE_URL + url,
|
||||
formData,
|
||||
@@ -214,11 +224,19 @@ const uploadFile = (formData, url,success) => {
|
||||
let data = res.data
|
||||
if (data.code !== 1000) {
|
||||
ElMessage.error(data.msg)
|
||||
if (loading) {
|
||||
loading.close()
|
||||
}
|
||||
} else {
|
||||
if (isLoading) {
|
||||
success(data.data.url)
|
||||
} else {
|
||||
success(data.data.url, data.data.originalFilename)
|
||||
}
|
||||
if (loading) {
|
||||
loading.close()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
@@ -240,6 +258,7 @@ const uploadFile = (formData, url,success) => {
|
||||
border-radius: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.tinymce-boxz > textarea {
|
||||
display: none;
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
</div>
|
||||
<paging :current-page="pageInfo.pageNum" :page-size="pageInfo.pageSize" :page-sizes="[10, 20, 30, 40,50]"
|
||||
: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>
|
||||
|
||||
<script setup lang="jsx">
|
||||
|
||||
Reference in New Issue
Block a user