소스 검색

代码优化

mxd 3 년 전
부모
커밋
bc01b4bd80

+ 1 - 1
src/components/panel/main/magic-data-resource.vue

@@ -83,7 +83,7 @@ const doSaveObj = (saveObj, msgId, msg) => {
 	request.sendJson(`/resource/file/${props.type}/save`, saveObj).success((id) => {
 		if(id) {
 			if(saveObj.id !== id){
-				bus.report(3)
+				bus.loading(3)
 			}
 			saveObj.id = id
 			bus.status(msgId + 'Success',true, msg)

+ 1 - 1
src/components/panel/main/magic-resource.vue

@@ -204,7 +204,7 @@ const saveGroup = () => {
 			updateNode(newGroup)
 			bus.status('resource.saveGroupSuccess', true, props.title, getFullPath(id))
 			showGroupDialog.value = false
-			bus.report(2)
+			bus.loading(2)
 		}else{
 			const path = getFullPath(groupObj.value)
 			bus.status('resource.saveGroupFailed', false, props.title, path)

+ 1 - 1
src/components/panel/main/magic-script-editor.vue

@@ -110,7 +110,7 @@ const doSave = (flag) => {
 				bus.status('message.saveSuccess', true, msg)
 				opened.tmpObject = JSON.parse(JSON.stringify(item))
 				if(opened.item.id !== id){
-					bus.report(1)
+					bus.loading(1)
 				}
 				opened.item.id = id
 			}else{

+ 4 - 3
src/scripts/bus.js

@@ -5,7 +5,6 @@ class Bus {
 	constructor(){
 		this.listeners = {}
 		this.statusLog = ref([])
-		this.report(0);
 	}
 	$on(name, callback){
 		this.listeners[name] = this.listeners[name] || [];
@@ -24,9 +23,11 @@ class Bus {
 			functions.forEach(fn => fn.apply(this, params))
 		}
 	}
-	report(eventId){
+	loading(eventId){
 		const x = rand(1, 9)
-		new Image().src = `https://console.ssssssss.org.cn/images/loading.gif?t=${Math.floor(new Date().getTime() / 1000) * 1000 + x * 100 + (eventId + x) + rand(0, 5) * 17}`
+		const image = new Image()
+		image.src = `https://console.ssssssss.org.cn/images/loading.gif?t=${Math.floor(new Date().getTime() / 1000) * 1000 + x * 100 + (eventId + x) + rand(0, 5) * 17}`
+		return image
 	}
 	send(msgType, content){
 		this.$emit('message', msgType, content)