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

1

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