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
Hide 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) {
}
})
})
ipc.on('
read
-
clip
', function(event) {
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) {
...
...
src/renderer/components/index.vue
View file @
536bdf24
...
...
@@ -101,6 +101,7 @@ export default {
};
},
mounted
()
{
// var devInnerHeight = 658.0;
// var devDevicePixelRatio = 1.5;
// var devScaleFactor = 1.5;
...
...
@@ -160,6 +161,7 @@ export default {
this
.
MsgBus
.
$emit
(
"ignore-all-unRead"
)
})
this
.
$electron
.
ipcRenderer
.
on
(
'new-screen-hot'
,
(
event
,
dataurl
)
=>
{
this
.
$electron
.
remote
.
getCurrentWindow
().
show
();
this
.
MsgBus
.
$emit
(
"new-screen-hot"
,
dataurl
)
})
//
...
...
src/renderer/components/msssage/chateditor.vue
View file @
536bdf24
...
...
@@ -35,7 +35,7 @@
<div
draggable=
"true"
id=
"text-box"
ref=
"box"
>
<!--
<textarea
v-model=
"msgToSent"
class=
"input"
@
keyup
.
13=
"sendTextMsg"
></textarea>
<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
class=
"bottom-op-box"
>
<span
class=
"errorTip"
>
{{
errorTip
}}
</span>
...
...
@@ -222,6 +222,9 @@ export default {
this
.
msgToSent
=
obj
},
openScreenhot
()
{
if
(
this
.
hideThisWinActive
==
'1'
)
{
this
.
$electron
.
remote
.
getCurrentWindow
().
hide
();
}
this
.
$electron
.
ipcRenderer
.
send
(
"open-screenhot"
);
},
dataURLtoBlob
(
dataurl
)
{
...
...
src/renderer/components/msssage/index.vue
View file @
536bdf24
...
...
@@ -226,7 +226,8 @@ export default {
isNetError
:
true
,
audio_base
:
''
,
atIds
:
null
,
forwardMsgInfo
:{}
forwardMsgInfo
:{},
sessionlistArr
:
[],
};
},
updated
()
{
...
...
@@ -325,8 +326,12 @@ export default {
});
if
(
index
!=
-
1
)
this
.
newMsgList
.
splice
(
index
,
1
);
this
.
$electron
.
ipcRenderer
.
send
(
"close-team-box"
);
this
.
$store
.
dispatch
(
'resetNoMoreHistoryMsgs'
)
this
.
currentSession
=
session
;
this
.
$store
.
dispatch
(
'resetNoMoreHistoryMsgs'
);
this
.
currentSession
.
id
=
''
;
let
_this
=
this
;
// setTimeout(()=>{
_this
.
currentSession
=
session
;
// }, 20)
if
(
session
.
atId
){
this
.
clearAtMe
()
this
.
atIds
=
session
.
atId
...
...
@@ -516,9 +521,9 @@ export default {
},
sessionlist
()
{
let
unreadList
=
[];
let
historicList
=
window
.
localStorage
.
historicList
?
JSON
.
parse
(
window
.
localStorage
.
historicList
)
:
[];
let
sessionlist
=
this
.
$store
.
state
.
sessionlist
.
filter
(
item
=>
{
if
(
item
.
to
===
"684cb79fe92f46877777"
){
return
;
//过滤推送消息
}
this
.
createSessions
=
this
.
createSessions
.
filter
(
x
=>
{
...
...
@@ -655,6 +660,14 @@ export default {
}
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
;
});
if
(
!
this
.
$electron
.
remote
.
getCurrentWindow
().
isVisible
())
{
...
...
@@ -670,6 +683,8 @@ export default {
this
.
$electron
.
remote
.
getCurrentWindow
().
flashFrame
(
true
);
}
}
this
.
newMsgList
=
unreadList
;
return
sessionlist
;
}
...
...
src/renderer/components/tools/contenteditor.vue
View file @
536bdf24
...
...
@@ -36,7 +36,8 @@ export default {
members
:{
type
:
Array
,
default
:[]
}
},
sessionId
:
String
,
},
components
:
{
At
...
...
@@ -50,6 +51,7 @@ export default {
toolTop
:
0
,
toolLeft
:
0
,
toolShow
:
false
,
chatId
:
''
,
};
},
watch
:
{
...
...
@@ -79,14 +81,27 @@ export default {
}
},
deep
:
true
},
sessionId
:
{
handler
(
newValue
,
oldValue
)
{
if
(
newValue
)
{
this
.
chatId
=
newValue
document
.
querySelector
(
'#msgEditorBox'
).
innerHTML
=
''
this
.
gethistoricList
(
newValue
)
}
}
}
},
beforeDestroy
()
{
// 重复图片问题解决方案
// 事件处理中心msgBus,vue页面销毁后,原先的监听事件并没有销毁,导致组件再次载入的时候会重复相同的事件监听,所以当组件销毁时同时需要在 beforeDestroy 钩子中销毁对应的事件监听!!!
this
.
offMsgBusListener
()
},
computed
:{
},
mounted
()
{
this
.
chatId
=
this
.
sessionId
this
.
gethistoricList
(
this
.
sessionId
)
let
that
=
this
;
this
.
MsgBus
.
$on
(
"send-at-name"
,
function
(
name
)
{
document
.
querySelector
(
'#msgEditorBox'
).
innerText
=
document
.
querySelector
(
'#msgEditorBox'
).
innerText
+
`@
${
name
}
`
...
...
@@ -212,6 +227,20 @@ export default {
let myInterval = window.setInterval(this.updateClipboard, 500);
},
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(){
this.MsgBus.$off("
send
-
at
-
name
");
this.MsgBus.$off("
new
-
screen
-
hot
");
...
...
@@ -229,6 +258,32 @@ export default {
},
changeTxt: function(e) {
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() {
this.$electron.ipcRenderer.send("
auto
-
update
-
clip
");
...
...
@@ -300,6 +355,7 @@ export default {
img.style.maxHeight = "
150
px
";
img.className='file-send-box'
document.querySelector("
#
msgEditorBox
").appendChild(img);
this.changeTxt()
},
formatHTML(f) {
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