tinymce vue拓展多图上传 实现拖拽切换位置,图片排序

实现功能:基于tinymce TinyMCE中文文档中文手册   拖拽图片排序,去掉全部上传按钮,点击保存上传图片并关闭弹窗,优化了一些交互提示

声明:本人不是做vue前端的,可能有些更好的方法实现拖拽或者其他一些开源库实现。

代码plugin.js:

tinymce.PluginManager.add('axupimgs', function(editor, url) {
	var pluginName='Ax多图片上传';
	window.axupimgs={}; //扔外部公共变量,也可以扔一个自定义的位置

	var baseURL=tinymce.baseURL;
	// var iframe1 = baseURL+'/plugins/axupimgs/upfiles.html';
	var iframe1 = location.origin+'/tinymce/axupimgs/upfiles_new.html';
    axupimgs.images_upload_handler = editor.getParam('images_upload_handler', 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=[];
	var openDialog = function() {
		isAddEventListener(true)
		return editor.windowManager.openUrl({
			title: pluginName,
			size: 'large',
			url:iframe1,
			buttons: [
				{
					type: 'custom',
					text: 'Close',
					name: 'close',
				},
				{
					type: 'custom',
					text: 'Save',
					name: 'save',
					primary: true
				},
			],
			onAction: function (api, details) {
				switch (details.name) {
					case 'save':
						//发送给upfiles,上传图片
						window.postMessage({ action: 'upLoadPictureFile' }, '*');
						break;
					case 'close':
						window.postMessage({ action: 'closeUpLoadPictureFile' }, '*');
						isAddEventListener(false)
						break;
					default:
						break;
				}
			},
		});
	};

	//保存
	function save() {
		// 链接插入富文本显示
		var html = '';
		var imgs = axupimgs.res;
		var len = imgs.length;
		for (let i = 0; i < len; i++) {
			if (imgs[i].url) {
				html += '<img src="' + imgs[i].url + '" />';
			}
		}
		editor.insertContent(html);
		axupimgs.res = [];
		tinymce.activeEditor.windowManager.close()
	};

	//处理消息
	function handleMessage(event){
		var data = event.data;
		if (data.action === 'savePictureFile') {
			save();
			isAddEventListener(false)
		}
	}

	//添加监听
	function isAddEventListener(isAdd){
		if(isAdd){
			// 接收来自 iframe1 的消息
			window.addEventListener('message', handleMessage, false)
		}else{
			window.removeEventListener('message',handleMessage, false)
		}
	}

	editor.ui.registry.getAll().icons.axupimgs || editor.ui.registry.addIcon('axupimgs','<svg viewBox="0 0 1280 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M1126.2,779.8V87.6c0-24-22.6-86.9-83.5-86.9H83.5C14.7,0.7,0,63.7,0,87.7v692c0,36.2,29.2,89.7,83.5,89.7l959.3-1.3c51.7,0,83.5-42.5,83.5-88.3zm-1044,4V86.3h961.6V783.7H82.2v0.1z" fill="#53565A"/><path d="M603,461.6L521.1,366.3,313,629.8,227.2,546.8,102.4,716.8H972.8v-170L768.2,235.2,603.1,461.6zM284.6,358.4a105.4,105.4,0,0,0,73.5-30c19.5-19.1,30.3-45,30.2-71.8,0-56.8-45.9-103-102.4-103-56.6,0-102.4,46.1-102.4,103C183.4,313.5,228,358.4,284.6,358.4z" fill="#9598A0"/><path d="M1197.7,153.6l-0.3,669.3s13.5,113.9-67.4,113.9H153.6c0,24.1,23.9,87.2,83.5,87.2h959.3c58.3,0,83.6-49.5,83.6-89.9V240.8c-0.1-41.8-44.9-87.2-82.3-87.2z" fill="#53565A"/></svg>');

	editor.ui.registry.addButton('axupimgs', {
		icon: 'axupimgs',
        tooltip: pluginName,
		onAction: function() {
			openDialog();
		}
	});
	editor.ui.registry.addMenuItem('axupimgs', {
		icon: 'axupimgs',
		text: '图片批量上传...',
		onAction: function() {
			openDialog();
		}
	});
	return {
		getMetadata: function() {
			return  {
				name: pluginName,
				url: "http://tinymce.ax-z.cn/more-plugins/axupimgs.php",
			};
		}
	};
});

htmlupfiles_new.html

<!doctype html>
<html>

<head>
    <meta charset="utf-8" />
    <title>axupimgs</title>
    <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <style>
        html,
        body {
            height: 100%;
            margin: 0;
            padding: 0;
            background: #fff;
        }

        ul {
            margin: 0;
            padding: 0;
            list-style: none;
        }

        #wrap {
            padding: 10px;
        }

        #topbar {
            padding: 10px 0;
            border-bottom: 1px solid #ccc;
            /* text-align: right; */
        }

        #topbar button {
            margin: 0;
            margin-left: 5px;
            outline: none;
            padding: 4px 16px;
            box-sizing: border-box;
            display: inline-block;
            border: none;
            border-radius: 3px;
            text-align: center;
            cursor: pointer;
            font-size: 14px;
            line-height: 1.5;
            background-color: #f0f0f0;
            color: #223;
        }

        #topbar button.primary {
            background-color: #3d97d4;
            color: #fff;
        }

        #topbar button:hover {
            background-color: #207ab7;
            color: #fff;
        }

        #topbar button.addfile {
            float: right;
        }

        #file_list {
            display: grid;
            grid-gap: 10px;
            grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
            padding-top: 10px;
        }

        #file_list:empty:after {
            content: '可以直接拖拽文件到这里';
            color: #777;
            font-size: 0.8em;
        }

        #file_list li {
            position: relative;
            display: block;
            vertical-align: top;
            padding: 5px 5px;
            border-radius: 5px;
        }

        #file_list li.up-over {}

        #file_list li.up-now {}

        #file_list li.up-now:after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            display: block;
            width: 100%;
            height: 100%;
            background: rgba(255, 255, 255, 0.8) url(loading.gif) center center no-repeat;
            border-radius: 5px;
            z-index: 999;
        }

        #file_list li:hover {
            background-color: #ddd;
        }

        #file_list li .picbox {
            display: flex;
            flex: 0 0 auto;
            justify-content: center;
            overflow: hidden;
            position: relative;
            width: 100%;
            padding-top: 100%;
            align-items: center;
        }

        #file_list li .picbox img {
            display: block;
            max-width: 100%;
            max-height: 100%;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translateX(-50%) translateY(-50%);
        }

        #file_list li.up-over .picbox:after {
            content: url('data:image/svg+xml;%20charset=utf8,%3Csvg%20viewBox%3D%220%200%201024%201024%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%3E%3Cpath%20d%3D%22M512%200C229.376%200%200%20229.376%200%20512s229.376%20512%20512%20512%20512-229.376%20512-512S794.624%200%20512%200z%22%20fill%3D%22%234AC711%22%3E%3C%2Fpath%3E%3Cpath%20d%3D%22M855.552%20394.752l-358.4%20358.4a50.9952%2050.9952%200%200%201-72.192%200l-204.8-204.8c-18.944-19.968-18.944-51.2%200-71.168a50.5344%2050.5344%200%200%201%2072.192-1.024L460.8%20644.608l322.048-322.048c19.968-18.944%2051.2-18.944%2071.168%200%2020.48%2019.456%2020.992%2051.712%201.536%2072.192z%22%20fill%3D%22%23FFFFFF%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E');
            position: absolute;
            bottom: 2px;
            right: 2px;
            z-index: 9;
        }

        #file_list li .tools {
            display: none;
            position: absolute;
            bottom: 5px;
            right: 5px;
            z-index: 99;
        }

        #file_list li:hover .tools {
            display: block;
        }

        #file_list li .tools .remove {
            cursor: pointer;
        }

        #file_list li .tools .remove:after {
            content: url('data:image/svg+xml;%20charset=utf8,%3Csvg%20width=%2224%22%20height=%2224%22%20viewBox=%220%200%2024%2024%22%20xmlns=%22http://www.w3.org/2000/svg%22%3E%3Cpath%20d=%22M17%206h3a1%201%200%200%201%200%202h-1v11a3%203%200%200%201-3%203H8a3%203%200%200%201-3-3V8H4a1%201%200%201%201%200-2h3V5a3%203%200%200%201%203-3h4a3%203%200%200%201%203%203v1zm-2%200V5a1%201%200%200%200-1-1h-4a1%201%200%200%200-1%201v1h6zm2%202H7v11a1%201%200%200%200%201%201h8a1%201%200%200%200%201-1V8zm-8%203a1%201%200%200%201%202%200v6a1%201%200%200%201-2%200v-6zm4%200a1%201%200%200%201%202%200v6a1%201%200%200%201-2%200v-6z%22%3E%3C/path%3E%3C/svg%3E');
        }

        #file_list li .namebox {
            font-size: 14px;
            line-height: 20px;
            max-height: 40px;
            overflow: hidden;
            padding: 5px 10px;
            text-align: center;
            display: flex;
            justify-content: center;
            align-items: flex-start;
        }

        #file_list li .namebox span {
            word-break: break-all;
            vertical-align: top;
        }

        #loading_overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(255, 255, 255, 0.8);
            /* 半透明白色背景 */
            z-index: 1000;
            /* 确保遮罩层在最顶层 */
            display: none;
            /* 初始隐藏 */
            justify-content: center;
            align-items: center;
            display: flex;
        }

        .loading_spinner {
            border: 4px solid #f3f3f3;
            /* Light grey */
            border-top: 4px solid #3498db;
            /* Blue */
            border-radius: 50%;
            width: 40px;
            height: 40px;
            animation: spin 1s linear infinite;
        }

        .loading_text {
            margin-top: 10px;
            font-size: 16px;
        }

        @keyframes spin {
            0% {
                transform: rotate(0deg);
            }

            100% {
                transform: rotate(360deg);
            }
        }
    </style>

</head>

<body>
    <div id="wrap">
        <div id="topbar"><button class="removeall">清空列表</button><button class="addfile primary">+ 添加文件</button></div>
        <ul id="file_list"></ul>
    </div>
    <!-- 加载遮罩层和动画 -->
    <div id="loading_overlay" style="display: none;">
        <div class="loading_spinner"></div>
        <!-- <div class="loading_text">加载中...</div> -->
    </div>

    <script>
        var editor = parent.tinymce.activeEditor;
        var axupimgs = parent.axupimgs;
        axupimgs.res = []; //存放本地文件的数组
        var blobInfo = { file: null }
        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) => {
                el.setAttribute('data-num', i);
            });
        }

        function addList(files) {
            var files_sum = files.length;
            var vDom = document.createDocumentFragment();
            for (let i = 0; i < files_sum; i++) {
                let file = files[i];
                let blobUrl = window.URL.createObjectURL(file)
                axupimgs.res.push({ file: file, blobUrl: blobUrl, url: '' });
                let li = document.createElement('li');
                li.setAttribute('class', 'up-no');
                li.setAttribute('data-time', file.lastModified);
                li.setAttribute('draggable', 'true');
                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);
        }


        //清空列表
        document.querySelector('#topbar .removeall').addEventListener('click', () => {
            if (axupimgs.res.length > 0) {
                if (confirm("确定清空列表吗")) {
                    axupimgs.res = []
                    document.querySelectorAll('#file_list li').forEach((el, i) => {
                        el.parentNode.removeChild(el)
                    });
                }
            }

        });
        //是否内部拖动
        var isInputDrag = false
        //拖拽添加
        document.addEventListener('dragover', (e) => {
            e.stopPropagation();
            e.preventDefault();
            if (isInputDrag) {
                e.dataTransfer.dropEffect = 'move';
            } else {
                e.dataTransfer.dropEffect = 'copy';
            }
        });
        document.addEventListener('dragend', (e) => {
            isInputDrag = false
        });
        document.addEventListener('dragstart', (e) => {
            isInputDrag = true
            e.dataTransfer.effectAllowed = 'move';
            var li = e.target.parentNode.parentNode;
            var n = li.getAttribute('data-num');
            e.dataTransfer.setData('text/plain', n);
        });
        document.addEventListener('drop', (e) => {
            e.stopPropagation();
            e.preventDefault();
            // 获取目标元素
            let target = e.target;
            // 获取鼠标指针相对于目标元素的位置
            let mouseX = e.clientX;
            let targetRect = target.getBoundingClientRect();
            let targetCenterX = targetRect.left + targetRect.width / 2;
            var isLeft = true
            // 判断鼠标指针在目标元素的左侧还是右侧
            if (mouseX < targetCenterX) {
                // 在左侧的处理逻辑
                isLeft = true
            } else {
                isLeft = false
                // 在右侧的处理逻辑
            }
            //内部拖拽
            if (isInputDrag) {
                //拖拽有问题未完成(有时候切换不了位置)
                var li = e.target.parentNode.parentNode;
                if (li) {
                    var oldData = e.dataTransfer.getData('text/plain');
                    try {
                        var newData = li.getAttribute('data-num');
                        if (newData == null) {
                            newData = e.target.parentNode.getAttribute('data-num')
                        }
                        // 可能会引发异常的代码块
                    } catch (error) {
                        newData = e.target.parentNode.getAttribute('data-num')
                        // 异常处理代码块
                    }
                    console.log("打印切换位置:", oldData, newData)
                    if (newData && oldData && (oldData != newData)) {
                        var oldEl = document.querySelectorAll('#file_list li')[oldData];
                        var newEl = document.querySelectorAll('#file_list li')[newData];
                        if (newEl && oldEl) {
                            if (newData !== oldData) {
                                if (isLeft) {
                                    document.querySelector('#file_list').insertBefore(oldEl, newEl);
                                } else {
                                    insertAfter(oldEl, newEl)
                                }
                                changePosition(oldData, newData, isLeft)
                            }
                        }
                    }
                }
                return false
            }
            if (!e.dataTransfer.files) { return false; }
            var dropfiles = e.dataTransfer.files;
            if (!(dropfiles.length > 0)) { return false; }
            var exts = axupimgs.axupimgs_filetype.replace(/(\s)+/g, '').toLowerCase().split(',');
            var files = [];
            for (let file of dropfiles) {
                ext = file.name.split('.');
                ext = '.' + ext[ext.length - 1];
                for (let s of exts) {
                    if (s == ext) {
                        files.push(file);
                        break;
                    }
                }
            }
            if (files.length > 0) { addList(files) }
        });

        //添加文件
        document.querySelector('#topbar .addfile').addEventListener('click', () => {
            var input = document.createElement('input');
            input.setAttribute('type', 'file');
            input.setAttribute('multiple', 'multiple');
            input.setAttribute('accept', axupimgs.axupimgs_filetype);
            input.click();
            input.onchange = function () {
                var files = this.files;
                addList(files);
            }
        });

        var file_i = 0;

        //功能: 在targetElement之后插入 新节点newElement
        function insertAfter(newElement, targetElement) {
            var parent = targetElement.parentNode;
            if (parent.lastChild == targetElement) {
                parent.appendChild(newElement);
            } else {
                parent.insertBefore(newElement, targetElement.nextSibling);
            }
        }

        //上传所有文件
        function upAllFiles() {
            // isShowAddFile(false)
            isShowLoading(true)
            axupimgs.res.forEach((data, index) => {
                console.log(`Index ${index}: ${data.isUpLoad}`, data.url);
                //isUpLoad:undefined未上传 1成功 -1:失败 2:上传中 
                if (data.isUpLoad == undefined || data.isUpLoad == -1) {
                    blobInfo.file = data.file;
                    uploadFile(index, blobInfo)
                }
            });
        }
        //单独上传文件
        function uploadFile(index, blobInfo) {
            axupimgs.res[index].isUpLoad = 2;
            upload_handler(blobInfo, function (url) {
                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) != '/') {
                        url = upload_base_path + '/' + url;
                    } else {
                        url = upload_base_path + url;
                    }
                }
                axupimgs.res[index].url = url;
                axupimgs.res[index].isUpLoad = 1;
                filename = url.split('/').pop();
                var li = document.querySelectorAll('#file_list li')[index];

                li.setAttribute('class', 'up-over');
                li.querySelector('.namebox span').innerText = filename;
                window.parent.postMessage({ action: 'upLoadPictureFileProgress' }, '*');
            }, function (err) {
                document.querySelectorAll('#file_list li.up-now').forEach((el, i) => {
                    el.setAttribute('class', 'up-no');
                });
                axupimgs.res[index].isUpLoad = -1;
                window.parent.postMessage({ action: 'upLoadPictureFileProgress' }, '*');
                var name = axupimgs.res[index].file.name
                if (alert("图片" + name + "上传失败:" + err)) {

                }
            });
        }

        //判断是否全部上传
        function checkisAllUpLoad() {
            const finedData = axupimgs.res.find(item => item.isUpLoad !== 1);
            if (finedData) {
                return false;
            } else {
                return true;
            }
        }

        //判断是否正在上传中
        function checkisUpLoadLoading() {
            const finedData = axupimgs.res.find(item => item.isUpLoad === 2);
            if (finedData) {
                return true;
            } else {
                return false;
            }
        }

        //切换位置
        function changePosition(oldIndex, newIndex, isLeft) {
            let oldData = axupimgs.res[oldIndex];
            let newData = axupimgs.res[newIndex];
            //右移
            if (newIndex > oldIndex) {
                axupimgs.res.splice(oldIndex, 1);
                console.log("axupimgs.res-右移", isLeft, oldIndex, newIndex)
                axupimgs.res.splice(isLeft ? newIndex - 1 : newIndex, 0, oldData);
            }
            //左移
            if (newIndex < oldIndex) {
                axupimgs.res.splice(oldIndex, 1);
                console.log("axupimgs.res-左移", isLeft, oldIndex, newIndex)
                if (!isLeft) {
                    if (newIndex >= axupimgs.res.length) {
                        newIndex = newIndex
                    } else {
                        newIndex++
                    }
                }
                axupimgs.res.splice(newIndex, 0, oldData);
            }
            axupimgs.res.forEach((element) => {
                console.log("name:", element.file.name);
            });

        }

        //接收js发送的message
        window.parent.addEventListener('message', function (event) {
            var data = event.data;
            //上传图片
            if (data.action === 'upLoadPictureFile') {
                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';
                    });
                    if (checkisAllUpLoad()) {
                        console.log("upLoadPictureFile-图片全部上传成功")
                        window.parent.postMessage({ action: 'savePictureFile' }, '*');
                    } else {
                        console.log("upLoadPictureFile-图片正在上传或者上传失败")
                        upAllFiles();
                    }
                } else {
                    if (confirm("暂未上传图片,确定要关闭吗")) {
                        close();
                    }
                }
            }
            //进度
            if (data.action === 'upLoadPictureFileProgress') {
                if (checkisAllUpLoad()) {
                    window.parent.postMessage({ action: 'savePictureFile' }, '*');
                }
                // isShowAddFile(!checkisUpLoadLoading())
                isShowLoading(checkisUpLoadLoading())
            }
            //关闭弹窗
            if (data.action === 'closeUpLoadPictureFile') {
                checkClose();
            }

        }, false);
        // 检测关闭弹窗
        function checkClose() {
            console.log("checkClose", axupimgs.res)
            if (axupimgs.res.length > 0) {
                if (confirm("系统可不会保存您的编辑,确定要关闭吗")) {
                    close();
                }
            } else {
                close();
            }
        }
        //关闭弹窗
        function close() {
            window.parent.tinymce.activeEditor.windowManager.close();
        }
        //是否显示添加文件按钮
        function isShowAddFile(isShow) {
            document.querySelector('.addfile').style.display = isShow ? 'inline' : 'none';
        }

        // 获取 loading 遮罩层元素
        var loadingOverlay = document.getElementById('loading_overlay');

        // 当需要显示 loading 时调用此函数
        function isShowLoading(isShow) {
            loadingOverlay.style.display = isShow ? 'flex' : 'none'; // 显示遮罩层
            document.body.style.pointerEvents = isShow ? 'none' : 'auto'; // 禁用页面点击事件
        }

        var observ_flist = new MutationObserver((muList, observe) => {
            if (muList[0].addedNodes.length > 0) {
                muList[0].addedNodes.forEach((el) => {
                    el.querySelector('.remove').addEventListener('click', (e) => {
                        var li = e.target.parentNode.parentNode;
                        var n = li.getAttribute('data-num');
                        var el = document.querySelectorAll('#file_list li')[n];
                        el.parentNode.removeChild(el);
                        axupimgs.res.splice(n, 1);
                    });
                });
            }
            reSort();
        });
        observ_flist.observe(document.querySelector('#file_list'), { childList: true });

    </script>
</body>

</html>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/801319.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

TS 入门(五):TypeScript接口与类

目录 前言回顾高级类型与类型操作1. 接口a. 基本接口b. 可选属性和只读属性c. 函数类型接口d. 可索引类型e. 接口继承 2. 类a. 基本类b. 类的成员&#xff08;属性和方法&#xff09;c. 构造函数d. 继承和派生类e. 公有、私有和受保护的修饰符f. 静态属性和方法g. 抽象类 扩展知…

算法篇 滑动窗口 leetcode 长度最小的子数组

长度最小的子数组 1. 题目描述2. 算法图分析2.1 暴力图解2.2 滑动窗口图解 3. 代码演示 1. 题目描述 2. 算法图分析 2.1 暴力图解 2.2 滑动窗口图解 3. 代码演示

React基础学习-Day04

React基础学习-Day04 常见的钩子函数及基础使用方式 1.useState useState 是 React 的一个 Hook&#xff0c;用于在函数组件中添加状态。它返回一个状态变量和一个更新该状态的函数。与类组件的 this.state 和 this.setState 相对应&#xff0c;useState 让函数组件也能拥有…

借助 Aspose.Words,在 C# 中将 Word 转换为 JPG

有时我们需要将 Word 文档转换为图片&#xff0c;因为 DOC 或 DOCX 文件在不同设备上的显示可能会有所不同&#xff0c;但图像&#xff08;例如 JPG 格式&#xff09;在任何地方看起来都一样。 Aspose.Words 是一种高级Word文档处理API&#xff0c;用于执行各种文档管理和操作…

设计模式-UML类图

1.UML概述 UML-统一建模语言&#xff0c;用来设计软件的可视化建模语言&#xff1b; 1.1 UML分类 静态结构图&#xff1a;类图、对象图、组件图、部署图动态行为图&#xff1a;状态图、活动图、时序图、协作图、构件图等 类图&#xff1a;反应类与类结构之间的关系&#xff0…

非法闯入智能监测摄像机:安全守护的新利器

在当今社会&#xff0c;安全问题愈发受到重视。随着科技的进步&#xff0c;非法闯入智能监测摄像机应运而生&#xff0c;成为保护家庭和财产安全的重要工具。这种摄像机不仅具备监控功能&#xff0c;还集成了智能识别和报警系统&#xff0c;能够在第一时间内检测到潜在的入侵行…

【三维AIGC】扩散模型LDM辅助3D Gaussian重建三维场景

标题&#xff1a;《Sampling 3D Gaussian Scenes in Seconds with Latent Diffusion Models》 来源&#xff1a;Glasgow大学&#xff1b;爱丁堡大学 连接&#xff1a;https://arxiv.org/abs/2406.13099 提示&#xff1a;写完文章后&#xff0c;目录可以自动生成&#xff0c;如何…

Vue3 组件向下通信 祖孙组件的通信 provide与inject

介绍 当父子间通信可以使用props&#xff0c;祖孙使用provide&#xff08;传递&#xff09;或inject&#xff08;接收&#xff09;&#xff0c; 这时不管组件套的多深都可以向下传递。 例子 现在有一个需求&#xff0c;把App.vue的数据传递到MusciPlay.vue里。 App.vue …

Latte: Latent Diffusion Transformer for Video Generation

文章目录 AbstractIntroductionMethodology潜在扩散模型的初步研究Latte的模型变体Latte的实验验证潜在视频片段的patch embeddingTimestep-class information injectionTemporal positional embedding通过学习策略增强视频生成 Experiments Abstract Latte首先从输入的视频提…

150个pb网站模板(都是成品网站,上传php空间即可使用),建站必备

一网友提供的150个pb网站模板&#xff0c;其实就是成品网站&#xff0c;上传php空间即可使用&#xff0c;属于建站公司或者建站开发人员必备的资源。 一共150个基于pb的成品网站&#xff0c;基本上都可以找到适应你手头客户需要的一款&#xff0c;简单修改一下即可交活收钱了。…

python实例练习00001:打开文件输出文件内容

try:file input(enter the file :)with open(file, r) as f:data f.read()print(data) except FileNotFoundError:print(fthe file {file} does not exists:) 打开windows的cmd运行程序&#xff0c;效果如下&#xff1a;

晏子春秋-读书笔记四

景公游于寿春&#xff0c;坐于路寝。公曰&#xff1a;“嗟乎&#xff01;使我有此国&#xff0c;吾将如之何&#xff1f;”晏子对曰&#xff1a;“此国非君之有也&#xff0c;乃先君之有也。君若欲有之&#xff0c;则修先君之德&#xff0c;以顺民心&#xff1b;若不欲有之&…

使用Jmeter进行接口自动化测试

Jmeter接口自动化 1.接口文档分析接口四要素2.自动化2.1使用用户常量来维护自动化用例2.2使用CSV文件存储常量2.3结果断言法2.4 Json提取器 接口自动化测试的意义也相当于是自动化 测试的意义 减少人为错误&#xff1a;自动化测试可以减少人为因素带来的错误&#xff0c;确保测…

RK3399基础部分

1.RK3399介绍 基础特性&#xff1a; 高达1.8GHz的双核Cortex-A72 四核Cortex-A53高达1.4GHz NPU高达3.0TOPS Mali-T860MP4 GPU 双通道DDR3/DDR3L/LPDDR3/LPDDR4 4K超高清H265/H264/VP9 HDR10/HLG H264编码器 双MIPI CSI和ISP USB Type-CGPU: 图形处理器&#xff08;英语&…

智汇云舟智慧粮仓解决方案有哪些应用场景和价值?

“粮食”作为人类生活的生命之源&#xff0c;在人们的日常生活中起着决定性的作用。智慧粮仓是运用数字孪生、物联网、商业智能、云计算等技术&#xff0c;精确采集粮食存储过程中的所有信息&#xff0c;并整合到一个统一的信息管理平台上&#xff0c;同时粮库信息管理平台对所…

jmeter持续学习之---控制器

IF控制器 下面这种写法jmeter不推荐有性能的问题 jmeter推荐勾选上的这种写法 使用"Interpret Condition as Variable Expression"工具的性能要好一些 循环控制器 ForEach控制器 与用户定义的变量或者正则表达式提取器配合使用,循环读取。用户定义的变量或者正则…

状态管理的艺术:探索Flutter的Provider库

状态管理的艺术&#xff1a;探索Flutter的Provider库 前言 上一篇文章中&#xff0c;我们详细介绍了 Flutter 应用中的状态管理&#xff0c;以及 StatefulWidget 和 setState 的使用。 本篇我们继续介绍另一个实现状态管理的方式&#xff1a;Provider。 Provider优缺点 基…

VGMShield:揭秘视频生成模型滥用的检测与追踪技术

人工智能咨询培训老师叶梓 转载标明出处 视频生成模型&#xff0c;如 Stable Video Diffusion 和 Videocrafter&#xff0c;已经能够生成合理且高分辨率的视频。但这些技术进步也带来了被恶意利用的风险&#xff0c;比如用于制造假新闻或进行政治宣传。因此&#xff0c;来自弗…

【顺序表】算法题 --- 力扣

一、移除元素 移除元素 这个题让我们移除数组nums中值为val的元素&#xff0c;最后返回k&#xff08;不是val的元素个数&#xff09; 这样显然我们就不能再创建一个数组来解决这个问题了&#xff0c;只能另辟蹊径 思路&#xff1a;双指针 这里定义两个指针&#xff08;l1&…

solidity基础语法(以太坊solidity合约)

solidity基础语法&#xff08;以太坊solidity合约&#xff09; 1-值类型和取值范围2-引用类型3-引用类型高阶4-固定数组和动态数组 1-值类型和取值范围 https://learnblockchain.cn/docs/solidity/introduction-to-smart-contracts.html#subcurrency https://learnblockchain…