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
536bdf24
Commit
536bdf24
authored
Sep 29, 2019
by
罗超
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/viitto/madara
parents
4669e85c
37c990b0
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
83 additions
and
7 deletions
+83
-7
index.js
src/main/index.js
+1
-1
index.vue
src/renderer/components/index.vue
+2
-0
chateditor.vue
src/renderer/components/msssage/chateditor.vue
+4
-1
index.vue
src/renderer/components/msssage/index.vue
+19
-4
contenteditor.vue
src/renderer/components/tools/contenteditor.vue
+57
-1
No files found.
src/main/index.js
View file @
536bdf24
...
@@ -715,7 +715,7 @@ ipc.on('send-file', function(event, obj) {
...
@@ -715,7 +715,7 @@ ipc.on('send-file', function(event, obj) {
}
}
})
})
})
})
ipc.on('
read
-
clip
', function(event) {
ipc.on('
read
-
clip
', function
(event) {
const rawFilePath = clipboard.readBuffer('
FileNameW
').toString('
ucs2
');
const rawFilePath = clipboard.readBuffer('
FileNameW
').toString('
ucs2
');
let filePath = rawFilePath.replace(new RegExp(String.fromCharCode(0), '
g
'), '');
let filePath = rawFilePath.replace(new RegExp(String.fromCharCode(0), '
g
'), '');
if (filePath && filePath.length > 0) {
if (filePath && filePath.length > 0) {
...
...
src/renderer/components/index.vue
View file @
536bdf24
...
@@ -101,6 +101,7 @@ export default {
...
@@ -101,6 +101,7 @@ export default {
};
};
},
},
mounted
()
{
mounted
()
{
// var devInnerHeight = 658.0;
// var devInnerHeight = 658.0;
// var devDevicePixelRatio = 1.5;
// var devDevicePixelRatio = 1.5;
// var devScaleFactor = 1.5;
// var devScaleFactor = 1.5;
...
@@ -160,6 +161,7 @@ export default {
...
@@ -160,6 +161,7 @@ export default {
this
.
MsgBus
.
$emit
(
"ignore-all-unRead"
)
this
.
MsgBus
.
$emit
(
"ignore-all-unRead"
)
})
})
this
.
$electron
.
ipcRenderer
.
on
(
'new-screen-hot'
,
(
event
,
dataurl
)
=>
{
this
.
$electron
.
ipcRenderer
.
on
(
'new-screen-hot'
,
(
event
,
dataurl
)
=>
{
this
.
$electron
.
remote
.
getCurrentWindow
().
show
();
this
.
MsgBus
.
$emit
(
"new-screen-hot"
,
dataurl
)
this
.
MsgBus
.
$emit
(
"new-screen-hot"
,
dataurl
)
})
})
//
//
...
...
src/renderer/components/msssage/chateditor.vue
View file @
536bdf24
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
<div
draggable=
"true"
id=
"text-box"
ref=
"box"
>
<div
draggable=
"true"
id=
"text-box"
ref=
"box"
>
<!--
<textarea
v-model=
"msgToSent"
class=
"input"
@
keyup
.
13=
"sendTextMsg"
></textarea>
<!--
<textarea
v-model=
"msgToSent"
class=
"input"
@
keyup
.
13=
"sendTextMsg"
></textarea>
<div
class=
'input'
@
keyup
.
13=
"sendTextMsg"
></div>
-->
<div
class=
'input'
@
keyup
.
13=
"sendTextMsg"
></div>
-->
<content-editor
:members=
'members'
@
force-update=
'forceUpdateChild'
:child=
"inputObj"
ref=
"editor"
@
send=
"sendTextMsg"
></content-editor>
<content-editor
:
sessionId=
'sessionId'
:
members=
'members'
@
force-update=
'forceUpdateChild'
:child=
"inputObj"
ref=
"editor"
@
send=
"sendTextMsg"
></content-editor>
</div>
</div>
<div
class=
"bottom-op-box"
>
<div
class=
"bottom-op-box"
>
<span
class=
"errorTip"
>
{{
errorTip
}}
</span>
<span
class=
"errorTip"
>
{{
errorTip
}}
</span>
...
@@ -222,6 +222,9 @@ export default {
...
@@ -222,6 +222,9 @@ export default {
this
.
msgToSent
=
obj
this
.
msgToSent
=
obj
},
},
openScreenhot
()
{
openScreenhot
()
{
if
(
this
.
hideThisWinActive
==
'1'
)
{
this
.
$electron
.
remote
.
getCurrentWindow
().
hide
();
}
this
.
$electron
.
ipcRenderer
.
send
(
"open-screenhot"
);
this
.
$electron
.
ipcRenderer
.
send
(
"open-screenhot"
);
},
},
dataURLtoBlob
(
dataurl
)
{
dataURLtoBlob
(
dataurl
)
{
...
...
src/renderer/components/msssage/index.vue
View file @
536bdf24
...
@@ -226,7 +226,8 @@ export default {
...
@@ -226,7 +226,8 @@ export default {
isNetError
:
true
,
isNetError
:
true
,
audio_base
:
''
,
audio_base
:
''
,
atIds
:
null
,
atIds
:
null
,
forwardMsgInfo
:{}
forwardMsgInfo
:{},
sessionlistArr
:
[],
};
};
},
},
updated
()
{
updated
()
{
...
@@ -325,8 +326,12 @@ export default {
...
@@ -325,8 +326,12 @@ export default {
});
});
if
(
index
!=
-
1
)
this
.
newMsgList
.
splice
(
index
,
1
);
if
(
index
!=
-
1
)
this
.
newMsgList
.
splice
(
index
,
1
);
this
.
$electron
.
ipcRenderer
.
send
(
"close-team-box"
);
this
.
$electron
.
ipcRenderer
.
send
(
"close-team-box"
);
this
.
$store
.
dispatch
(
'resetNoMoreHistoryMsgs'
)
this
.
$store
.
dispatch
(
'resetNoMoreHistoryMsgs'
);
this
.
currentSession
=
session
;
this
.
currentSession
.
id
=
''
;
let
_this
=
this
;
// setTimeout(()=>{
_this
.
currentSession
=
session
;
// }, 20)
if
(
session
.
atId
){
if
(
session
.
atId
){
this
.
clearAtMe
()
this
.
clearAtMe
()
this
.
atIds
=
session
.
atId
this
.
atIds
=
session
.
atId
...
@@ -516,9 +521,9 @@ export default {
...
@@ -516,9 +521,9 @@ export default {
},
},
sessionlist
()
{
sessionlist
()
{
let
unreadList
=
[];
let
unreadList
=
[];
let
historicList
=
window
.
localStorage
.
historicList
?
JSON
.
parse
(
window
.
localStorage
.
historicList
)
:
[];
let
sessionlist
=
this
.
$store
.
state
.
sessionlist
.
filter
(
item
=>
{
let
sessionlist
=
this
.
$store
.
state
.
sessionlist
.
filter
(
item
=>
{
if
(
item
.
to
===
"684cb79fe92f46877777"
){
if
(
item
.
to
===
"684cb79fe92f46877777"
){
return
;
//过滤推送消息
return
;
//过滤推送消息
}
}
this
.
createSessions
=
this
.
createSessions
.
filter
(
x
=>
{
this
.
createSessions
=
this
.
createSessions
.
filter
(
x
=>
{
...
@@ -655,6 +660,14 @@ export default {
...
@@ -655,6 +660,14 @@ export default {
}
}
unreadList
.
push
(
item
);
unreadList
.
push
(
item
);
}
}
if
(
historicList
&&
historicList
.
length
>
0
){
let
sessionlist
=
this
.
sessionlistArr
historicList
.
map
(
y
=>
{
if
(
item
.
id
==
y
.
id
)
{
item
.
historiMsg
=
y
.
innerHTML
}
})
}
return
item
;
return
item
;
});
});
if
(
!
this
.
$electron
.
remote
.
getCurrentWindow
().
isVisible
())
{
if
(
!
this
.
$electron
.
remote
.
getCurrentWindow
().
isVisible
())
{
...
@@ -670,6 +683,8 @@ export default {
...
@@ -670,6 +683,8 @@ export default {
this
.
$electron
.
remote
.
getCurrentWindow
().
flashFrame
(
true
);
this
.
$electron
.
remote
.
getCurrentWindow
().
flashFrame
(
true
);
}
}
}
}
this
.
newMsgList
=
unreadList
;
this
.
newMsgList
=
unreadList
;
return
sessionlist
;
return
sessionlist
;
}
}
...
...
src/renderer/components/tools/contenteditor.vue
View file @
536bdf24
...
@@ -36,7 +36,8 @@ export default {
...
@@ -36,7 +36,8 @@ export default {
members
:{
members
:{
type
:
Array
,
type
:
Array
,
default
:[]
default
:[]
}
},
sessionId
:
String
,
},
},
components
:
{
components
:
{
At
At
...
@@ -50,6 +51,7 @@ export default {
...
@@ -50,6 +51,7 @@ export default {
toolTop
:
0
,
toolTop
:
0
,
toolLeft
:
0
,
toolLeft
:
0
,
toolShow
:
false
,
toolShow
:
false
,
chatId
:
''
,
};
};
},
},
watch
:
{
watch
:
{
...
@@ -79,14 +81,27 @@ export default {
...
@@ -79,14 +81,27 @@ export default {
}
}
},
},
deep
:
true
deep
:
true
},
sessionId
:
{
handler
(
newValue
,
oldValue
)
{
if
(
newValue
)
{
this
.
chatId
=
newValue
document
.
querySelector
(
'#msgEditorBox'
).
innerHTML
=
''
this
.
gethistoricList
(
newValue
)
}
}
}
}
},
},
beforeDestroy
()
{
beforeDestroy
()
{
// 重复图片问题解决方案
// 重复图片问题解决方案
// 事件处理中心msgBus,vue页面销毁后,原先的监听事件并没有销毁,导致组件再次载入的时候会重复相同的事件监听,所以当组件销毁时同时需要在 beforeDestroy 钩子中销毁对应的事件监听!!!
// 事件处理中心msgBus,vue页面销毁后,原先的监听事件并没有销毁,导致组件再次载入的时候会重复相同的事件监听,所以当组件销毁时同时需要在 beforeDestroy 钩子中销毁对应的事件监听!!!
this
.
offMsgBusListener
()
this
.
offMsgBusListener
()
},
computed
:{
},
},
mounted
()
{
mounted
()
{
this
.
chatId
=
this
.
sessionId
this
.
gethistoricList
(
this
.
sessionId
)
let
that
=
this
;
let
that
=
this
;
this
.
MsgBus
.
$on
(
"send-at-name"
,
function
(
name
)
{
this
.
MsgBus
.
$on
(
"send-at-name"
,
function
(
name
)
{
document
.
querySelector
(
'#msgEditorBox'
).
innerText
=
document
.
querySelector
(
'#msgEditorBox'
).
innerText
+
`@
${
name
}
`
document
.
querySelector
(
'#msgEditorBox'
).
innerText
=
document
.
querySelector
(
'#msgEditorBox'
).
innerText
+
`@
${
name
}
`
...
@@ -212,6 +227,20 @@ export default {
...
@@ -212,6 +227,20 @@ export default {
let myInterval = window.setInterval(this.updateClipboard, 500);
let myInterval = window.setInterval(this.updateClipboard, 500);
},
},
methods: {
methods: {
gethistoricList(id){
//获取历史输入记录
let historicList = window.localStorage.historicList ? JSON.parse(window.localStorage.historicList) : [];
//如果有输入历史
if(historicList && historicList.length > 0) {
// 循环输入历史
for(let i = 0; i < historicList.length; i++) {
if (id === historicList[i].id) {
//如果有相同 赋值
document.querySelector('#msgEditorBox').innerText = historicList[i].innerHTML
}
}
}
},
offMsgBusListener(){
offMsgBusListener(){
this.MsgBus.$off("
send
-
at
-
name
");
this.MsgBus.$off("
send
-
at
-
name
");
this.MsgBus.$off("
new
-
screen
-
hot
");
this.MsgBus.$off("
new
-
screen
-
hot
");
...
@@ -229,6 +258,32 @@ export default {
...
@@ -229,6 +258,32 @@ export default {
},
},
changeTxt: function(e) {
changeTxt: function(e) {
this.child.txt = document.querySelector('#msgEditorBox').innerText;
this.child.txt = document.querySelector('#msgEditorBox').innerText;
let sessionText = document.querySelector('#msgEditorBox').innerText;
//获取历史输入记录
let historicList = window.localStorage.historicList ? JSON.parse(window.localStorage.historicList) : [];
let rp = false
if(historicList && historicList.length > 0) {
// 循环输入历史
for(let i = 0; i < historicList.length; i++) {
if (this.chatId === historicList[i].id) {
rp = true
if (sessionText.replace(/
\
s+/g,"") == '') {
historicList.splice(i, 1);
break;
}
historicList[i].innerHTML = sessionText
break;
}
}
}
if (!rp) {
historicList.push({
id: this.chatId,
innerHTML: sessionText
})
}
this.MsgBus.$emit('change-historic')
window.localStorage.historicList = JSON.stringify(historicList)
},
},
updateClipboard() {
updateClipboard() {
this.$electron.ipcRenderer.send("
auto
-
update
-
clip
");
this.$electron.ipcRenderer.send("
auto
-
update
-
clip
");
...
@@ -300,6 +355,7 @@ export default {
...
@@ -300,6 +355,7 @@ export default {
img.style.maxHeight = "
150
px
";
img.style.maxHeight = "
150
px
";
img.className='file-send-box'
img.className='file-send-box'
document.querySelector("
#
msgEditorBox
").appendChild(img);
document.querySelector("
#
msgEditorBox
").appendChild(img);
this.changeTxt()
},
},
formatHTML(f) {
formatHTML(f) {
let html = `<div title='${
let html = `<div title='${
...
...
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