Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
Madara
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
viitto
Madara
Commits
ebacf562
Commit
ebacf562
authored
Sep 26, 2019
by
罗超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复BUG
parent
5de2722d
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1562 additions
and
951 deletions
+1562
-951
index.js
src/main/index.js
+936
-894
index.vue
src/renderer/components/index.vue
+2
-0
chatitem.vue
src/renderer/components/msssage/chatitem.vue
+4
-0
index.vue
src/renderer/components/msssage/index.vue
+16
-1
forwardMsg.vue
src/renderer/components/team/forwardMsg.vue
+544
-0
contenteditor.vue
src/renderer/components/tools/contenteditor.vue
+2
-2
index.js
src/renderer/router/index.js
+57
-53
msgs.js
src/store/actions/msgs.js
+1
-1
No files found.
src/main/index.js
View file @
ebacf562
'use strict'
'use strict'
import
{
app
,
BrowserWindow
,
protocol
,
desktopCapturer
,
systemPreferences
}
from
'electron'
import
{
app
,
BrowserWindow
,
protocol
,
desktopCapturer
,
systemPreferences
}
from
'electron'
const
cp
=
require
(
'child_process'
)
const
cp
=
require
(
'child_process'
)
...
@@ -13,7 +13,7 @@ const SDK = require('../../static/sdk/NIM_Web_NIM_nodejs_v5.9.1.js')
...
@@ -13,7 +13,7 @@ const SDK = require('../../static/sdk/NIM_Web_NIM_nodejs_v5.9.1.js')
const
http
=
require
(
'http'
)
const
http
=
require
(
'http'
)
const
ipc
=
electron
.
ipcMain
const
ipc
=
electron
.
ipcMain
const
shell
=
electron
.
shell
const
shell
=
electron
.
shell
const
Menu
=
electron
.
Menu
const
Menu
=
electron
.
Menu
const
Tray
=
electron
.
Tray
const
Tray
=
electron
.
Tray
const
dialog
=
electron
.
dialog
const
dialog
=
electron
.
dialog
...
@@ -30,11 +30,11 @@ global.FILEURL = ''
...
@@ -30,11 +30,11 @@ global.FILEURL = ''
global
.
VERSION
=
''
global
.
VERSION
=
''
global
.
ISCUSTOM
=
false
global
.
ISCUSTOM
=
false
global
.
PREVIWERURL
=
''
global
.
PREVIWERURL
=
''
global
.
PREVIWERVIDEOURL
=
''
global
.
PREVIWERVIDEOURL
=
''
global
.
PREVIWERIMGS
=
[]
global
.
PREVIWERIMGS
=
[]
global
.
PREVIWERIMG
=
0
global
.
PREVIWERIMG
=
0
global
.
DIALOG_MESSAGE
=
''
global
.
DIALOG_MESSAGE
=
''
global
.
CURRENT_TEAM_MEMBERS
=
{}
global
.
CURRENT_TEAM_MEMBERS
=
{}
let
updateTimer
let
updateTimer
let
loginWindow
let
loginWindow
let
mainWindow
let
mainWindow
...
@@ -47,6 +47,7 @@ let scrollerhotWindows
...
@@ -47,6 +47,7 @@ let scrollerhotWindows
let
addNewUserWinodes
let
addNewUserWinodes
let
dialogWindows
let
dialogWindows
let
noticeWindows
let
noticeWindows
let
forwardWindows
let
appIcon
=
null
let
appIcon
=
null
let
isLogin
=
false
let
isLogin
=
false
let
timeout
=
null
let
timeout
=
null
...
@@ -59,12 +60,12 @@ let mainEvent = null
...
@@ -59,12 +60,12 @@ let mainEvent = null
let
screenEvent
=
null
let
screenEvent
=
null
let
messageEvent
=
null
let
messageEvent
=
null
let
messageProtocol
=
null
let
messageProtocol
=
null
let
CAP_IMG
=
''
let
CAP_IMG
=
''
let
nim
=
null
let
nim
=
null
let
SCREENCOUNT
=
0
let
SCREENCOUNT
=
0
global
.
defaultdownloaddir
=
require
(
'os'
).
userInfo
().
homedir
+
'
\\
Downloads
\
\'
global
.
defaultdownloaddir
=
require
(
'os'
).
userInfo
().
homedir
+
'
\\
Downloads
\
\'
global.DEFAULT_SCREENSHOT_PATH
=require('
os
').userInfo().homedir+
'
\\
Pictures
\\
demo
.
png
'
global.DEFAULT_SCREENSHOT_PATH
= require('
os
').userInfo().homedir +
'
\\
Pictures
\\
demo
.
png
'
global.AUDIO_PATH
=
process.execPath.substring(0, process.execPath.lastIndexOf('
\\
') + 1)
global.AUDIO_PATH
=
process.execPath.substring(0, process.execPath.lastIndexOf('
\\
') + 1)
const winURL = process.env.NODE_ENV === '
development
' ? `http://localhost:9080` : `file://${__dirname}/index.html`
const winURL = process.env.NODE_ENV === '
development
' ? `http://localhost:9080` : `file://${__dirname}/index.html`
...
@@ -76,999 +77,1040 @@ const dialogUrl = process.env.NODE_ENV === 'development' ? `http://localhost:908
...
@@ -76,999 +77,1040 @@ const dialogUrl = process.env.NODE_ENV === 'development' ? `http://localhost:908
const noticeUrl = process.env.NODE_ENV === '
development
' ? `http://localhost:9080/#/notice` : `file://${__dirname}/index.html#/notice`
const noticeUrl = process.env.NODE_ENV === '
development
' ? `http://localhost:9080/#/notice` : `file://${__dirname}/index.html#/notice`
const addnewuserUrl = process.env.NODE_ENV === '
development
' ? `http://localhost:9080/#/addnewuser` : `file://${__dirname}/index.html#/addnewuser`
const addnewuserUrl = process.env.NODE_ENV === '
development
' ? `http://localhost:9080/#/addnewuser` : `file://${__dirname}/index.html#/addnewuser`
const appXmlPath = process.execPath.substring(0, process.execPath.lastIndexOf('
\\
') + 1) + '
app
.
json
'
const appXmlPath = process.execPath.substring(0, process.execPath.lastIndexOf('
\\
') + 1) + '
app
.
json
'
const forwardUrl = process.env.NODE_ENV === '
development
' ? `http://localhost:9080/#/forwardMsg` : `file://${__dirname}/index.html#/forwardMsg`
if (process.env.NODE_ENV !== '
development
') {
if (process.env.NODE_ENV !== '
development
') {
global.__static = require('
path
').join(__dirname, '
/
static
').replace(/
\\
/g, '
\\\\
')
global.__static = require('
path
').join(__dirname, '
/
static
').replace(/
\\
/g, '
\\\\
')
}
}
let windowIcon = nativeImage.createFromPath(path.join(__static, '
.
/
icons
/
logo
.
png
'))
let windowIcon = nativeImage.createFromPath(path.join(__static, '
.
/
icons
/
logo
.
png
'))
fs.readFile(appXmlPath, '
utf
-
8
', function (err, result) {
fs.readFile(appXmlPath, '
utf
-
8
', function(err, result) {
if (result) {
if (result) {
let version
let version
try {
try {
version = JSON.parse(result)
version = JSON.parse(result)
} catch (error) {
} catch (error) {
result = result.substring(1)
result = result.substring(1)
version = JSON.parse(result)
version = JSON.parse(result)
}
global.VERSION = version.Application.Version
}
}
global.VERSION = version.Application.Version
}
})
})
const isSecondInstance = app.makeSingleInstance((commandLine, workingDirectory) => {
const isSecondInstance = app.makeSingleInstance((commandLine, workingDirectory) => {
if (commandLine.length > 1) {
if (commandLine.length > 1) {
try {
try {
if (commandLine[1] && commandLine[1].indexOf('
woyou
:
') != -1) {
if (commandLine[1] && commandLine[1].indexOf('
woyou
:
') != -1) {
let startArg = commandLine[1].split('
\\
')[1].split('
-
')
let startArg = commandLine[1].split('
\\
')[1].split('
-
')
if (startArg[0] === '
immessage
') {
if (startArg[0] === '
immessage
') {
messageProtocol = startArg[1]
messageProtocol = startArg[1]
} else {
dialog.showErrorBox('
麦子助手
', '
很抱歉,你的口令错误,系统无法解析
')
}
} else if (process.argv[1] && process.argv[1].indexOf('
dev
-
console
') != -1) {
require('
electron
-
debug
')({ showDevTools: true })
return false
} else if (process.argv[1] && process.argv[1].indexOf('
dev
') != -1) {
global.APPDOMAIN = APPDOMAIN_DEV_URL
global.APPIMGDOMAIN = APPIMGDOMAIN_DEV_URL
return false
}
} catch (error) {}
}
// Someone tried to run a second instance, we should focus our window.
if (LOGINUSER && LOGINUSER.petName) {
if (!mainWindow.isDestroyed()) {
mainWindow.show()
} else {
} else {
dialog.showErrorBox('
麦子助手
', '
很抱歉,你的口令错误,系统无法解析
')
getMainWinodw(0)
}
if (mainEvent) {
mainEvent.sender.send('
openMsgBox
')
}
}
} else if (process.argv[1] && process.argv[1].indexOf('
dev
-
console
') != -1) {
require('
electron
-
debug
')({ showDevTools: true })
return false
} else if (process.argv[1] && process.argv[1].indexOf('
dev
') != -1) {
global.APPDOMAIN = APPDOMAIN_DEV_URL
global.APPIMGDOMAIN = APPIMGDOMAIN_DEV_URL
return false
}
} catch (error) {}
}
// Someone tried to run a second instance, we should focus our window.
if (LOGINUSER && LOGINUSER.petName) {
if (!mainWindow.isDestroyed()) {
mainWindow.show()
} else {
getMainWinodw(0)
}
if (mainEvent) {
mainEvent.sender.send('
openMsgBox
')
}
if (messageEvent) {
setTimeout(function () {
if (messageEvent) {
if (messageEvent) {
if (messageProtocol) {
setTimeout(function() {
messageEvent.sender.send('
openCurrentNewMessage
', '
p2p
-
' + messageProtocol)
if (messageEvent) {
messageProtocol = null
if (messageProtocol) {
}
messageEvent.sender.send('
openCurrentNewMessage
', '
p2p
-
' + messageProtocol)
messageProtocol = null
}
}
}, 2000)
}
}
}, 2000)
}
} else {
if (!loginWindow.isDestroyed()) {
loginWindow.show()
} else {
} else {
getLoginWindow()
if (!loginWindow.isDestroyed()) {
loginWindow.show()
} else {
getLoginWindow()
}
}
}
}
return true
return true
})
})
if (isSecondInstance) {
if (isSecondInstance) {
app.exit(0)
app.exit(0)
}
}
function createWindow () {
if (process.argv.length > 1) {
function createWindow() {
if (process.argv[1] && process.argv[1].indexOf('
woyou
:
') != -1) {
if (process.argv.length > 1) {
try {
if (process.argv[1] && process.argv[1].indexOf('
woyou
:
') != -1) {
let startArg = process.argv[1].split('
\\
')[1].split('
-
')
try {
if (startArg[0] === '
immessage
') {
let startArg = process.argv[1].split('
\\
')[1].split('
-
')
messageProtocol = startArg[1]
if (startArg[0] === '
immessage
') {
} else {
messageProtocol = startArg[1]
dialog.showErrorBox('
麦子助手
', '
很抱歉,你的口令错误,系统无法解析
')
} else {
dialog.showErrorBox('
麦子助手
', '
很抱歉,你的口令错误,系统无法解析
')
}
} catch (error) {}
} else if (process.argv[1] && process.argv[1].indexOf('
dev
-
console
') != -1) {
require('
electron
-
debug
')({ showDevTools: true })
} else if (process.argv[1] && process.argv[1].indexOf('
dev
') != -1) {
global.APPDOMAIN = APPDOMAIN_DEV_URL
global.APPIMGDOMAIN = APPIMGDOMAIN_DEV_URL
}
}
} catch (error) {}
} else if (process.argv[1] && process.argv[1].indexOf('
dev
-
console
') != -1) {
require('
electron
-
debug
')({ showDevTools: true })
} else if (process.argv[1] && process.argv[1].indexOf('
dev
') != -1) {
global.APPDOMAIN = APPDOMAIN_DEV_URL
global.APPIMGDOMAIN = APPIMGDOMAIN_DEV_URL
}
}
}
getLoginWindow()
getLoginWindow()
getMainWinodw(1)
getMainWinodw(1)
mainWindow.onbeforeunload = (e) => {
mainWindow.onbeforeunload = (e) => {
mainWindow.hide()
mainWindow.hide()
e.returnValue = false
e.returnValue = false
}
}
mainWindow.webContents.session.on('
will
-
download
', (event, item, webContents) => {
mainWindow.webContents.session.on('
will
-
download
', (event, item, webContents) => {
const totalBytes = item.getTotalBytes()
const totalBytes = item.getTotalBytes()
let pathAll = folderpath + `
\\
` + downloadname
let pathAll = folderpath + `
\\
` + downloadname
item.setSavePath(pathAll)
item.setSavePath(pathAll)
item.on('
updated
', (event, state) => {
item.on('
updated
', (event, state) => {
if (state === '
interrupted
') {} else if (state === '
progressing
') {
if (state === '
interrupted
') {
if (item.isPaused()) {} else {}
} else if (state === '
progressing
') {
mainWindow.setProgressBar(item.getReceivedBytes() / totalBytes)
if (item.isPaused()) {
downloadObj.sender.send('
downloading
', (parseFloat(item.getReceivedBytes()) / parseFloat(totalBytes)) * 100)
} else {
}
}
})
mainWindow.setProgressBar(item.getReceivedBytes() / totalBytes)
item.once('
done
', (event, state) => {
downloadObj.sender.send('
downloading
', (parseFloat(item.getReceivedBytes()) / parseFloat(totalBytes))*100)
if (!mainWindow.isDestroyed()) {
}
mainWindow.setProgressBar(-1)
mainWindow.flashFrame(true)
}
if (state === '
completed
') {
try {
downloadObj.sender.send('
downloadOver
', msgId, folderpath + `
\\
` + downloadname)
} catch (error) {
}
} else {
}
})
})
})
item.once('
done
', (event, state) => {
if (!mainWindow.isDestroyed()) {
mainWindow.setProgressBar(-1)
mainWindow.flashFrame(true)
}
if (state === '
completed
') {
try {
downloadObj.sender.send('
downloadOver
', msgId, folderpath + `
\\
` + downloadname)
} catch (error) {
const iconName = '
.
/
icons
/
logo
.
png
'
const iconPath = path.join(__static, iconName)
appIcon = new Tray(iconPath)
appIcon.setToolTip('
麦子助手
')
appIcon.on('
click
', function() {
if (global.NEWMESSAGE && global.NEWMESSAGE.length > 0) {
//getNewMsgWindows()
newMsgWindow.show()
} else if (isLogin) {
if (!mainWindow.isDestroyed()) {
mainWindow.show()
} else {
getMainWinodw(0)
}
} else {
if (!loginWindow.isDestroyed()) {
loginWindow.show()
} else {
getLoginWindow()
}
}
}
} else {
}
})
})
})
appIcon.on('
double
-
click
', function() {
if (isLogin) {
const iconName = '
.
/
icons
/
logo
.
png
'
mainWindow.show()
const iconPath = path.join(__static, iconName)
appIcon = new Tray(iconPath)
appIcon.setToolTip('
麦子助手
')
appIcon.on('
click
', function () {
if (global.NEWMESSAGE && global.NEWMESSAGE.length > 0) {
//getNewMsgWindows()
newMsgWindow.show()
} else if (isLogin) {
if (!mainWindow.isDestroyed()) {
mainWindow.show()
} else {
getMainWinodw(0)
}
} else {
if (!loginWindow.isDestroyed()) {
loginWindow.show()
} else {
getLoginWindow()
}
}
})
appIcon.on('
double
-
click
', function () {
if (isLogin) {
mainWindow.show()
} else {
if (!loginWindow.isDestroyed()) {
loginWindow.show()
} else {
getLoginWindow()
}
}
})
const contextMenu = Menu.buildFromTemplate([{
label: '
打开主界面
',
click: function () {
if (isLogin) {
mainWindow.show()
} else {
if (!loginWindow.isDestroyed()) {
loginWindow.show()
} else {
} else {
getLoginWindow()
if (!loginWindow.isDestroyed()) {
loginWindow.show()
} else {
getLoginWindow()
}
}
}
}
})
}
const contextMenu = Menu.buildFromTemplate([{
},
label: '
打开主界面
',
{
click: function() {
label: '
退出
',
if (isLogin) {
click: function () {
mainWindow.show()
app.exit(0)
} else {
}
if (!loginWindow.isDestroyed()) {
}])
loginWindow.show()
appIcon.setContextMenu(contextMenu)
} else {
Menu.setApplicationMenu(null)
getLoginWindow()
}
}
}
},
{
label: '
退出
',
click: function() {
app.exit(0)
}
}
])
appIcon.setContextMenu(contextMenu)
Menu.setApplicationMenu(null)
if (process.env.NODE_ENV !== '
development
') {
if (process.env.NODE_ENV !== '
development
') {
let startDir = process.execPath.substring(0, process.execPath.lastIndexOf('
\\
') + 1)
let startDir = process.execPath.substring(0, process.execPath.lastIndexOf('
\\
') + 1)
shell.openItem(startDir + '
AutoUpdate
.
exe
')
shell.openItem(startDir + '
AutoUpdate
.
exe
')
let updateDir = startDir + '
update
\\
'
let updateDir = startDir + '
update
\\
'
let pa = fs.readdirSync(updateDir)
let pa = fs.readdirSync(updateDir)
if (pa) {
if (pa) {
pa.forEach(function (ele, index) {
pa.forEach(function(ele, index) {
var info = fs.statSync(updateDir + ele)
var info = fs.statSync(updateDir + ele)
if (!info.isDirectory()) {
if (!info.isDirectory()) {
fs.rename(updateDir + ele, startDir + ele, function (err) {
fs.rename(updateDir + ele, startDir + ele, function(err) {
// if (ele.indexOf('
UpdateAuthority
.
exe
') != -1 && startDir.toLowerCase().indexOf('
c
:
') != -1) {
// if (ele.indexOf('
UpdateAuthority
.
exe
') != -1 && startDir.toLowerCase().indexOf('
c
:
') != -1) {
// shell.openItem(startDir + '
UpdateAuthority
.
exe
')
// shell.openItem(startDir + '
UpdateAuthority
.
exe
')
// }
// }
})
})
}
})
}
}
})
}
}
}
}
}
app.on('
ready
', createWindow)
app.on('
ready
', createWindow)
// app.on('
window
-
all
-
closed
', () => {
// app.on('
window
-
all
-
closed
', () => {
// if (process.platform !== '
darwin
') {
// if (process.platform !== '
darwin
') {
// app.exit(0)
// app.exit(0)
// }
// }
// })
// })
app.on('
activate
', () => {
app.on('
activate
', () => {
if (loginWindow === null) {
if (loginWindow === null) {
createWindow()
createWindow()
}
}
})
})
ipc.on('
loginSuccess
', function (event, userInfo) {
ipc.on('
loginSuccess
', function(event, userInfo) {
initNIM(userInfo.ImAccount,userInfo.ImToken)
initNIM(userInfo.ImAccount, userInfo.ImToken)
registScrollerHotKey()
registScrollerHotKey()
getScrollerhotWindows()
getScrollerhotWindows()
global.LOGINUSER = userInfo
global.LOGINUSER = userInfo
getNewMsgWindows()
getNewMsgWindows()
getMainWinodw(0)
getMainWinodw(0)
loginWindow.close()
loginWindow.close()
isLogin = true
isLogin = true
const contextMenu = Menu.buildFromTemplate([{
const contextMenu = Menu.buildFromTemplate([{
label: '
打开主界面
',
label: '
打开主界面
',
click: function () {
click: function() {
if (isLogin) {
if (isLogin) {
if (!mainWindow.isDestroyed()) {
if (!mainWindow.isDestroyed()) {
mainWindow.show()
mainWindow.show()
} else {
} else {
getMainWinodw(0)
getMainWinodw(0)
}
}
} else {
} else {
if (!loginWindow.isDestroyed()) {
if (!loginWindow.isDestroyed()) {
loginWindow.show()
loginWindow.show()
} else {
} else {
getLoginWindow()
getLoginWindow()
}
}
}
}
}
},
{
label: '
注销
',
click: function () {
global.ISSIGNOUT = true
global.LOGINUSER = null
global.LOGINTYPE = null
isLogin = false
getLoginWindow()
mainWindow.close()
try {
global.NEWMESSAGE.length = 0
clearInterval(timeout)
appIcon.setImage(path.join(__static, '
.
/
icons
/
logo
.
png
'))
newMsgWindow.hide()
} catch (error) {}
const contextMenu = Menu.buildFromTemplate([{
label: '
打开主界面
',
click: function () {
if (isLogin) {
if (!mainWindow.isDestroyed()) {
mainWindow.show()
} else {
getMainWinodw(0)
}
}
} else {
},
if (!loginWindow.isDestroyed()) {
{
loginWindow.show()
label: '
注销
',
} else {
click: function() {
getLoginWindow()
global.ISSIGNOUT = true
global.LOGINUSER = null
global.LOGINTYPE = null
isLogin = false
getLoginWindow()
mainWindow.close()
try {
global.NEWMESSAGE.length = 0
clearInterval(timeout)
appIcon.setImage(path.join(__static, '
.
/
icons
/
logo
.
png
'))
newMsgWindow.hide()
} catch (error) {}
const contextMenu = Menu.buildFromTemplate([{
label: '
打开主界面
',
click: function() {
if (isLogin) {
if (!mainWindow.isDestroyed()) {
mainWindow.show()
} else {
getMainWinodw(0)
}
} else {
if (!loginWindow.isDestroyed()) {
loginWindow.show()
} else {
getLoginWindow()
}
}
}
},
{
label: '
退出
',
click: function() {
app.exit(0)
}
}
])
appIcon.setContextMenu(contextMenu)
loginWindow.show()
}
},
{
label: '
退出
',
click: function() {
app.exit(0)
}
}
}
}
},
{
label: '
退出
',
click: function () {
app.exit(0)
}
}
}])
])
appIcon.setContextMenu(contextMenu)
appIcon.setContextMenu(contextMenu)
loginWindow.show()
}
},
{
label: '
退出
',
if (process.env.NODE_ENV !== '
development
') {
click: function () {
let startDir = process.execPath.substring(0, process.execPath.lastIndexOf('
\\
') + 1)
app.exit(0)
fs.readFile(appXmlPath, '
utf
-
8
', function(err, result) {
let version
try {
version = JSON.parse(result)
} catch (error) {
result = result.substring(1)
version = JSON.parse(result)
}
version.CurrentUser = userInfo.ImAccount
fs.writeFile(appXmlPath, JSON.stringify(version), function(err) {
//setTimeout(function () {
// shell.openItem(startDir + '
AutoUpdate
.
exe
')
// }, 1000 * 60 * 5)
// if (updateTimer) {
// clearInterval(updateTimer)
// }
// updateTimer = setInterval(function () {
// shell.openItem(startDir + '
AutoUpdate
.
exe
')
// }, 1000 * 60 * 10)
})
})
}
}
}])
setTimeout(function() {
appIcon.setContextMenu(contextMenu)
try {
const RUN_LOCATION = '
\\
Software
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
Run
'
if (process.env.NODE_ENV !== '
development
') {
let key = new WinReg({ hive: WinReg.HKCU, key: RUN_LOCATION })
let startDir = process.execPath.substring(0, process.execPath.lastIndexOf('
\\
') + 1)
key.set('
WYOFFICE
', WinReg.REG_SZ, process.execPath, (err) => {
fs.readFile(appXmlPath, '
utf
-
8
', function (err, result) {
//console.log('
设置自动启动
' + err)
let version
})
try {
version = JSON.parse(result)
} catch (error) {
result = result.substring(1)
version = JSON.parse(result)
}
version.CurrentUser = userInfo.ImAccount
fs.writeFile(appXmlPath, JSON.stringify(version), function (err) {
//setTimeout(function () {
// shell.openItem(startDir + '
AutoUpdate
.
exe
')
// }, 1000 * 60 * 5)
// if (updateTimer) {
// clearInterval(updateTimer)
// }
// updateTimer = setInterval(function () {
// shell.openItem(startDir + '
AutoUpdate
.
exe
')
// }, 1000 * 60 * 10)
})
})
}
setTimeout(function () {
try {
const RUN_LOCATION = '
\\
Software
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
Run
'
let key = new WinReg({hive: WinReg.HKCU, key: RUN_LOCATION})
key.set('
WYOFFICE
', WinReg.REG_SZ, process.execPath, (err) => {
//console.log('
设置自动启动
' + err)
})
app.setAsDefaultProtocolClient('
Woyou
')
app.setAsDefaultProtocolClient('
Woyou
')
} catch (error) {
} catch (error) {
console.log(error)
console.log(error)
}
}, 1000 * 60 * 10)
})
ipc.on('
newMessage
', function(event, data) {
global.NEWMESSAGE = data
if (data && data.length > 0) {
var count = 0
if (timeout) {
clearInterval(timeout)
}
timeout = setInterval(function() {
if (count++ % 2 == 0) {
appIcon.setImage(path.join(__static, '
.
/
icons
/
logo
.
png
'))
} else {
appIcon.setImage(path.join(__static, '
.
/
icons
/
logo
-
tran
.
png
'))
}
}, 400)
//newMsgWindow.reload()
newMsgWindow.setBounds({
y: (electron.screen.getPrimaryDisplay().workAreaSize.height - (83 + (data.length * 49)) - 1),
x: appIcon.getBounds().x - 130,
width: 260,
height: 83 + (data.length * 49)
})
} else {
clearInterval(timeout)
appIcon.setImage(path.join(__static, '
.
/
icons
/
logo
.
png
'))
newMsgWindow.hide()
}
}
}, 1000 * 60 * 10)
})
})
ipc.on('
newMessage
', function (event, data) {
ipc.on('
openSystemNotice
', function(event, sessionid) {
global.NEWMESSAGE = data
if (!xNoticeWindow || xNoticeWindow.isDestroyed()) {
if (data && data.length > 0) {
sNoticeWindow = new BrowserWindow({
var count = 0
y: electron.screen.getPrimaryDisplay().workAreaSize.height - 190,
if (timeout) {
x: electron.screen.getPrimaryDisplay().workAreaSize.width - 320,
clearInterval(timeout)
transparent: systemPreferences.isAeroGlassEnabled(),
frame: false,
maximizable: false,
resizable: false,
show: false,
width: 320,
height: 190,
alwaysOnTop: true,
focusable: false,
icon: windowIcon
})
sNoticeWindow.loadURL(stURL)
sNoticeWindow.once('
ready
-
to
-
show
', () => {
sNoticeWindow.show()
})
sNoticeWindow.setSkipTaskbar(true)
} else {
sNoticeWindow.reload()
sNoticeWindow.once('
ready
-
to
-
show
', () => {
sNoticeWindow.show()
})
}
}
timeout = setInterval(function () {
})
if (count++ % 2 == 0) {
ipc.on('
openNewMessage
', function(event, currentSession) {
mainWindow.show()
mainWindow.setAlwaysOnTop(true)
mainWindow.setAlwaysOnTop(false)
global.NEWMESSAGE.splice(global.NEWMESSAGE.indexOf(currentSession), 1)
mainEvent.sender.send('
openMsgBox
', currentSession)
if (global.NEWMESSAGE && global.NEWMESSAGE.length == 0) {
clearInterval(timeout)
appIcon.setImage(path.join(__static, '
.
/
icons
/
logo
.
png
'))
appIcon.setImage(path.join(__static, '
.
/
icons
/
logo
.
png
'))
} else {
newMsgWindow.hide()
appIcon.setImage(path.join(__static, '
.
/
icons
/
logo
-
tran
.
png
'))
}
}
}, 400)
//newMsgWindow.reload()
newMsgWindow.setBounds({
y: (electron.screen.getPrimaryDisplay().workAreaSize.height - (83 + (data.length * 49)) - 1),
x: appIcon.getBounds().x - 130,
width: 260,
height: 83 + (data.length * 49)
})
} else {
clearInterval(timeout)
appIcon.setImage(path.join(__static, '
.
/
icons
/
logo
.
png
'))
newMsgWindow.hide()
}
})
})
ipc.on('
openSystemNotice
', function (event, sessionid) {
ipc.on('
openNewMessageOther
', function(event, IMid) {
if (!xNoticeWindow || xNoticeWindow.isDestroyed()) {
mainWindow.show()
sNoticeWindow = new BrowserWindow({
y: electron.screen.getPrimaryDisplay().workAreaSize.height - 190,
mainEvent.sender.send('
openMsgBox
')
x: electron.screen.getPrimaryDisplay().workAreaSize.width - 320,
messageEvent.sender.send('
openCurrentNewMessage
', '
p2p
-
' + IMid)
transparent: systemPreferences.isAeroGlassEnabled(),
frame: false,
maximizable: false,
resizable: false,
show: false,
width: 320,
height: 190,
alwaysOnTop: true,
focusable: false,
icon: windowIcon
})
sNoticeWindow.loadURL(stURL)
sNoticeWindow.once('
ready
-
to
-
show
', () => {
sNoticeWindow.show()
})
sNoticeWindow.setSkipTaskbar(true)
} else {
sNoticeWindow.reload()
sNoticeWindow.once('
ready
-
to
-
show
', () => {
sNoticeWindow.show()
})
}
})
})
ipc.on('
openNewMessage
', function (event, currentSession) {
ipc.on('
clearMessage
', function(event) {
mainWindow.show()
global.USER_CURRENTSESSION = null
mainWindow.setAlwaysOnTop(true)
// mainWindow.show()
mainWindow.setAlwaysOnTop(false)
})
global.NEWMESSAGE.splice(global.NEWMESSAGE.indexOf(currentSession), 1)
ipc.on('
ignore
-
all
-
message
', function(event) {
mainEvent.sender.send('
openMsgBox
',currentSession)
if (global.NEWMESSAGE && global.NEWMESSAGE.length == 0) {
clearInterval(timeout)
clearInterval(timeout)
appIcon.setImage(path.join(__static, '
.
/
icons
/
logo
.
png
'))
appIcon.setImage(path.join(__static, '
.
/
icons
/
logo
.
png
'))
newMsgWindow.hide()
newMsgWindow.hide()
}
mainEvent.sender.send('
ignore
-
all
-
unRead
')
})
global.NEWMESSAGE.length = 0
ipc.on('
openNewMessageOther
', function (event, IMid) {
mainWindow.show()
mainEvent.sender.send('
openMsgBox
')
messageEvent.sender.send('
openCurrentNewMessage
', '
p2p
-
' + IMid)
})
ipc.on('
clearMessage
', function (event) {
global.USER_CURRENTSESSION = null
// mainWindow.show()
})
})
ipc.on('
ignore
-
all
-
message
', function (event) {
ipc.on('
create
-
session
', function(event) {
clearInterval(timeout)
mainEvent = event
appIcon.setImage(path.join(__static, '
.
/
icons
/
logo
.
png
'))
if (messageProtocol) {
newMsgWindow.hide()
mainEvent.sender.send('
openMsgBox
')
mainEvent.sender.send('
ignore
-
all
-
unRead
')
}
global.NEWMESSAGE.length = 0
})
ipc.on('
create
-
session
', function (event) {
mainEvent = event
if (messageProtocol) {
mainEvent.sender.send('
openMsgBox
')
}
})
})
ipc.on('
create
-
message
-
session
', function
(event) {
ipc.on('
create
-
message
-
session
', function(event) {
messageEvent = event
messageEvent = event
if (messageProtocol) {
if (messageProtocol) {
setTimeout(function
() {
setTimeout(function
() {
messageEvent.sender.send('
openCurrentNewMessage
', '
p2p
-
' + messageProtocol)
messageEvent.sender.send('
openCurrentNewMessage
', '
p2p
-
' + messageProtocol)
messageProtocol = null
messageProtocol = null
}, 3000)
}, 3000)
}
}
})
})
ipc.on('
download
', (evt, pdownloadpath, pfolderpath, dfileName, pmsgId) => {
ipc.on('
download
', (evt, pdownloadpath, pfolderpath, dfileName, pmsgId) => {
try {
try {
downloadpath = pdownloadpath
downloadpath = pdownloadpath
folderpath = pfolderpath
folderpath = pfolderpath
downloadname = dfileName
downloadname = dfileName
downloadObj = evt
downloadObj = evt
msgId = pmsgId
msgId = pmsgId
// evt.sender.send('
tips
',downloadpath);
// evt.sender.send('
tips
',downloadpath);
mainWindow.webContents.downloadURL(downloadpath)
mainWindow.webContents.downloadURL(downloadpath)
} catch (error) {
} catch (error) {
}
}
})
})
ipc.on('
OpenFile
', (evt, filePaht) => {
ipc.on('
OpenFile
', (evt, filePaht) => {
var a = shell.openItem(filePaht)
var a = shell.openItem(filePaht)
let isHave=
true
let isHave =
true
if (!a) {
if (!a) {
dialog.showErrorBox('
打开文件
', '
此文件不存在,可能被删除或者移动到其它位置
')
dialog.showErrorBox('
打开文件
', '
此文件不存在,可能被删除或者移动到其它位置
')
isHave = false
isHave = false
}
}
evt.sender.send('
FileExsit
', isHave)
evt.sender.send('
FileExsit
', isHave)
})
})
ipc.on('
showItemInFolder
', (evt, filePaht) => {
ipc.on('
showItemInFolder
', (evt, filePaht) => {
shell.showItemInFolder(filePaht)
shell.showItemInFolder(filePaht)
})
})
ipc.on('
openUrl
', (evt, url) => {
ipc.on('
openUrl
', (evt, url) => {
shell.openExternal(url)
shell.openExternal(url)
})
})
ipc.on('
exit
', function
(event) {
ipc.on('
exit
', function(event) {
app.exit(0)
app.exit(0)
})
})
ipc.on('
signOut
', function
(event) {
ipc.on('
signOut
', function(event) {
global.ISSIGNOUT = true
global.ISSIGNOUT = true
global.LOGINUSER = null
global.LOGINUSER = null
global.LOGINTYPE = null
global.LOGINTYPE = null
isLogin = false
isLogin = false
mainWindow.hide()
mainWindow.hide()
getLoginWindow()
getLoginWindow()
if (fullImgWindow && !fullImgWindow.isDestroyed()) {
if (fullImgWindow && !fullImgWindow.isDestroyed()) {
fullImgWindow.hide()
fullImgWindow.hide()
}
}
if (newMsgWindow && !newMsgWindow.isDestroyed()) {
if (newMsgWindow && !newMsgWindow.isDestroyed()) {
newMsgWindow.hide()
newMsgWindow.hide()
}
}
if (xNoticeWindow && !xNoticeWindow.isDestroyed()) {
if (xNoticeWindow && !xNoticeWindow.isDestroyed()) {
xNoticeWindow.hide()
xNoticeWindow.hide()
}
}
if (sNoticeWindow && !sNoticeWindow.isDestroyed()) {
if (sNoticeWindow && !sNoticeWindow.isDestroyed()) {
sNoticeWindow.hide()
sNoticeWindow.hide()
}
}
if (previewWindow && !previewWindow.isDestroyed()) {
if (previewWindow && !previewWindow.isDestroyed()) {
previewWindow.hide()
previewWindow.hide()
}
}
if (publishWindow && !publishWindow.isDestroyed()) {
if (publishWindow && !publishWindow.isDestroyed()) {
publishWindow.hide()
publishWindow.hide()
}
}
if (productlinewindow && !productlinewindow.isDestroyed()) {
if (productlinewindow && !productlinewindow.isDestroyed()) {
productlinewindow.hide()
productlinewindow.hide()
}
}
if (dynamicDetailsWindow && !dynamicDetailsWindow.isDestroyed()) {
if (dynamicDetailsWindow && !dynamicDetailsWindow.isDestroyed()) {
dynamicDetailsWindow.hide()
dynamicDetailsWindow.hide()
}
}
if (peerTourHomePageView && !peerTourHomePageView.isDestroyed()) {
if (peerTourHomePageView && !peerTourHomePageView.isDestroyed()) {
peerTourHomePageView.hide()
peerTourHomePageView.hide()
}
if (postBarPublish && !postBarPublish.isDestroyed()) {
postBarPublish.hide()
}
if (postBarDetail && !postBarDetail.isDestroyed()) {
postBarDetail.hide()
}
loginWindow.show()
const contextMenu = Menu.buildFromTemplate([{
label: '
打开主界面
',
click: function () {
if (isLogin) {
mainWindow.show()
} else {
if (!loginWindow.isDestroyed()) {
loginWindow.show()
} else {
getLoginWindow()
}
}
}
}
},
if (postBarPublish && !postBarPublish.isDestroyed()) {
{
postBarPublish.hide()
label: '
退出
',
click: function () {
app.exit(0)
}
}
}])
if (postBarDetail && !postBarDetail.isDestroyed()) {
appIcon.setContextMenu(contextMenu)
postBarDetail.hide()
loginWindow.show()
}
loginWindow.show()
const contextMenu = Menu.buildFromTemplate([{
label: '
打开主界面
',
click: function() {
if (isLogin) {
mainWindow.show()
} else {
if (!loginWindow.isDestroyed()) {
loginWindow.show()
} else {
getLoginWindow()
}
}
}
},
{
label: '
退出
',
click: function() {
app.exit(0)
}
}
])
appIcon.setContextMenu(contextMenu)
loginWindow.show()
})
})
ipc.on('
openPreviwerfile
', function
(event,
url) {
ipc.on('
openPreviwerfile
', function
(event,
url) {
global.PREVIWERURL=
url
global.PREVIWERURL =
url
getPreviwerFileWindow()
getPreviwerFileWindow()
})
})
ipc.on('
openPreviwerfile
', function
(event,
url) {
ipc.on('
openPreviwerfile
', function
(event,
url) {
global.PREVIWERURL=
url
global.PREVIWERURL =
url
getPreviwerFileWindow()
getPreviwerFileWindow()
})
})
ipc.on('
clearPrevImgs
', function
(event) {
ipc.on('
clearPrevImgs
', function(event) {
global.PREVIWERIMGS=
[]
global.PREVIWERIMGS =
[]
})
})
ipc.on('
addPrevImgs
', function
(event,
url) {
ipc.on('
addPrevImgs
', function
(event,
url) {
global.PREVIWERIMGS.push(url)
global.PREVIWERIMGS.push(url)
})
})
ipc.on('
openPreviwerImg
', function
(event,
url) {
ipc.on('
openPreviwerImg
', function
(event,
url) {
global.PREVIWERIMG=
global.PREVIWERIMGS.indexOf(url)
global.PREVIWERIMG =
global.PREVIWERIMGS.indexOf(url)
getPreviwerImgWindow()
getPreviwerImgWindow()
})
})
ipc.on('
openPreviwerVideo
', function
(event,
url) {
ipc.on('
openPreviwerVideo
', function
(event,
url) {
global.PREVIWERVIDEOURL=
url
global.PREVIWERVIDEOURL =
url
getPreviwerVideoWindow()
getPreviwerVideoWindow()
})
})
ipc.on('
addClipboard
', function
(event,
content) {
ipc.on('
addClipboard
', function
(event,
content) {
let img = nativeImage.createFromDataURL(content)
let img = nativeImage.createFromDataURL(content)
mainEvent.sender.send('
new
-
screen
-
hot
',
content)
mainEvent.sender.send('
new
-
screen
-
hot
',
content)
clipboard.writeImage(img)
clipboard.writeImage(img)
})
})
ipc.on('
setClipboard
', function
(event,content,
type) {
ipc.on('
setClipboard
', function
(event, content,
type) {
if(type==1)
{
if (type == 1)
{
clipboard.writeText(content)
clipboard.writeText(content)
}
}
})
})
ipc.on('
getNetworkImage
', function (event,url) {
ipc.on('
getNetworkImage
', function(event, url) {
http.get(url, function (res) {
http.get(url, function(res) {
var chunks = [];
var chunks = [];
var size = 0;
var size = 0;
res.on('
data
', function (chunk) {
res.on('
data
', function(chunk) {
chunks.push(chunk);
chunks.push(chunk);
size += chunk.length; //累加缓冲数据的长度
size += chunk.length; //累加缓冲数据的长度
});
});
res.on('
end
', function (err) {
res.on('
end
', function(err) {
var data = Buffer.concat(chunks, size);
var data = Buffer.concat(chunks, size);
var base64Img = data.toString('
base64
');
var base64Img = data.toString('
base64
');
let img = nativeImage.createFromDataURL(`data:image/png;base64,${base64Img}`)
let img = nativeImage.createFromDataURL(`data:image/png;base64,${base64Img}`)
clipboard.writeImage(img)
clipboard.writeImage(img)
console.log('
结束
');
console.log('
结束
');
});
});
});
});
})
})
ipc.on('
screens
-
session
', function
(event) {
ipc.on('
screens
-
session
', function(event) {
screenEvent=
event
screenEvent =
event
})
})
ipc.on('
open
-
screenhot
', function
(event) {
ipc.on('
open
-
screenhot
', function(event) {
screenHotBegin()
screenHotBegin()
})
})
ipc.on('
delete
-
file
', function
(event,
p) {
ipc.on('
delete
-
file
', function
(event,
p) {
fs.unlink(p, function(err)
{})
fs.unlink(p, function(err)
{})
})
})
ipc.on('
send
-
file
', function (event,obj) {
ipc.on('
send
-
file
', function(event, obj) {
let {scene, to, filePath, name,size,md5,type,file} = obj
let { scene, to, filePath, name, size, md5, type, file } = obj
let customMsg = {
let customMsg = {
"msgtype":"custom_file",
"msgtype": "custom_file",
"data":{
"data": {
"pushContent":name,
"pushContent": name,
"Height":"84",
"Height": "84",
"content":{
"content": {
"fileType":name.substring(name.lastIndexOf('
.
')+1,name.length),
"fileType": name.substring(name.lastIndexOf('
.
') + 1, name.length),
"fileUrl":"-1",
"fileUrl": "-1",
"fileName":name,
"fileName": name,
"fileSize":size,
"fileSize": size,
'
md5
':md5
'
md5
': md5
},
},
"recentContent":name,
"recentContent": name,
"Width":"210"
"Width": "210"
}
}
}
}
nim.sendFile({
nim.sendFile({
scene,
scene,
to,
to,
type,
type,
filePath,
filePath,
custom: JSON.stringify(customMsg),
custom: JSON.stringify(customMsg),
uploadprogress: function(data) {
uploadprogress: function(data){
file.progess = data.percentage
file.progess=data.percentage
event.sender.send('
sending
-
process
', file)
event.sender.send('
sending
-
process
',file)
},
},
uploaderror: function() {
uploaderror: function () {
},
},
uploaddone: function(error, file) {
uploaddone: function (error, file) {
file.progess = 100
file.progess=100
event.sender.send('
sending
-
process
', file)
event.sender.send('
sending
-
process
',file)
},
},
beforesend: function(msg) {},
beforesend: function (msg) {},
done: function(error, msg) {
done: function (error, msg) {
//onSendMsgDone(error, msg)
//onSendMsgDone(error, msg)
}
})
})
ipc.on('
read
-
clip
', function(event) {
const rawFilePath = clipboard.readBuffer('
FileNameW
').toString('
ucs2
');
let filePath = rawFilePath.replace(new RegExp(String.fromCharCode(0), '
g
'), '');
if (filePath && filePath.length > 0) {
fs.stat(filePath, function(error, stats) {
if (!error) {
if (stats.size <= 100 * 1024 * 1024) {
event.sender.send('
new
-
send
-
file
', filePath, stats.size)
return '
finish
'
} else {
global.DIALOG_MESSAGE = '
发送的文件不能大于
100
M
'
getDialogWindows()
}
} else {
console.log(error)
}
})
}
}
})
return '
end
'
})
})
ipc.on('
read
-
clip
', function (event) {
ipc.on('
auto
-
update
-
clip
', function(event) {
const rawFilePath = clipboard.readBuffer('
FileNameW
').toString('
ucs2
');
let text = clipboard.readText();
let filePath = rawFilePath.replace(new RegExp(String.fromCharCode(0), '
g
'), '');
if (text && text.length > 0) {
if(filePath && filePath.length>0){
text = escapeHTML(text)
fs.stat(filePath,function(error,stats){
clipboard.writeText(text)
if(!error){
if(stats.size<=100*1024*1024){
event.sender.send('
new
-
send
-
file
',filePath,stats.size)
return '
finish
'
}else{
global.DIALOG_MESSAGE='
发送的文件不能大于
100
M
'
getDialogWindows()
}
}
}else{
console.log(error)
}
})
})
}
//global.CURRENT_TEAM_MEMBERS
return '
end
'
ipc.on('
createo
-
or
-
open
-
team
', function(event, obj) {
global.CURRENT_TEAM_MEMBERS = obj
getAddNewUserWinodes()
})
})
ipc.on('
auto
-
update
-
clip
', function (event) {
ipc.on('
open
-
forward
-
msg
', function(event, obj) {
let text = clipboard.readText();
global.FORWARD_MSG = obj
if(text && text.length>0){
getForwardWindows()
text=escapeHTML(text)
clipboard.writeText(text)
}
})
})
//global.CURRENT_TEAM_MEMBERS
ipc.on('
close
-
team
-
box
', function(event, obj) {
ipc.on('
createo
-
or
-
open
-
team
', function (event,obj
) {
if (addNewUserWinodes && !addNewUserWinodes.isDestroyed()
) {
global.CURRENT_TEAM_MEMBERS=obj
addNewUserWinodes.close()
getAddNewUserWinodes()
}
})
})
ipc.on('
close
-
team
-
box
', function (event,
obj) {
ipc.on('
close
-
forward
', function(event,
obj) {
if(addNewUserWinodes && !addNewUserWinodes.isDestroyed())
{
if (forwardWindows && !forwardWindows.isDestroyed())
{
addNewUserWinode
s.close()
forwardWindow
s.close()
}
}
})
})
ipc.on('
save
-
team
-
members
', function
(event,
obj) {
ipc.on('
save
-
team
-
members
', function
(event,
obj) {
mainEvent.sender.send('
save
-
team
-
members
',
obj)
mainEvent.sender.send('
save
-
team
-
members
',
obj)
})
})
ipc.on('
load
-
notice
', function
(event) {
ipc.on('
load
-
notice
', function(event) {
getNoticeWindows()
getNoticeWindows()
})
})
function escapeHTML(a) {
function escapeHTML(a) {
return a.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/ /g, " ").replace(/"/g, "
\
"").replace(/'
/
g
,
"'"
)
return a.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/ /g, " ").replace(/"/g, "
\
"").replace(/'
/
g
,
"'"
)
}
let
getLoginWindow
=
function
(){
loginWindow
=
new
BrowserWindow
({
transparent
:
systemPreferences
.
isAeroGlassEnabled
(),
frame
:
false
,
maximizable
:
false
,
resizable
:
false
,
show
:
false
,
height
:
470
,
width
:
330
,
icon
:
windowIcon
,
alwaysOnTop
:
true
})
loginWindow
.
loadURL
(
winURL
)
loginWindow
.
setMenu
(
null
)
loginWindow
.
once
(
'ready-to-show'
,
()
=>
{
loginWindow
.
show
()
})
}
let
getMainWinodw
=
function
(
isLoad
){
if
(
!
mainWindow
||
mainWindow
.
isDestroyed
()){
mainWindow
=
new
BrowserWindow
({
transparent
:
systemPreferences
.
isAeroGlassEnabled
(),
frame
:
false
,
maximizable
:
false
,
resizable
:
true
,
show
:
false
,
height
:
600
,
width
:
900
,
icon
:
windowIcon
,
minWidth
:
850
,
minHeight
:
580
,
webPreferences
:{
webSecurity
:
false
},
})
mainWindow
.
on
(
'close'
,
(
e
)
=>
{
mainWindow
.
hide
()
e
.
preventDefault
()
})
}
if
(
isLoad
==
0
){
mainWindow
.
loadURL
(
mainUrl
)
mainWindow
.
once
(
'ready-to-show'
,
()
=>
{
mainWindow
.
show
()
mainWindow
.
setAlwaysOnTop
(
true
)
mainWindow
.
setAlwaysOnTop
(
false
)
//getNoticeWindows()
})
}
//加载隐藏窗口防止用户关闭
if
(
!
hideWindow
||
hideWindow
.
isDestroyed
()){
hideWindow
=
new
BrowserWindow
({
transparent
:
systemPreferences
.
isAeroGlassEnabled
(),
frame
:
false
,
maximizable
:
false
,
resizable
:
true
,
show
:
false
,
height
:
1
,
width
:
1
,
icon
:
windowIcon
})
hideWindow
.
setSkipTaskbar
(
true
)
hideWindow
.
webContents
.
closeDevTools
()
}
}
}
let
getPreviwerFileWindow
=
function
(){
let
getLoginWindow
=
function
()
{
if
(
!
previewfileWindow
||
previewfileWindow
.
isDestroyed
()){
loginWindow
=
new
BrowserWindow
({
previewfileWindow
=
new
BrowserWindow
({
transparent
:
systemPreferences
.
isAeroGlassEnabled
(),
transparent
:
systemPreferences
.
isAeroGlassEnabled
(),
frame
:
false
,
frame
:
false
,
maximizable
:
false
,
maximizable
:
true
,
resizable
:
false
,
resizable
:
false
,
show
:
false
,
show
:
false
,
height
:
470
,
icon
:
windowIcon
,
width
:
330
,
width
:
electron
.
screen
.
getPrimaryDisplay
().
workAreaSize
.
width
-
40
,
icon
:
windowIcon
,
height
:
electron
.
screen
.
getPrimaryDisplay
().
workAreaSize
.
height
-
40
,
alwaysOnTop
:
true
skipTaskbar
:
true
})
})
}
loginWindow
.
loadURL
(
winURL
)
previewfileWindow
.
loadURL
(
previewfileUrl
)
loginWindow
.
setMenu
(
null
)
previewfileWindow
.
setMenu
(
null
)
loginWindow
.
once
(
'ready-to-show'
,
()
=>
{
previewfileWindow
.
setAlwaysOnTop
(
true
)
loginWindow
.
show
()
previewfileWindow
.
setAlwaysOnTop
(
false
)
previewfileWindow
.
once
(
'ready-to-show'
,
()
=>
{
previewfileWindow
.
show
()
})
}
let
getPreviwerImgWindow
=
function
(){
if
(
!
previwerImgWindow
||
previwerImgWindow
.
isDestroyed
()){
previwerImgWindow
=
new
BrowserWindow
({
transparent
:
systemPreferences
.
isAeroGlassEnabled
(),
frame
:
false
,
maximizable
:
true
,
resizable
:
false
,
show
:
false
,
icon
:
windowIcon
,
width
:
electron
.
screen
.
getPrimaryDisplay
().
workAreaSize
.
width
-
40
,
height
:
electron
.
screen
.
getPrimaryDisplay
().
workAreaSize
.
height
-
40
,
skipTaskbar
:
true
})
})
}
previwerImgWindow
.
loadURL
(
previewfileImg
)
previwerImgWindow
.
setMenu
(
null
)
previwerImgWindow
.
setAlwaysOnTop
(
true
)
previwerImgWindow
.
setAlwaysOnTop
(
false
)
previwerImgWindow
.
once
(
'ready-to-show'
,
()
=>
{
previwerImgWindow
.
show
()
})
}
}
let
getMainWinodw
=
function
(
isLoad
)
{
if
(
!
mainWindow
||
mainWindow
.
isDestroyed
())
{
mainWindow
=
new
BrowserWindow
({
transparent
:
systemPreferences
.
isAeroGlassEnabled
(),
frame
:
false
,
maximizable
:
false
,
resizable
:
true
,
show
:
false
,
height
:
600
,
width
:
900
,
icon
:
windowIcon
,
minWidth
:
850
,
minHeight
:
580
,
webPreferences
:
{
webSecurity
:
false
},
})
mainWindow
.
on
(
'close'
,
(
e
)
=>
{
mainWindow
.
hide
()
e
.
preventDefault
()
})
}
if
(
isLoad
==
0
)
{
mainWindow
.
loadURL
(
mainUrl
)
mainWindow
.
once
(
'ready-to-show'
,
()
=>
{
mainWindow
.
show
()
mainWindow
.
setAlwaysOnTop
(
true
)
mainWindow
.
setAlwaysOnTop
(
false
)
let
getPreviwerVideoWindow
=
function
(){
//getNoticeWindows()
if
(
!
previwerVideoWindow
||
previwerVideoWindow
.
isDestroyed
()){
})
previwerVideoWindow
=
new
BrowserWindow
({
}
transparent
:
systemPreferences
.
isAeroGlassEnabled
(),
//加载隐藏窗口防止用户关闭
frame
:
false
,
if
(
!
hideWindow
||
hideWindow
.
isDestroyed
())
{
maximizable
:
true
,
hideWindow
=
new
BrowserWindow
({
resizable
:
false
,
transparent
:
systemPreferences
.
isAeroGlassEnabled
(),
show
:
false
,
frame
:
false
,
icon
:
windowIcon
,
maximizable
:
false
,
width
:
400
,
resizable
:
true
,
height
:
600
,
show
:
false
,
skipTaskbar
:
true
height
:
1
,
})
width
:
1
,
}
icon
:
windowIcon
previwerVideoWindow
.
loadURL
(
previewfVideoUrl
)
})
previwerVideoWindow
.
setMenu
(
null
)
hideWindow
.
setSkipTaskbar
(
true
)
previwerVideoWindow
.
setAlwaysOnTop
(
true
)
hideWindow
.
webContents
.
closeDevTools
()
previwerVideoWindow
.
setAlwaysOnTop
(
false
)
}
previwerVideoWindow
.
once
(
'ready-to-show'
,
()
=>
{
previwerVideoWindow
.
show
()
})
}
}
//dialogWindows
let
getPreviwerFileWindow
=
function
()
{
let
getDialogWindows
=
function
(){
if
(
!
previewfileWindow
||
previewfileWindow
.
isDestroyed
())
{
if
(
!
dialogWindows
||
dialogWindows
.
isDestroyed
()){
previewfileWindow
=
new
BrowserWindow
({
dialogWindows
=
new
BrowserWindow
({
transparent
:
systemPreferences
.
isAeroGlassEnabled
(),
transparent
:
systemPreferences
.
isAeroGlassEnabled
(),
frame
:
false
,
frame
:
false
,
maximizable
:
true
,
maximizable
:
true
,
resizable
:
false
,
resizable
:
false
,
show
:
false
,
show
:
false
,
icon
:
windowIcon
,
icon
:
windowIcon
,
width
:
electron
.
screen
.
getPrimaryDisplay
().
workAreaSize
.
width
-
40
,
width
:
300
,
height
:
electron
.
screen
.
getPrimaryDisplay
().
workAreaSize
.
height
-
40
,
height
:
150
,
skipTaskbar
:
true
skipTaskbar
:
true
,
})
alwaysOnTop
:
true
}
previewfileWindow
.
loadURL
(
previewfileUrl
)
previewfileWindow
.
setMenu
(
null
)
previewfileWindow
.
setAlwaysOnTop
(
true
)
previewfileWindow
.
setAlwaysOnTop
(
false
)
previewfileWindow
.
once
(
'ready-to-show'
,
()
=>
{
previewfileWindow
.
show
()
})
})
}
dialogWindows
.
loadURL
(
dialogUrl
)
dialogWindows
.
setMenu
(
null
)
dialogWindows
.
once
(
'ready-to-show'
,
()
=>
{
dialogWindows
.
show
()
})
}
}
//noticeWindows
let
getPreviwerImgWindow
=
function
()
{
let
getNoticeWindows
=
function
()
{
if
(
!
previwerImgWindow
||
previwerImgWindow
.
isDestroyed
())
{
if
(
!
noticeWindows
||
noticeWindows
.
isDestroyed
())
{
previwerImgWindow
=
new
BrowserWindow
(
{
noticeWindows
=
new
BrowserWindow
({
transparent
:
systemPreferences
.
isAeroGlassEnabled
(),
transparent
:
systemPreferences
.
isAeroGlassEnabled
()
,
frame
:
false
,
frame
:
fals
e
,
maximizable
:
tru
e
,
maximizable
:
tru
e
,
resizable
:
fals
e
,
resizable
:
false
,
show
:
false
,
show
:
false
,
icon
:
windowIcon
,
icon
:
windowIcon
,
width
:
electron
.
screen
.
getPrimaryDisplay
().
workAreaSize
.
width
-
40
,
width
:
30
0
,
height
:
electron
.
screen
.
getPrimaryDisplay
().
workAreaSize
.
height
-
4
0
,
height
:
115
,
skipTaskbar
:
true
skipTaskbar
:
true
,
})
alwaysOnTop
:
true
}
}
)
previwerImgWindow
.
loadURL
(
previewfileImg
)
noticeWindows
.
setBounds
({
previwerImgWindow
.
setMenu
(
null
)
y
:
electron
.
screen
.
getPrimaryDisplay
().
workAreaSize
.
height
-
115
,
previwerImgWindow
.
setAlwaysOnTop
(
true
)
x
:
electron
.
screen
.
getPrimaryDisplay
().
workArea
.
width
-
300
,
previwerImgWindow
.
setAlwaysOnTop
(
false
)
width
:
300
,
previwerImgWindow
.
once
(
'ready-to-show'
,
()
=>
{
height
:
115
previwerImgWindow
.
show
()
})
})
}
noticeWindows
.
loadURL
(
noticeUrl
)
noticeWindows
.
setMenu
(
null
)
noticeWindows
.
once
(
'ready-to-show'
,
()
=>
{
noticeWindows
.
show
()
})
}
}
let
getAddNewUserWinodes
=
function
(){
if
(
!
addNewUserWinodes
||
addNewUserWinodes
.
isDestroyed
()){
let
getPreviwerVideoWindow
=
function
()
{
addNewUserWinodes
=
new
BrowserWindow
({
if
(
!
previwerVideoWindow
||
previwerVideoWindow
.
isDestroyed
())
{
transparent
:
systemPreferences
.
isAeroGlassEnabled
(),
previwerVideoWindow
=
new
BrowserWindow
({
frame
:
false
,
transparent
:
systemPreferences
.
isAeroGlassEnabled
(),
maximizable
:
true
,
frame
:
false
,
resizable
:
false
,
maximizable
:
true
,
show
:
false
,
resizable
:
false
,
icon
:
windowIcon
,
show
:
false
,
width
:
500
,
icon
:
windowIcon
,
height
:
430
,
width
:
400
,
skipTaskbar
:
true
,
height
:
600
,
alwaysOnTop
:
true
skipTaskbar
:
true
})
})
addNewUserWinodes
.
loadURL
(
addnewuserUrl
)
}
addNewUserWinodes
.
setMenu
(
null
)
previwerVideoWindow
.
loadURL
(
previewfVideoUrl
)
addNewUserWinodes
.
once
(
'ready-to-show'
,
()
=>
{
previwerVideoWindow
.
setMenu
(
null
)
addNewUserWinodes
.
show
()
previwerVideoWindow
.
setAlwaysOnTop
(
true
)
previwerVideoWindow
.
setAlwaysOnTop
(
false
)
previwerVideoWindow
.
once
(
'ready-to-show'
,
()
=>
{
previwerVideoWindow
.
show
()
})
}
//dialogWindows
let
getDialogWindows
=
function
()
{
if
(
!
dialogWindows
||
dialogWindows
.
isDestroyed
())
{
dialogWindows
=
new
BrowserWindow
({
transparent
:
systemPreferences
.
isAeroGlassEnabled
(),
frame
:
false
,
maximizable
:
true
,
resizable
:
false
,
show
:
false
,
icon
:
windowIcon
,
width
:
300
,
height
:
150
,
skipTaskbar
:
true
,
alwaysOnTop
:
true
})
}
dialogWindows
.
loadURL
(
dialogUrl
)
dialogWindows
.
setMenu
(
null
)
dialogWindows
.
once
(
'ready-to-show'
,
()
=>
{
dialogWindows
.
show
()
})
}
//noticeWindows
let
getNoticeWindows
=
function
()
{
if
(
!
noticeWindows
||
noticeWindows
.
isDestroyed
())
{
noticeWindows
=
new
BrowserWindow
({
transparent
:
systemPreferences
.
isAeroGlassEnabled
(),
frame
:
false
,
maximizable
:
true
,
resizable
:
false
,
show
:
false
,
icon
:
windowIcon
,
width
:
300
,
height
:
115
,
skipTaskbar
:
true
,
alwaysOnTop
:
true
})
noticeWindows
.
setBounds
({
y
:
electron
.
screen
.
getPrimaryDisplay
().
workAreaSize
.
height
-
115
,
x
:
electron
.
screen
.
getPrimaryDisplay
().
workArea
.
width
-
300
,
width
:
300
,
height
:
115
})
}
noticeWindows
.
loadURL
(
noticeUrl
)
noticeWindows
.
setMenu
(
null
)
noticeWindows
.
once
(
'ready-to-show'
,
()
=>
{
noticeWindows
.
show
()
})
})
}
else
{
addNewUserWinodes
.
focus
()
}
}
}
let
getAddNewUserWinodes
=
function
()
{
if
(
!
addNewUserWinodes
||
addNewUserWinodes
.
isDestroyed
())
{
addNewUserWinodes
=
new
BrowserWindow
({
transparent
:
systemPreferences
.
isAeroGlassEnabled
(),
frame
:
false
,
maximizable
:
true
,
resizable
:
false
,
show
:
false
,
icon
:
windowIcon
,
width
:
500
,
height
:
430
,
skipTaskbar
:
true
,
alwaysOnTop
:
true
})
addNewUserWinodes
.
loadURL
(
addnewuserUrl
)
addNewUserWinodes
.
setMenu
(
null
)
addNewUserWinodes
.
once
(
'ready-to-show'
,
()
=>
{
addNewUserWinodes
.
show
()
})
}
else
{
addNewUserWinodes
.
focus
()
}
let
getNewMsgWindows
=
function
(){
if
(
!
newMsgWindow
||
newMsgWindow
.
isDestroyed
()){
newMsgWindow
=
new
BrowserWindow
({
transparent
:
systemPreferences
.
isAeroGlassEnabled
(),
frame
:
false
,
maximizable
:
false
,
resizable
:
false
,
show
:
false
,
useContentSize
:
true
,
alwaysOnTop
:
true
,
width
:
260
,
icon
:
windowIcon
,
skipTaskbar
:
true
})
}
let
urls
=
process
.
env
.
NODE_ENV
===
'development'
?
`http://localhost:9080/#/newmsg`
:
`file://
${
__dirname
}
/index.html#newmsg`
newMsgWindow
.
loadURL
(
urls
)
}
}
let
getScrollerhotWindows
=
function
(){
// let scroll_info=electron.screen.getAllDisplays()
let
getForwardWindows
=
function
()
{
scrollerhotWindows
=
new
BrowserWindow
({
if
(
!
forwardWindows
||
forwardWindows
.
isDestroyed
())
{
transparent
:
systemPreferences
.
isAeroGlassEnabled
(),
forwardWindows
=
new
BrowserWindow
({
frame
:
false
,
transparent
:
systemPreferences
.
isAeroGlassEnabled
(),
maximizable
:
false
,
frame
:
false
,
resizable
:
false
,
maximizable
:
true
,
show
:
false
,
resizable
:
false
,
alwaysOnTop
:
true
,
show
:
false
,
icon
:
windowIcon
,
icon
:
windowIcon
,
webPreferences
:{
webSecurity
:
false
},
width
:
500
,
skipTaskbar
:
true
height
:
430
,
})
skipTaskbar
:
true
,
let
urls
=
process
.
env
.
NODE_ENV
===
'development'
?
`http://localhost:9080/#/scrollerhot`
:
`file://
${
__dirname
}
/index.html#scrollerhot`
alwaysOnTop
:
true
scrollerhotWindows
.
loadURL
(
urls
)
})
scrollerhotWindows
.
setFullScreen
(
true
)
forwardWindows
.
loadURL
(
forwardUrl
)
forwardWindows
.
setMenu
(
null
)
forwardWindows
.
once
(
'ready-to-show'
,
()
=>
{
forwardWindows
.
show
()
})
}
else
{
forwardWindows
.
focus
()
}
}
}
let
screenHotBegin
=
function
(){
let
p
=
process
.
execPath
.
substring
(
0
,
process
.
execPath
.
lastIndexOf
(
'
\
\'
) + 1)+'
PrintScr
.
exe
'
let
getNewMsgWindows
=
function
()
{
var screen_window = cp.execFile(p)
if
(
!
newMsgWindow
||
newMsgWindow
.
isDestroyed
())
{
screen_window.on('
exit
', function (code) {
newMsgWindow
=
new
BrowserWindow
({
// 执行成功返回 1,返回 0 没有截图
transparent
:
systemPreferences
.
isAeroGlassEnabled
(),
if (code){
frame
:
false
,
mainEvent.sender.send('
new
-
screen
-
hot
',clipboard.readImage().toDataURL())
maximizable
:
false
,
resizable
:
false
,
show
:
false
,
useContentSize
:
true
,
alwaysOnTop
:
true
,
width
:
260
,
icon
:
windowIcon
,
skipTaskbar
:
true
})
}
}
})
let
urls
=
process
.
env
.
NODE_ENV
===
'development'
?
`http://localhost:9080/#/newmsg`
:
`file://
${
__dirname
}
/index.html#newmsg`
newMsgWindow
.
loadURL
(
urls
)
}
}
let registScrollerHotKey=function(){
let
getScrollerhotWindows
=
function
()
{
globalShortcut.register('
CommandOrControl
+
Alt
+
Q
', function () {
// let scroll_info=electron.screen.getAllDisplays()
screenHotBegin()
scrollerhotWindows
=
new
BrowserWindow
({
})
transparent
:
systemPreferences
.
isAeroGlassEnabled
(),
frame
:
false
,
maximizable
:
false
,
resizable
:
false
,
show
:
false
,
alwaysOnTop
:
true
,
icon
:
windowIcon
,
webPreferences
:
{
webSecurity
:
false
},
skipTaskbar
:
true
})
let
urls
=
process
.
env
.
NODE_ENV
===
'development'
?
`http://localhost:9080/#/scrollerhot`
:
`file://
${
__dirname
}
/index.html#scrollerhot`
scrollerhotWindows
.
loadURL
(
urls
)
scrollerhotWindows
.
setFullScreen
(
true
)
}
}
let
screenHotBegin
=
function
()
{
let formatDate=function(date,format){
let
p
=
process
.
execPath
.
substring
(
0
,
process
.
execPath
.
lastIndexOf
(
'
\
\'
) + 1) + '
PrintScr
.
exe
'
var o = {
var screen_window = cp.execFile(p)
"M+" : date.getMonth()+1, //month
screen_window.on('
exit
', function(code) {
"d+" : date.getDate(), //day
// 执行成功返回 1,返回 0 没有截图
"h+" : date.getHours(), //hour
if (code) {
"m+" : date.getMinutes(), //minute
mainEvent.sender.send('
new
-
screen
-
hot
', clipboard.readImage().toDataURL())
"s+" : date.getSeconds(), //second
}
"q+" : Math.floor((date.getMonth()+3)/3), //quarter
"S" : date.getMilliseconds() //millisecond
};
if(/(y+)/.test(format)) {
format = format.replace(RegExp.$1, (date.getFullYear()+"").substr(4 - RegExp.$1.length));
}
for(var k in o) {
if(new RegExp("("+ k +")").test(format)) {
format = format.replace(RegExp.$1, RegExp.$1.length==1 ? o[k] : ("00"+ o[k]).substr((""+ o[k]).length));
}
}
return format;
};
let initNIM=function(uid,token){
try {
nim = SDK.getInstance({
debug: false,
appKey: '
b612b31e837c79c68f141aeb719d2b20
',
account: uid,
token: token,
db: false,
onconnect: onConnect,
onwillreconnect: onWillReconnect,
ondisconnect: onDisconnect,
onerror: onError
})
})
}
function onConnect() {
let registScrollerHotKey = function() {
globalShortcut.register('
CommandOrControl
+
Alt
+
Q
', function() {
}
screenHotBegin()
function onWillReconnect(obj) {
})
// 此时说明 SDK 已经断开连接, 请开发者在界面上提示用户连接已断开, 而且正在重新建立连接
}
let formatDate = function(date, format) {
var o = {
"M+": date.getMonth() + 1, //month
"d+": date.getDate(), //day
"h+": date.getHours(), //hour
"m+": date.getMinutes(), //minute
"s+": date.getSeconds(), //second
"q+": Math.floor((date.getMonth() + 3) / 3), //quarter
"S": date.getMilliseconds() //millisecond
};
if (/(y+)/.test(format)) {
format = format.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
}
}
function onDisconnect(error) {
for (var k in o) {
// 此时说明 SDK 处于断开状态, 开发者此时应该根据错误码提示相应的错误信息, 并且跳转到登录页面
if (new RegExp("(" + k + ")").test(format)) {
format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
if (error) {
switch (error.code) {
// 账号或者密码错误, 请跳转到登录页面并提示错误
case 302:
break;
// 重复登录, 已经在其它端登录了, 请跳转到登录页面并提示错误
case 417:
break;
// 被踢, 请提示错误后跳转到登录页面
case '
kicked
':
break;
default:
break;
}
}
}
}
}
function onError(error) {
return format;
console.log(error);
};
let initNIM = function(uid, token) {
try {
nim = SDK.getInstance({
debug: false,
appKey: '
b612b31e837c79c68f141aeb719d2b20
',
account: uid,
token: token,
db: false,
onconnect: onConnect,
onwillreconnect: onWillReconnect,
ondisconnect: onDisconnect,
onerror: onError
})
function onConnect() {
}
function onWillReconnect(obj) {
// 此时说明 SDK 已经断开连接, 请开发者在界面上提示用户连接已断开, 而且正在重新建立连接
}
function onDisconnect(error) {
// 此时说明 SDK 处于断开状态, 开发者此时应该根据错误码提示相应的错误信息, 并且跳转到登录页面
if (error) {
switch (error.code) {
// 账号或者密码错误, 请跳转到登录页面并提示错误
case 302:
break;
// 重复登录, 已经在其它端登录了, 请跳转到登录页面并提示错误
case 417:
break;
// 被踢, 请提示错误后跳转到登录页面
case '
kicked
':
break;
default:
break;
}
}
}
function onError(error) {
console.log(error);
}
} catch (error) {
}
}
} catch (error) {
}
\ No newline at end of file
}
}
src/renderer/components/index.vue
View file @
ebacf562
...
@@ -164,6 +164,8 @@ export default {
...
@@ -164,6 +164,8 @@ export default {
this
.
MsgBus
.
$emit
(
"delete-members"
,
obj
.
teamMembers
)
this
.
MsgBus
.
$emit
(
"delete-members"
,
obj
.
teamMembers
)
}
else
if
(
obj
.
action
==
'create'
){
}
else
if
(
obj
.
action
==
'create'
){
this
.
MsgBus
.
$emit
(
"create-group"
,
obj
.
teamMembers
)
this
.
MsgBus
.
$emit
(
"create-group"
,
obj
.
teamMembers
)
}
else
if
(
obj
.
action
==
'forward'
){
this
.
MsgBus
.
$emit
(
"goForward"
,
obj
.
sessions
)
}
}
//
//
})
})
...
...
src/renderer/components/msssage/chatitem.vue
View file @
ebacf562
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
v-if=
"msg.type=='image' || msg.type=='video' || msg.type=='audio'"
v-if=
"msg.type=='image' || msg.type=='video' || msg.type=='audio'"
@
click=
"downloadFile(msg,1)"
@
click=
"downloadFile(msg,1)"
>
另存为...
</v-contextmenu-item>
>
另存为...
</v-contextmenu-item>
<v-contextmenu-item
@
click=
"forwardMsg(msg)"
>
转发
</v-contextmenu-item>
<v-contextmenu-item
divider
v-if=
"msg.flow==='out'"
></v-contextmenu-item>
<v-contextmenu-item
divider
v-if=
"msg.flow==='out'"
></v-contextmenu-item>
<v-contextmenu-item
@
click=
"revocateMsg"
v-if=
"msg.flow==='out'"
>
撤回消息
</v-contextmenu-item>
<v-contextmenu-item
@
click=
"revocateMsg"
v-if=
"msg.flow==='out'"
>
撤回消息
</v-contextmenu-item>
</v-contextmenu>
</v-contextmenu>
...
@@ -770,6 +771,9 @@ export default {
...
@@ -770,6 +771,9 @@ export default {
// 在会话聊天页
// 在会话聊天页
this
.
$store
.
dispatch
(
"revocateMsg"
,
this
.
msg
);
this
.
$store
.
dispatch
(
"revocateMsg"
,
this
.
msg
);
},
},
forwardMsg
(
msg
){
this
.
MsgBus
.
$emit
(
"forward"
,
msg
);
},
sendRobotBlockMsg
(
msg
,
originMsg
)
{
sendRobotBlockMsg
(
msg
,
originMsg
)
{
if
(
this
.
isHistory
)
{
if
(
this
.
isHistory
)
{
// 在历史消息中,不进行机器人交互
// 在历史消息中,不进行机器人交互
...
...
src/renderer/components/msssage/index.vue
View file @
ebacf562
...
@@ -225,7 +225,8 @@ export default {
...
@@ -225,7 +225,8 @@ export default {
noticeLastTime
:
0
,
noticeLastTime
:
0
,
isNetError
:
true
,
isNetError
:
true
,
audio_base
:
''
,
audio_base
:
''
,
atIds
:
null
atIds
:
null
,
forwardMsgInfo
:{}
};
};
},
},
updated
()
{
updated
()
{
...
@@ -455,6 +456,20 @@ export default {
...
@@ -455,6 +456,20 @@ export default {
this
.
MsgBus
.
$on
(
"create-group"
,
function
(
members
)
{
this
.
MsgBus
.
$on
(
"create-group"
,
function
(
members
)
{
that
.
createGroup
(
members
);
that
.
createGroup
(
members
);
});
});
this
.
MsgBus
.
$on
(
"forward"
,
function
(
msg
){
that
.
forwardMsgInfo
=
msg
console
.
log
(
that
.
forwardMsgInfo
)
that
.
$electron
.
ipcRenderer
.
send
(
"open-forward-msg"
,
that
.
sessionlist
);
})
this
.
MsgBus
.
$on
(
"goForward"
,
function
(
sessions
){
sessions
.
forEach
(
x
=>
{
that
.
$store
.
dispatch
(
"forwardMsg"
,
{
scene
:
x
.
scene
,
to
:
x
.
to
,
msg
:
that
.
forwardMsgInfo
});
})
})
this
.
MsgBus
.
$on
(
"dispose-session"
,
function
()
{
this
.
MsgBus
.
$on
(
"dispose-session"
,
function
()
{
that
.
$store
.
dispatch
(
"resetCurrSession"
);
that
.
$store
.
dispatch
(
"resetCurrSession"
);
that
.
currentSession
=
{
that
.
currentSession
=
{
...
...
src/renderer/components/team/forwardMsg.vue
0 → 100644
View file @
ebacf562
<
template
>
<div
class=
"forward-msg"
>
<div
class=
"header__opera"
>
<span
class=
"opera__item close"
@
click=
"close"
>
<i
class=
"iconfont iconguanbi"
></i>
</span>
</div>
<div
class=
"split"
></div>
<div
class=
"content"
>
<div
class=
"panle"
>
<div
class=
"search__user_box"
>
<div
class=
"seach_ctr"
>
<span
class=
"seach__item__icon"
>
<i
class=
"iconfont iconsearch"
></i>
</span>
<input
type=
"text"
@
keyup=
"getSearch"
class=
"seach__item__input"
v-model=
"searchMember"
placeholder=
"搜索"
>
</div>
</div>
<ul
class=
"members"
style=
"bottom:0px;top:37px;"
>
<li
class=
"split-title"
v-if=
"searchMember!=''"
>
最近会话
</li>
<template
v-for=
"(item, index) in sessions"
>
<li
:key=
"index"
v-if=
"searchMember=='' || item.name.indexOf(searchMember)!=-1"
>
<img
:src=
"item.avatar"
class=
"h"
v-if=
"item.avatar"
>
<i
class=
"iconfont icontaolun head-i"
v-else-if=
"item.groupType == 0"
></i>
<i
class=
"iconfont iconqunzu head-i"
v-else-if=
"item.groupType == 1"
></i>
<i
class=
"iconfont iconyonghutouxiang head-i"
v-else
></i>
<div
class=
"u"
>
{{
item
.
name
}}
</div>
<div>
<el-checkbox
:checked=
"isExsitmember(item.to)"
@
change=
"checked=>chosenChange(index,item,checked)"
></el-checkbox>
</div>
</li>
</
template
>
<li
class=
"split-title"
v-if=
"searchResults && searchResults.length>0"
>
同事
</li>
<
template
v-for=
"(item, index) in searchResults"
>
<li
:key=
"index"
>
<img
:src=
"item.avatar"
class=
"h"
v-if=
"item.avatar"
>
<img
src=
"../../assets/img/litheader.png"
class=
"h"
v-else
>
<div
class=
"u"
>
{{
item
.
name
}}
</div>
<div>
<el-checkbox
:checked=
"isExsitmember(item.to)"
@
change=
"checked=>chosenChange(index,item,checked)"
></el-checkbox>
</div>
</li>
</
template
>
</ul>
</div>
<div
class=
"panle"
>
<div
class=
"remark"
>
分别转发给:
</div>
<ul
class=
"members"
v-loading=
"isLoading"
>
<
template
v-for=
"(item, index) in checkNodes"
>
<li
:key=
"index"
>
<img
:src=
"item.avatar"
class=
"h"
v-if=
"item.avatar"
>
<i
class=
"iconfont icontaolun head-i"
v-else-if=
"item.groupType == 0"
></i>
<i
class=
"iconfont iconqunzu head-i"
v-else-if=
"item.groupType == 1"
></i>
<img
src=
"../../assets/img/litheader.png"
class=
"h"
v-else
>
<div
class=
"u"
>
{{
item
.
name
}}
</div>
</li>
</
template
>
</ul>
<div
class=
"bnt-box"
>
<el-button
type=
"primary"
:disabled=
"checkNodes.length==0"
size=
"mini"
@
click=
"save"
>
确定
</el-button>
<el-button
size=
"mini"
@
click=
"close"
>
取消
</el-button>
</div>
</div>
</div>
</div>
</template>
<
script
>
export
default
{
data
()
{
return
{
groupboxSearch
:
0
,
webAllpartList
:
[],
searchMember
:
""
,
checkNodes
:
[],
sessions
:
[],
searchResults
:
[],
isLoading
:
false
,
action
:
'forward'
,
deleteCount
:
0
};
},
mounted
()
{
this
.
sessions
=
this
.
$electron
.
remote
.
getGlobal
(
"FORWARD_MSG"
)
},
methods
:
{
save
(){
let
obj
=
{
action
:
this
.
action
,
sessions
:
this
.
checkNodes
}
this
.
$electron
.
ipcRenderer
.
send
(
'save-team-members'
,
obj
)
this
.
close
()
},
chosenChange
(
index
,
item
,
checked
){
if
(
checked
)
{
this
.
checkNodes
.
push
(
item
)
}
else
{
let
i
=
0
this
.
checkNodes
.
forEach
((
x
,
index
)
=>
{
if
(
x
.
to
==
item
.
to
){
i
=
index
return
false
}
})
this
.
checkNodes
.
splice
(
i
,
1
)
}
},
handleChosenChange
(
index
,
item
,
checked
)
{
if
(
item
)
{
item
.
isCheck
=
checked
;
this
.
$set
(
this
.
searchResults
,
index
,
item
);
if
(
!
checked
)
{
this
.
delMember
(
item
.
imAccount
);
}
else
{
if
(
item
.
imAccount
&&
!
this
.
isExsitmember
(
item
.
imAccount
).
h
)
{
let
member
=
{
account
:
item
.
imAccount
,
alias
:
item
.
name
,
avatar
:
item
.
icon
,
isExsit
:
false
};
if
(
this
.
teamMembers
.
length
<
200
)
this
.
teamMembers
.
push
(
member
);
}
}
}
},
getSearch
()
{
this
.
searchResults
=
[]
if
(
this
.
searchMember
!=
""
)
{
this
.
apipost
(
"admin_Get_Chat_All_SelectEmpName"
,
{
EmName
:
this
.
searchMember
},
res
=>
{
if
(
res
.
data
.
resultCode
==
1
)
{
this
.
searchResults
=
res
.
data
.
data
.
filter
(
x
=>
{
if
(
!
x
.
imAccount
)
{
return
;
}
x
.
scene
=
'p2p'
x
.
to
=
x
.
imAccount
x
.
avatar
=
x
.
icon
x
.
groupType
=
3
return
x
;
});
console
.
log
(
this
.
searchResults
)
}
},
err
=>
{}
);
}
},
isExsitmember
(
account
)
{
let
isExsit
=
false
this
.
checkNodes
.
forEach
(
x
=>
{
if
(
x
.
to
==
account
){
isExsit
=
true
return
false
}
})
return
isExsit
;
},
close
()
{
this
.
$electron
.
remote
.
getCurrentWindow
().
close
();
},
handleCheckChange
(
data
,
checked
,
indeterminate
)
{
this
.
checkNodes
=
this
.
$refs
.
tree
.
getCheckedNodes
();
}
}
};
</
script
>
<
style
>
.forward-msg
{
width
:
100%
;
height
:
100%
;
box-sizing
:
border-box
;
border
:
1px
solid
#ddd
;
box-shadow
:
0
0
2px
#ccc
;
background
:
#fff
;
padding-top
:
20px
;
-webkit-app-region
:
drag
!important
;
}
.forward-msg
.members
.head-i
{
width
:
40px
;
height
:
40px
;
border-radius
:
100%
;
margin-right
:
10px
;
background
:
#2d98da
;
line-height
:
40px
;
text-align
:
center
;
font-size
:
22px
;
color
:
#FFF
;
}
.forward-msg
.el-tree
{
cursor
:
default
;
background
:
#fff
;
padding-left
:
12px
;
border
:
none
;
}
.forward-msg
.el-tree-node__content
:hover
{
background
:
transparent
;
}
.el-tree-node__content
{
line-height
:
30px
;
}
.forward-msg
.header__opera
{
position
:
absolute
;
top
:
0px
;
right
:
0px
;
text-align
:
right
;
}
.forward-msg
.split
{
position
:
absolute
;
top
:
3px
;
left
:
50%
;
bottom
:
3px
;
width
:
1px
;
background
:
#eee
;
z-index
:
3
;
}
.forward-msg
.content
{
display
:
flex
;
position
:
absolute
;
top
:
23px
;
left
:
3px
;
right
:
3px
;
bottom
:
3px
;
-webkit-app-region
:
no-drag
!important
;
}
.forward-msg
.content
.panle
{
flex
:
1
;
position
:
relative
;
}
.forward-msg
.content
.split-title
{
height
:
20px
!important
;
line-height
:
20px
!important
;
padding
:
0
10px
!important
;
font-size
:
12px
;
color
:
#777
;
background
:
#f1f1f1
;
font-family
:
'microsoft yahei'
!important
;
}
.forward-msg
.content
.panle
.remark
{
margin
:
0
20px
10px
20px
;
font-size
:
12px
;
}
.forward-msg
.content
.panle
.search__user_box
{
display
:
flex
;
margin
:
0
20px
10px
20px
;
}
.forward-msg
.content
.panle
.search__user_box
.seach_ctr
{
flex
:
1
;
position
:
relative
;
}
.forward-msg
.content
.panle
.search__user_box
.seach_ctr
.seach__item__input
{
width
:
100%
;
text-indent
:
23px
;
height
:
23px
;
line-height
:
23px
;
border
:
none
;
border
:
1px
solid
rgb
(
225
,
225
,
225
);
outline
:
none
;
font-size
:
12px
;
color
:
#000
;
background
:
transparent
;
box-sizing
:
border-box
;
background
:
rgb
(
225
,
225
,
225
);
border-radius
:
2px
;
}
.forward-msg
.content
.panle
.search__user_box
.seach_ctr
.seach__item__input
:focus
{
background
:
#fff
;
}
.forward-msg
.content
.panle
.search__user_box
.seach_ctr
.seach__item__icon
{
font-size
:
14px
;
color
:
#999
;
position
:
absolute
;
top
:
2px
;
left
:
0
;
padding-left
:
7px
;
max-width
:
24px
!important
;
}
.forward-msg
.content
.panle
.search__user_box
.seach_ctr
.seach__item__icon
i
{
font-size
:
12px
;
}
.forward-msg
.content
.panle
.members
{
position
:
absolute
;
top
:
26px
;
left
:
0
;
right
:
0
;
bottom
:
30px
;
overflow-y
:
auto
;
margin
:
0
;
padding
:
0
;
}
.forward-msg
.content
.panle
.members
li
{
padding
:
0
20px
;
height
:
58px
;
display
:
flex
;
align-items
:
center
;
cursor
:
default
;
}
.forward-msg
.content
.panle
.members
li
.el-checkbox__inner
{
width
:
20px
;
height
:
20px
;
border-radius
:
100%
;
}
.forward-msg
.content
.panle
.members
li
.el-checkbox__inner
::after
{
left
:
7px
;
top
:
4px
;
}
.forward-msg
.content
.panle
.members
li
.h
{
width
:
40px
;
height
:
40px
;
border-radius
:
100%
;
margin-right
:
10px
;
}
.forward-msg
.content
.panle
.members
li
.u
{
flex
:
1
;
font-size
:
14px
;
word-break
:
break-all
;
display
:
-webkit-box
;
-webkit-line-clamp
:
1
;
-webkit-box-orient
:
vertical
;
overflow
:
hidden
;
}
.forward-msg
.content
.panle
.members
li
.i
{
width
:
20px
;
cursor
:
pointer
;
}
.forward-msg
.content
.panle
.members
li
.i
i
{
font-size
:
14px
;
color
:
#ddd
;
}
.forward-msg
.content
.panle
.members
li
:hover
{
background
:
rgb
(
241
,
241
,
241
);
}
.forward-msg
.content
.panle
.members
li
.i
i
:hover
{
color
:
#999
;
}
.forward-msg
.content
.panle
.bnt-box
{
text-align
:
right
;
position
:
absolute
;
bottom
:
0px
;
left
:
0
;
right
:
0
;
height
:
30px
;
line-height
:
30px
;
padding
:
0
20px
;
}
.forward-msg
.content
.panle
.bnt-box
.el-button--mini
,
.forward-msg
.content
.panle
.bnt-box
.el-button--mini.is-round
{
padding
:
4px
12px
;
}
.forward-msg
.header__opera
.opera__item
{
padding
:
2px
5px
;
color
:
#aaa
;
cursor
:
pointer
;
display
:
inline-block
;
-webkit-app-region
:
no-drag
!important
;
}
.forward-msg
.header__opera
.opera__item
i
{
font-size
:
14px
;
}
.forward-msg
.header__opera
.close
:hover
{
color
:
#f1f1f1
;
background
:
#eb3b5a
;
}
.forward-msg
.header__opera
.opera__item.min
:hover
{
background
:
rgba
(
255
,
255
,
255
,
0.2
);
}
.forward-msg
.new-group-name
.search-input
{
width
:
100%
;
height
:
30px
;
line-height
:
30px
;
padding
:
5px
;
box-sizing
:
border-box
;
border
:
1.5px
solid
#ddd
;
border-radius
:
1.5px
;
color
:
#666
;
}
.forward-msg
.group-body
{
width
:
100%
;
display
:
flex
;
height
:
360px
;
overflow
:
hidden
;
}
.forward-msg
.group-foot
{
width
:
100%
;
display
:
block
;
height
:
40px
;
text-align
:
right
;
}
.forward-msg
.search-input
{
width
:
100%
;
height
:
30px
;
line-height
:
30px
;
padding
:
5px
;
box-sizing
:
border-box
;
border
:
1.5px
solid
#ddd
;
border-radius
:
1.5px
;
color
:
#666
;
}
.forward-msg
.search-input
:focus
,
.forward-msg
.new-group-name
.search-input
:focus
{
border
:
1.5px
solid
#bbb
;
border-radius
:
1.5px
;
}
.forward-msg
.search-result-box
{
height
:
calc
(
100%
-
34px
);
font-size
:
14px
;
position
:
relative
;
color
:
#000
;
font-weight
:
600
;
}
/* .forward-msg .search-result-box .tree-box .el-tree *:not(i) {
font-family: 'Microsoft YaHei' !important;
} */
.forward-msg
.search-result-box
.tree-box
{
overflow-y
:
auto
;
position
:
absolute
;
top
:
0
;
bottom
:
35px
;
left
:
0
;
right
:
0
;
}
.forward-msg
.search-result-box
.sure-bottom
{
position
:
absolute
;
bottom
:
0px
;
left
:
0
;
right
:
0
;
height
:
30px
;
background
:
#ddd
;
color
:
#999
;
text-align
:
center
;
line-height
:
30px
;
font-size
:
14px
;
font-weight
:
300
;
cursor
:
pointer
;
}
.forward-msg
.search-result-box
.sure-bottom.active
{
background
:
#409eff
;
color
:
#f1f1f1
;
}
.forward-msg
.search-result-box
.el-tree-node__content
{
height
:
auto
!important
;
}
.forward-msg
.search-result-box
.IM_messageList
{
top
:
0px
;
bottom
:
0px
;
}
.forward-msg
.search-result-box
.IM_messageList
ul
li
{
height
:
40px
;
padding
:
5px
;
}
.forward-msg
.search-result-box
.IM_messageList
ul
li
img
{
height
:
30px
;
width
:
30px
;
}
.forward-msg
.search-result-box
.IM_messageList
ul
li
.close
{
visibility
:
hidden
;
position
:
absolute
;
top
:
7px
;
right
:
10px
;
}
.forward-msg
.search-result-box
.IM_messageList
ul
li
:hover
.close
{
visibility
:
visible
;
}
.forward-msg
.group-body
.team-member-box
{
position
:
absolute
;
left
:
0
;
top
:
0px
;
right
:
0
;
height
:
200px
;
padding
:
10px
;
border-bottom
:
1px
solid
#d9d9d9
;
background-color
:
#fff
;
box-shadow
:
none
;
z-index
:
2
;
}
.forward-msg
.group-body
.team-member-box
ul
{
width
:
100%
;
height
:
100%
;
display
:
flex
;
overflow-y
:
auto
;
flex-wrap
:
wrap
;
padding-top
:
10px
;
}
.forward-msg
.group-body
.team-member-box
ul
li
{
width
:
120px
;
text-align
:
center
;
height
:
100px
;
position
:
relative
;
}
.forward-msg
.group-body
.team-member-box
ul
li
img
{
width
:
48px
;
height
:
48px
;
border-radius
:
100%
;
}
.forward-msg
.group-body
.team-member-box
ul
li
span
{
display
:
block
;
padding
:
0
3px
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
font-size
:
14px
;
}
.forward-msg
.group-body
.team-member-box
ul
li
.icon-close1
{
position
:
absolute
;
top
:
-11px
;
right
:
28px
;
cursor
:
pointer
;
}
.forward-msg
.group-body
.team-member-box
ul
li
.icon-close1
:hover
{
color
:
#ef4455
;
}
.forward-msg
.cl-name
{
padding
:
5px
0
;
font-size
:
14px
;
color
:
#999
;
font-family
:
PingFangSC-Semibold
!important
;
margin
:
15px
0
0
0
;
}
</
style
>
src/renderer/components/tools/contenteditor.vue
View file @
ebacf562
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
></div>
></div>
<div
class=
"tool-copy"
:style=
"{'top': toolTop+'px','left': toolLeft+'px'}"
v-if=
"toolShow"
>
<div
class=
"tool-copy"
:style=
"{'top': toolTop+'px','left': toolLeft+'px'}"
v-if=
"toolShow"
>
<!-- <li>复制</li> -->
<!-- <li>复制</li> -->
<li
@
click
=
"toolPaste"
>
粘贴
</li>
<li
@
paste
=
"toolPaste"
>
粘贴
</li>
</div>
</div>
</at>
</at>
</template>
</template>
...
@@ -206,7 +206,7 @@ export default {
...
@@ -206,7 +206,7 @@ export default {
methods: {
methods: {
toolPaste: function (e) {
toolPaste: function (e) {
let clipboardData = 1
let clipboardData = 1
console.log(e)
console.log(
'111111111',
e)
},
},
copyBox: function (e) {
copyBox: function (e) {
this.toolTop = e.offsetY
this.toolTop = e.offsetY
...
...
src/renderer/router/index.js
View file @
ebacf562
...
@@ -3,56 +3,60 @@ import Router from 'vue-router'
...
@@ -3,56 +3,60 @@ import Router from 'vue-router'
Vue
.
use
(
Router
)
Vue
.
use
(
Router
)
export
default
new
Router
({
export
default
new
Router
({
routes
:
[
routes
:
[{
{
path
:
'/'
,
path
:
'/'
,
name
:
'landing-page'
,
name
:
'landing-page'
,
component
:
require
(
'@/components/login'
)
component
:
require
(
'@/components/login'
)
},
},
{
{
path
:
'/home'
,
path
:
'/home'
,
name
:
'home'
,
name
:
'home'
,
component
:
require
(
'@/components/index'
)
component
:
require
(
'@/components/index'
)
},
},
{
{
path
:
'/previewfile'
,
path
:
'/previewfile'
,
name
:
'previewfile'
,
name
:
'previewfile'
,
component
:
require
(
'@/components/tools/previewerfile'
)
component
:
require
(
'@/components/tools/previewerfile'
)
},
},
{
{
path
:
'/previewerimg'
,
path
:
'/previewerimg'
,
name
:
'previewerimg'
,
name
:
'previewerimg'
,
component
:
require
(
'@/components/tools/previewerimg'
)
component
:
require
(
'@/components/tools/previewerimg'
)
},
},
{
{
path
:
'/previewervideo'
,
path
:
'/previewervideo'
,
name
:
'previewervideo'
,
name
:
'previewervideo'
,
component
:
require
(
'@/components/tools/previewervideo'
)
component
:
require
(
'@/components/tools/previewervideo'
)
},
},
{
{
path
:
'/newmsg'
,
path
:
'/newmsg'
,
name
:
'newmsg'
,
name
:
'newmsg'
,
component
:
require
(
'@/components/msssage/newMsgPop'
)
component
:
require
(
'@/components/msssage/newMsgPop'
)
},
},
{
{
path
:
'/scrollerhot'
,
path
:
'/scrollerhot'
,
name
:
'scrollerhot'
,
name
:
'scrollerhot'
,
component
:
require
(
'@/components/tools/scrollerhot'
)
component
:
require
(
'@/components/tools/scrollerhot'
)
},
},
{
{
path
:
'/dialog'
,
path
:
'/dialog'
,
name
:
'dialog'
,
name
:
'dialog'
,
component
:
require
(
'@/components/tools/dialog'
)
component
:
require
(
'@/components/tools/dialog'
)
},
},
{
{
path
:
'/addnewuser'
,
path
:
'/addnewuser'
,
name
:
'addnewuser'
,
name
:
'addnewuser'
,
component
:
require
(
'@/components/team/addNewUser'
)
component
:
require
(
'@/components/team/addNewUser'
)
},
},
{
{
path
:
'/notice'
,
path
:
'/notice'
,
name
:
'notice'
,
name
:
'notice'
,
component
:
require
(
'@/components/tools/notice'
)
component
:
require
(
'@/components/tools/notice'
)
},
}
{
]
path
:
'/forwardMsg'
,
})
name
:
'forwardMsg'
,
component
:
require
(
'@/components/team/forwardMsg'
)
}
]
})
\ No newline at end of file
src/store/actions/msgs.js
View file @
ebacf562
...
@@ -92,7 +92,7 @@ export function forwardMsg({ state, commit }, obj) {
...
@@ -92,7 +92,7 @@ export function forwardMsg({ state, commit }, obj) {
nim
.
forwardMsg
({
nim
.
forwardMsg
({
scene
:
obj
.
scene
,
scene
:
obj
.
scene
,
to
:
obj
.
to
,
to
:
obj
.
to
,
msg
:
obj
.
tip
,
msg
:
obj
.
msg
,
done
:
function
(
err
,
msg
)
{
done
:
function
(
err
,
msg
)
{
onMsg
(
msg
)
onMsg
(
msg
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment