提交 5dac108d authored 作者: 蔡芬's avatar 蔡芬

1

上级 cb00b1b8
{
"name": "course_creation",
"name": "feidao",
"version": "0.1.0",
"lockfileVersion": 1,
"requires": true,
......
{
"name": "course_creation",
"name": "feidao",
"version": "0.1.2",
"private": true,
"scripts": {
......@@ -9,6 +9,7 @@
"test:e2e": "vue-cli-service test:e2e",
"lint": "vue-cli-service lint",
"electron:build": "vue-cli-service electron:build",
"electron:build32": "vue-cli-service electron:build --win --ia32",
"electron:serve": "vue-cli-service electron:serve",
"postinstall": "electron-builder install-app-deps",
"postuninstall": "electron-builder install-app-deps"
......
public/favicon.ico

4.2 KB | W: | H:

public/favicon.ico

16.6 KB | W: | H:

public/favicon.ico
public/favicon.ico
public/favicon.ico
public/favicon.ico
  • 2-up
  • Swipe
  • Onion skin
......@@ -16,7 +16,7 @@ export default {
},
mounted() {
this.style.height = document.documentElement.clientHeight + 'px';
window.onresize = function temp() {
window.onresize = () => {
this.style.height = document.documentElement.clientHeight + 'px';
};
}
......
"use strict";
import { app, protocol, BrowserWindow } from "electron";
import { app, protocol, BrowserWindow, shell, Menu, ipcMain, globalShortcut } from "electron";
import path from 'path';
import { createProtocol } from "vue-cli-plugin-electron-builder/lib";
import installExtension, { VUEJS_DEVTOOLS } from "electron-devtools-installer";
const isDevelopment = process.env.NODE_ENV !== "production";
......@@ -15,19 +16,32 @@ try {
require('electron-reloader')(module);
} catch {}
async function createWindow() {
// 关闭顶部导航菜单栏
Menu.setApplicationMenu(null)
// Create the browser window.
const win = new BrowserWindow({
width: 800,
height: 600,
center: true, //窗口居中
title: "飞稻平台", //如果由loadURL()加载的HTML文件中含有标签<title>,此属性将被忽略
icon: path.join(__static, '/favicon.ico'), //图标更换,仅支持svg、ico ,在public下
// resizable:false, //窗口大小是否可以改变
// maximizable: false, //窗口是否可以最大化
// frame: false, //无边框窗口
webPreferences: {
// Required for Spectron testing
enableRemoteModule: !!process.env.IS_TEST,
// Use pluginOptions.nodeIntegration, leave this alone
// See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION,
contextIsolation: !process.env.ELECTRON_NODE_INTEGRATION,
// nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION,
nodeIntegration: true, //web开启主进程中集成node
// contextIsolation: !process.env.ELECTRON_NODE_INTEGRATION,
contextIsolation: false,
preload: path.join(__dirname, 'preload.js')
},
});
......@@ -40,7 +54,46 @@ async function createWindow() {
// Load the index.html when not in development
win.loadURL("app://./index.html");
}
win.on('closed', () => {
win = null
});
// 注册一个'CommandOrControl+Shift+i' 快捷键监听器
const ret = globalShortcut.register('CommandOrControl+Shift+i', function () {
win.webContents.openDevTools()
});
if (!ret) {
console.log('registration failed')
}
//检查快捷键是否注册成功
// console.log(globalShortcut.isRegistered('CommandOrControl+X'))
// win.webContents.on('new-window', (event, url, frameName, disposition, options, additionalFeatures) => {
// event.preventDefault()
// Object.assign(options, {
// // modal: true,
// // parent: win,
// title: frameName,
// frame: false,
// width: 300,
// height: 400
// })
// // 创建新的窗口
// var a = new BrowserWindow(options)
// a.loadURL(url)
// ipcMain.on('close-app', () => {
// // 通知关闭
// a.close();
// ipcMain.removeAllListeners('close-app')
// });
// // if (!process.env.IS_TEST) a.webContents.openDevTools()
// })
}
ipcMain.on('fromFullPage', e => {
console.log('主进程监听到渲染进程');
});
// Quit when all windows are closed.
app.on("window-all-closed", () => {
......@@ -73,6 +126,14 @@ app.on("ready", async () => {
createWindow();
});
//所有第三方链接,都通过默认浏览器打开
// app.on('web-contents-created', (e, webContents) => {
// webContents.on('new-window', (event, url) => {
// event.preventDefault();
// shell.openExternal(url);
// });
// });
// Exit cleanly on request from parent process in development mode.
if (isDevelopment) {
if (process.platform === "win32") {
......
......@@ -52,14 +52,14 @@ export default {
},
methods: {
handleRemove(file) {
console.log(file);
// console.log(file);
},
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url;
this.dialogVisible = true;
},
handleDownload(file) {
console.log(file);
// console.log(file);
}
}
......
......@@ -14,7 +14,7 @@ export default {
},
methods: {
inputHandle(e) {
console.log(e.target.value, this.value)
// console.log(e.target.value, this.value)
this.$emit('input', e.target.value);
//分发校验事件
// this.$parent.$emit('validate');
......
......@@ -40,7 +40,7 @@ export default {
},
methods: {
tap(type) {
console.log('tap',type)
// console.log('tap',type)
switch(type) {
case "bold":
this.toggleStyle('font-weight','bold','normal');
......@@ -55,7 +55,7 @@ export default {
// this.toggleStyle('colorpicker','underline','none');
break;
}
console.log(this.detail)
// console.log(this.detail)
},
toggleStyle(styleName,selVal,defVal) {
this.detail.style[styleName] = this.detail.style[styleName] != selVal ? selVal : defVal;
......
......@@ -4,6 +4,7 @@
<div>
是否显示弹窗1 {{showPop}}
</div>
<a href="https://www.baidu.com" target="_blank" @click="outerLink">baidu</a>
<TopHead :detail="detail" :ruleForm="ruleForm"></TopHead>
<TopBody :list="articleList" @addArticle="addArticle"></TopBody>
<el-drawer
......@@ -57,6 +58,7 @@ import RichEditor from '@/components/common/richEditor.vue';
import NumberInput from '@/components/common/numberInput.vue';
import SelectField from '@/components/common/selectField.vue';
import ImageUpload from '@/components/common/imageUpload.vue';
// const { ipcRenderer } = window.require('electron'); //浏览器端报错
export default {
props: {
detail: Object,
......@@ -92,6 +94,9 @@ export default {
},
mounted() {
this.articleList = this.children;
// ipcRenderer.send('fromFullPage'); //往主进程发送消息 -使用方法一
this.$electron && this.$electron.ipcRenderer.send('fromFullPage'); //往主进程发送消息 -使用方法二, 基于main.js 挂载了 electron
},
beforeDestroy() {
this.closePop();
......@@ -119,13 +124,17 @@ export default {
done();
},
handleClick(tab, event) {
console.log(tab, event);
// console.log(tab, event);
},
changeVal(value) {
console.log(value)
console.log(this.ruleForm)
console.log(this.tabList)
}
// console.log(value)
// console.log(this.ruleForm)
// console.log(this.tabList)
},
outerLink(event) {
this.$electron && event.preventDefault(); //浏览器 不阻止
this.$electron && this.$electron.shell.openExternal("https://www.baidu.com"); //electron 打开默认浏览器访问
},
},
}
</script>
......
......@@ -29,7 +29,7 @@ export default {
},
methods: {
addBlock() {
console.log('添加组件')
// console.log('添加组件')
this.$emit('addBlock',this.demoBlock)
},
},
......
......@@ -16,7 +16,7 @@ export default {
},
methods: {
selectComponent() {
console.log('选择组件')
// console.log('选择组件')
this.componentShow = true;
},
},
......
......@@ -27,7 +27,7 @@ export default {
},
methods: {
addArticle() {
console.log('新增章节');
// console.log('新增章节');
this.$emit('addArticle', this.demoArticle)
},
addBlock(obj) {
......
......@@ -118,7 +118,7 @@ export function post(url,data = {}){
return new Promise((resolve,reject) => {
axios.post(url,data)
.then(response => {
console.log(response)
// console.log(response)
if(response.data.code === 200){
resolve(response.data);
}else{
......
import Vue from "vue";
import VueElectron from './vue_electron.js';
import App from "./App.vue";
import router from "./router";
import store from "./store";
......@@ -7,6 +8,8 @@ import { Button, Drawer, Message, MessageBox, Row, Col, Form,
Vue.config.productionTip = false;
if(window.require) Vue.use(VueElectron);
Vue.use(Button);
Vue.use(Col);
......
const { clipboard } = window.require('electron');
\ No newline at end of file
......@@ -118,14 +118,14 @@ export default {
}
},
mounted() {
console.log('listJson',listJson)
// console.log('listJson',listJson)
if(listJson && typeof listJson == 'object') {
this.modifyJson();
}
},
methods: {
handleClick(tab, event) {
console.log(tab, event);
// console.log(tab, event);
},
filterNode(value, data) {
if (!value) return true;
......
......@@ -124,22 +124,22 @@ export default {
langName = "语言";
break;
}
console.log(langName)
// console.log(langName)
return langName;
},
},
mounted() {
console.log(this.$refs.appcontainer)
// console.log(this.$refs.appcontainer)
},
methods: {
handleClose(done) {
console.log('click me')
// console.log('click me')
this.$confirm('确认关闭?').then(_=>{
done();
}).catch(_=>{});
},
handleSelect(key, keyPath) {
console.log(key, keyPath);
// console.log(key, keyPath);
switch(keyPath) {
case '1':
case '2':
......@@ -199,6 +199,7 @@ export default {
}
}
.home-content {
box-sizing: border-box;
padding: 20px;
}
.home-course-operate {
......
const electron = window.require ? window.require('electron') : {};
module.exports = {
install: function(Vue) {
Object.defineProperties(Vue.prototype, {
$electron: {
get() {
return electron;
},
},
});
},
}
\ No newline at end of file
module.exports = {
lintOnSave: false,
configureWebpack: {
devtool: 'source-map'
},
pluginOptions: {
electronBuilder: {
preload: 'src/preload.js',
// mainProcessFile: 'src/background.js',
// rendererProcessFile: 'src/main.js',
builderOptions: {
"productName": 'FeiDao Creation',
// build配置在此处
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论