no message

This commit is contained in:
kuaifan 2021-12-27 21:04:35 +08:00
parent 6c458b81b2
commit c6eb850abe
14 changed files with 278 additions and 70 deletions

68
electron/main.js vendored
View File

@ -104,6 +104,7 @@ function createRouter(arg) {
parent: mainWindow,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
devTools: arg.devTools !== false,
nodeIntegration: true,
contextIsolation: false
}
@ -133,41 +134,82 @@ function createRouter(arg) {
app.whenReady().then(() => {
createWindow()
app.on('activate', function () {
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
})
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit()
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('before-quit', () => {
willQuitApp = true
})
ipcMain.on('inheritClose', () => {
ipcMain.on('inheritClose', (event) => {
inheritClose = true
event.returnValue = "ok"
})
ipcMain.on('windowRouter', (event, arg) => {
createRouter(arg)
event.returnValue = "ok"
})
ipcMain.on('windowHidden', () => {
ipcMain.on('windowHidden', (event) => {
app.hide();
event.returnValue = "ok"
})
ipcMain.on('windowClose', () => {
mainWindow.close()
ipcMain.on('windowClose', (event) => {
const win = BrowserWindow.fromWebContents(event.sender);
win.close()
event.returnValue = "ok"
})
ipcMain.on('windowMax', function () {
if (mainWindow.isMaximized()) {
mainWindow.restore();
} else {
mainWindow.maximize();
ipcMain.on('windowSize', (event, arg) => {
const win = BrowserWindow.fromWebContents(event.sender);
if (win) {
if (arg.width || arg.height) {
win.setSize(arg.width || win.getSize()[0], arg.height || win.getSize()[1])
}
if (arg.minWidth || arg.minHeight) {
win.setMinimumSize(arg.minWidth || win.getMinimumSize()[0], arg.minHeight || win.getMinimumSize()[1])
}
if (arg.maxWidth || arg.maxHeight) {
win.setMaximumSize(arg.maxWidth || win.getMaximumSize()[0], arg.maxHeight || win.getMaximumSize()[1])
}
}
event.returnValue = "ok"
})
ipcMain.on('windowMinSize', (event, arg) => {
const win = BrowserWindow.fromWebContents(event.sender);
if (win) {
win.setMinimumSize(arg.width || win.getMinimumSize()[0], arg.height || win.getMinimumSize()[1])
}
event.returnValue = "ok"
})
ipcMain.on('windowMaxSize', (event, arg) => {
const win = BrowserWindow.fromWebContents(event.sender);
if (win) {
win.setMaximumSize(arg.width || win.getMaximumSize()[0], arg.height || win.getMaximumSize()[1])
}
event.returnValue = "ok"
})
ipcMain.on('windowMax', (event) => {
const win = BrowserWindow.fromWebContents(event.sender);
if (win.isMaximized()) {
win.restore();
} else {
win.maximize();
}
event.returnValue = "ok"
})
ipcMain.on('setDockBadge', (event, arg) => {
@ -180,6 +222,7 @@ ipcMain.on('setDockBadge', (event, arg) => {
} else {
app.dock.setBadge("")
}
event.returnValue = "ok"
})
ipcMain.on('saveSheet', (event, data, filename, opts) => {
@ -194,4 +237,5 @@ ipcMain.on('saveSheet', (event, data, filename, opts) => {
}).then(o => {
XLSX.writeFile(data, o.filePath, opts);
});
event.returnValue = "ok"
})

View File

@ -35,8 +35,9 @@
"@electron-forge/maker-zip": "^6.0.0-beta.61",
"dmg-license": "^1.0.10",
"dotenv": "^10.0.0",
"electron": "^16.0.4",
"electron-builder": "^22.14.5"
"electron": "^16.0.5",
"electron-builder": "^22.14.5",
"electron-log": "^4.4.3"
},
"dependencies": {
"electron-squirrel-startup": "^1.0.0",

View File

@ -36,6 +36,7 @@
"cross-env": "^7.0.3",
"css-loader": "^6.5.1",
"echarts": "^5.2.2",
"electron": "^16.0.5",
"element-ui": "^2.15.6",
"file-loader": "^6.2.0",
"inquirer": "^8.2.0",

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -145,7 +145,7 @@
}"
@on-visible-change="taskVisibleChange"
footer-hide>
<TaskDetail :open-task="taskData"/>
<TaskDetail :task-id="taskId" :open-task="taskData"/>
</Modal>
<!--查看所有团队-->

View File

@ -100,45 +100,50 @@
<p v-if="columnName"><span>{{columnName}}</span></p>
<p v-if="taskDetail.id"><span>{{taskDetail.id}}</span></p>
</div>
<Poptip
v-if="getOwner.length === 0"
confirm
ref="receive"
class="pick"
:title="$L('你确认领取任务吗?')"
placement="bottom"
@on-ok="onOwner(true)"
transfer>
<Button type="primary">{{$L('我要领取任务')}}</Button>
</Poptip>
<EDropdown
trigger="click"
placement="bottom"
@command="dropTask">
<Icon class="menu" type="ios-more"/>
<EDropdownMenu slot="dropdown">
<EDropdownItem v-if="taskDetail.complete_at" command="uncomplete">
<div class="item red">
<Icon type="md-checkmark-circle-outline" />{{$L('标记未完成')}}
</div>
</EDropdownItem>
<EDropdownItem v-else command="complete">
<div class="item">
<Icon type="md-radio-button-off" />{{$L('完成')}}
</div>
</EDropdownItem>
<EDropdownItem command="archived">
<div class="item">
<Icon type="ios-filing" />{{$L('归档')}}
</div>
</EDropdownItem>
<EDropdownItem command="remove">
<div class="item">
<Icon type="md-trash" />{{$L('删除')}}
</div>
</EDropdownItem>
</EDropdownMenu>
</EDropdown>
<div class="function">
<Poptip
v-if="getOwner.length === 0"
confirm
ref="receive"
class="pick"
:title="$L('你确认领取任务吗?')"
placement="bottom"
@on-ok="onOwner(true)"
transfer>
<Button type="primary">{{$L('我要领取任务')}}</Button>
</Poptip>
<ETooltip v-if="isElectron" :content="$L('新窗口打开')">
<i class="taskfont open" @click="openNewWin">&#xe776;</i>
</ETooltip>
<EDropdown
trigger="click"
placement="bottom"
@command="dropTask">
<Icon class="menu" type="ios-more"/>
<EDropdownMenu slot="dropdown">
<EDropdownItem v-if="taskDetail.complete_at" command="uncomplete">
<div class="item red">
<Icon type="md-checkmark-circle-outline" />{{$L('标记未完成')}}
</div>
</EDropdownItem>
<EDropdownItem v-else command="complete">
<div class="item">
<Icon type="md-radio-button-off" />{{$L('完成')}}
</div>
</EDropdownItem>
<EDropdownItem command="archived">
<div class="item">
<Icon type="ios-filing" />{{$L('归档')}}
</div>
</EDropdownItem>
<EDropdownItem command="remove">
<div class="item">
<Icon type="md-trash" />{{$L('删除')}}
</div>
</EDropdownItem>
</EDropdownMenu>
</EDropdown>
</div>
</div>
<div class="scroller overlay-y" :style="scrollerStyle">
<div class="title">
@ -310,7 +315,7 @@
<i class="taskfont">&#xe6f0;</i>{{$L('子任务')}}
</div>
<ul class="item-content subtask">
<TaskDetail v-for="(task, key) in subList" :key="key" :open-task="task"/>
<TaskDetail v-for="(task, key) in subList" :key="key" :task-id="task.id" :open-task="task"/>
</ul>
<ul :class="['item-content', subList.length === 0 ? 'nosub' : '']">
<li>
@ -412,6 +417,10 @@ export default {
name: "TaskDetail",
components: {ProjectLog, DialogWrapper, TaskUpload, UserInput, TaskPriority, TEditor},
props: {
taskId: {
type: Number,
default: 0
},
openTask: {
type: Object,
default: () => {
@ -509,7 +518,6 @@ export default {
'userId',
'projects',
'columns',
'taskId',
'taskSubs',
'taskContents',
'taskFiles',
@ -1114,6 +1122,10 @@ export default {
}).then(({data}) => {
this.$store.dispatch("saveTask", data);
this.$store.dispatch("getDialogOne", data.dialog_id);
if (this.isElectron) {
this.resizeDialog();
return;
}
this.$nextTick(() => {
if (this.$store.state.windowMax768) {
this.goForward({path: '/manage/messenger', query: {sendmsg: this.msgText}});
@ -1144,6 +1156,10 @@ export default {
this.sendLoad = false;
this.$store.dispatch("saveTask", data);
this.$store.dispatch("getDialogOne", data.dialog_id);
if (this.isElectron) {
this.resizeDialog();
return;
}
this.$nextTick(() => {
this.goForward({path: '/manage/messenger', query: {sendmsg: this.msgText}});
this.$store.state.method.setStorage("messenger::dialogId", data.dialog_id)
@ -1169,6 +1185,54 @@ export default {
$A.modalError(msg);
this.$store.dispatch("getTaskFiles", this.taskDetail.id)
});
},
openNewWin() {
if (!this.isElectron) {
return;
}
let config = {
parent: null,
width: Math.min(window.screen.availWidth, this.$el.clientWidth + 72),
height: Math.min(window.screen.availHeight, this.$el.clientHeight + 72),
};
if (this.hasOpenDialog) {
config.minWidth = 800;
config.minHeight = 600;
}
this.$electron.ipcRenderer.send('windowRouter', {
name: 'task-' + this.taskDetail.id,
path: "/single/task/" + this.taskDetail.id,
force: false, //
devTools: false,
config
});
this.$store.dispatch('openTask', 0);
},
resizeDialog() {
if (!this.isElectron) {
return;
}
this.$electron.ipcRenderer.sendSync('windowSize', {
width: Math.max(1100, window.innerWidth),
height: Math.max(720, window.innerHeight),
minWidth: 800,
minHeight: 600
});
if (this.msgText) {
let num = 0;
let interval = setInterval(() => {
num++;
if (this.$refs.dialog || num > 20) {
clearInterval(interval);
if (this.$refs.dialog) {
this.$refs.dialog.sendMsg(this.msgText);
this.msgText = "";
}
}
}, 100);
}
}
}
}

View File

@ -0,0 +1,85 @@
<template>
<div class="electron-task">
<PageTitle :title="taskInfo.name"/>
<Loading v-if="loadIng > 0"/>
<TaskDetail v-else :task-id="taskInfo.id" :open-task="taskInfo"/>
</div>
</template>
<style lang="scss" scoped>
.electron-task {
height: 100%;
display: flex;
flex-direction: column;
overflow: auto;
.task-detail {
flex: 1;
margin: 0;
padding: 18px 22px;
border-radius: 0;
}
}
</style>
<style lang="scss">
.electron-task {
.task-detail {
.task-info {
.head {
.function {
margin-right: 0;
.open {
display: none;
}
}
}
}
}
}
</style>
<script>
import TaskDetail from "../manage/components/TaskDetail";
export default {
components: {TaskDetail},
data() {
return {
loadIng: 0,
taskInfo: {},
}
},
mounted() {
//
},
watch: {
'$route': {
handler() {
this.getInfo();
},
immediate: true
},
},
methods: {
getInfo() {
let id = $A.runNum(this.$route.params.id);
if (id <= 0) {
return;
}
this.loadIng++;
this.$store.dispatch("getTaskOne", id).then(({data}) => {
this.loadIng--;
this.taskInfo = data;
}).catch(({msg}) => {
this.loadIng--;
$A.modalError({
content: msg,
onOk: () => {
if (this.isElectron) {
window.close();
}
}
});
});
}
}
}
</script>

View File

@ -80,6 +80,11 @@ export default [
path: '/single/file/:id',
component: () => import('./pages/single/file.vue'),
},
{
name: 'single-task',
path: '/single/task/:id',
component: () => import('./pages/single/task.vue'),
},
{
name: 'login',
path: '/login',

View File

@ -10,7 +10,7 @@
.head {
display: flex;
align-items: center;
height: 40px;
height: 42px;
padding-bottom: 10px;
color: #888888;
position: relative;
@ -60,14 +60,25 @@
}
}
}
.pick {
margin-left: 16px;
margin-right: -16px;
}
.menu {
font-size: 22px;
.function {
display: flex;
align-items: center;
margin: 0 32px;
cursor: pointer;
.pick {
margin-left: 12px;
margin-right: 10px;
}
.open {
margin-top: -2px;
margin-left: 12px;
font-size: 22px;
cursor: pointer;
}
.menu {
margin-left: 12px;
font-size: 22px;
cursor: pointer;
}
}
}
.scroller {
@ -365,7 +376,7 @@
}
}
.task-dialog {
flex: 1;
flex-shrink: 0;
display: flex;
flex-direction: column;
margin-top: 22px;
@ -481,11 +492,8 @@
.task-info {
overflow: auto;
.head {
.menu {
margin: 0 2px;
}
.pick {
margin-right: 12px;
.function {
margin-right: 2px;
}
}
}