提交 4aeaecd6 authored 作者: caicai's avatar caicai

修复bug

上级 0894299e
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
"electron:serve": "vue-cli-service electron:serve", "electron:serve": "vue-cli-service electron:serve",
"postinstall": "electron-builder install-app-deps", "postinstall": "electron-builder install-app-deps",
"postuninstall": "electron-builder install-app-deps", "postuninstall": "electron-builder install-app-deps",
"electron:generate-icons": "electron-icon-builder --input=./public/logo_512.png --output=build --flatten" "electron:generate-icons": "electron-icon-builder --input=./public/logo_1200.png --output=build --flatten"
}, },
"main": "background.js", "main": "background.js",
"resolutions": { "resolutions": {
......
export function getSchemaDefaul(schemaJson) {
let mapList = {
"index-index": "course",
"global-setting": "global",
"global-left": "global",
"contentobject-title": "contentobject",
"content": "content",
"component-base": "component",
"block": "block",
"article": "article",
};
let defaultObj = {};
for(let key in schemaJson) {
let settting = schemaJson[key].tabgroup_list[0].setting_list;
// schemaJson[key].tabgroup_list[0]
// defaultObj[mapList[key]] = schemaJson[key].tabgroup_list[0]
defaultObj[mapList[key]] = {};
settting.forEach(v=>{
if(v['display'] == 1) {
defaultObj[mapList[key]][v["key_name"]] = v["default"]
}
})
}
return defaultObj;
}
export function translateDataToTree(data, parentIdName, childIdName) {
data.forEach(v => {
v['isFolder'] = v._type == 'menu' ? 'folder' : 'file';
})
//没有父节点的数据
let parents = data.filter(value => value[parentIdName] == 'undefined' || value[parentIdName] == null || value[parentIdName] == 0) ;
//有父节点的数据
let children = data.filter(value => value[parentIdName] !== 'undefined' && value[parentIdName] != null && value[parentIdName] != 0);
//定义转换方法的具体实现
let translator = (parents, children) => {
//遍历父节点数据
parents.forEach((parent) => {
//遍历子节点数据
children.forEach((current, index) => {
//此时找到父节点对应的一个子节点
if (current[parentIdName] === parent[childIdName]) {
//对子节点数据进行深复制,这里只支持部分类型的数据深复制,对深复制不了解的童靴可以先去了解下深复制
let temp = JSON.parse(JSON.stringify(children))
//让当前子节点从temp中移除,temp作为新的子节点数据,这里是为了让递归时,子节点的遍历次数更少,如果父子关系的层级越多,越有利
temp.splice(index, 1)
//让当前子节点作为唯一的父节点,去递归查找其对应的子节点
translator([current], temp)
//把找到子节点放入父节点的children属性中
typeof parent.children !== 'undefined' ? parent.children.push(current) : parent.children = [current]
}
if(current['course-_type'] == "course") {
current['label'] = current['course-displayTitle'];
} else {
current['label'] = current['title'];
}
if((current._type === 'menu') && !current.children) {
current.children = [];
}
})
parent['label'] = parent['title'];
})
}
//调用转换方法
translator(parents, children)
//返回最终的结果
return parents
}
export function navAndOpenTagPage({path,query, params, pageId, isBack}) { // pageId : 可以是课程id,保证唯一性 export function navAndOpenTagPage({path,query, params, pageId, isBack}) { // pageId : 可以是课程id,保证唯一性
// 跳转并打开新的标签页 // 跳转并打开新的标签页
let routeUrl = this.$router.resolve({ let routeUrl = this.$router.resolve({
...@@ -185,42 +101,6 @@ export function appendStyle({document, style, id = "customStyleOne"}) { ...@@ -185,42 +101,6 @@ export function appendStyle({document, style, id = "customStyleOne"}) {
} }
} }
// 获取各页面所在目录树层级
export function getTreeLayer({data, children = "children"}) {
const layerSet = {
current:0,
};
let getChild = (parent, ) => {
if( !parent ) return null;
let child = parent[children];
if( child && Array.isArray( child ) ) return child;
return null;
};
let getData = ( info ) => {
let current = getChild(info);
if(current) {
layerSet.current++;
current.forEach( ( item ) => {
// 记录当前页面/主题 位于第几层
layerSet[item._id] = layerSet.current;
getData( item );
} );
}
};
// 获取
if(data && Array.isArray( data )) {
data.forEach( v => {
getData(v);
} );
}else if( data ){
getData(data);
}
return layerSet;
}
export function isElectron() { export function isElectron() {
// Renderer process // Renderer process
if (typeof window !== 'undefined' && typeof window.process === 'object' && window.process.type === 'renderer') { if (typeof window !== 'undefined' && typeof window.process === 'object' && window.process.type === 'renderer') {
......
import { ipcMain, dialog, Menu, BrowserWindow, app} from 'electron' import { ipcMain, dialog, Menu, BrowserWindow, app, screen} from 'electron'
import { saveJson } from '@/libs/utils/backfunction.js'; import { saveJson } from '@/libs/utils/backfunction.js';
const fs = require('fs'); const fs = require('fs');
const { exec, execSync } = require('child_process'); const { exec, execSync } = require('child_process');
...@@ -53,8 +53,9 @@ class IpcEvents { ...@@ -53,8 +53,9 @@ class IpcEvents {
// 显示右键菜单 // 显示右键菜单
ipcMain.on('show-context-menu', (event) => { ipcMain.on('show-context-menu', (event) => {
const displayDetail = screen.getPrimaryDisplay();
let currentMode = this.store.get("currentMode"); let currentMode = this.store.get("currentMode");
let displayWH = this.store.get("primaryDisplayWH"); let displayWH = displayDetail.size;
let template = [ let template = [
{ {
label: '简约模式', label: '简约模式',
......
...@@ -34,6 +34,8 @@ const store = new Store({ ...@@ -34,6 +34,8 @@ const store = new Store({
}, },
}); });
store.clear(); //清空
export const windowsCfg = { export const windowsCfg = {
id: '', //唯一id id: '', //唯一id
title: '', //窗口标题 title: '', //窗口标题
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<div v-if="mode === 'modeJiJian'" class="group1_wrap center"> <div v-if="mode === 'modeJiJian'" class="group1_wrap center">
<img src="~@/assets/yunpingtai.png" alt="" class="yun_img"> <img src="~@/assets/yunpingtai.png" alt="" class="yun_img">
</div> </div>
<block v-if="mode === 'modeJianYue'" class="group_list"> <div v-if="mode === 'modeJianYue'" class="group_list">
<div v-for="(cateItem, cateIndex) in cateList" <div v-for="(cateItem, cateIndex) in cateList"
v-show="cateItem.softList && cateItem.softList.length > 0" v-show="cateItem.softList && cateItem.softList.length > 0"
:key="cateIndex" class="group1_wrap"> :key="cateIndex" class="group1_wrap">
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<span class="app_name">{{ appItem.name }}</span> <span class="app_name">{{ appItem.name }}</span>
</div> </div>
</div> </div>
</block> </div>
</div> </div>
</template> </template>
......
...@@ -156,17 +156,25 @@ export default { ...@@ -156,17 +156,25 @@ export default {
this.ipcRenderer.on("manageVisible", (event,visible) => { this.ipcRenderer.on("manageVisible", (event,visible) => {
// console.log('visible 2', visible) // console.log('visible 2', visible)
}) })
// 获取到base64
this.ipcRenderer.on("base64Info", (event, { url, index, time }) => {
url = url.replace(/[\r\n]/g, "");
this.appList[index].icon = url;
});
// 获取到app列表 // 获取到app列表
this.ipcRenderer.on("appsList", (event, list) => { this.ipcRenderer.on("appsList", (event, list) => {
// console.log("获取到app列表 2", list); // console.log("获取到app列表 2", list);
this.listObj.lastest = list; this.listObj.lastest = list;
this.appList = list; this.appList = list;
// this.appList.forEach((item, index) => { this.appList.forEach((item, index) => {
// // console.log(item.icon) // console.log(item.icon)
// if (item.icon && (item.icon.indexOf('data:image/png') == -1 && item.icon.indexOf('data:image/svg') == -1) && item.searchIcon === true) { if (item.icon
// this.ipcRenderer.send("getBase64", { imagePath: item.icon, index }); && (item.icon.indexOf('data:image/png') == -1 && item.icon.indexOf('data:image/svg') == -1)
// } && item.searchIcon === true) {
// }); // console.log('getBase64', index)
this.ipcRenderer.send("getBase64", { imagePath: item.icon, index });
}
});
// this.getPinyin(); // this.getPinyin();
}); });
this.ipcRenderer.on("category-list", (event, list) => { this.ipcRenderer.on("category-list", (event, list) => {
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论