Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
confucius
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
罗超
confucius
Commits
a8116397
Commit
a8116397
authored
Apr 26, 2021
by
zhengke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
de6255b2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
15 deletions
+26
-15
socket.js
src/api/common/socket.js
+1
-1
notify.vue
src/components/global/notify.vue
+18
-7
MainLayout.vue
src/layouts/MainLayout.vue
+7
-7
No files found.
src/api/common/socket.js
View file @
a8116397
...
...
@@ -8,7 +8,7 @@ var serverPort = '10086';
*/
function
initWebSocket
()
{
//ws地址
var
wsuri
=
"ws://
192.168.20.8
:"
+
serverPort
;
var
wsuri
=
"ws://
47.96.23.199
:"
+
serverPort
;
websock
=
new
WebSocket
(
wsuri
);
websock
.
onmessage
=
function
(
e
)
{
websocketonmessage
(
e
);
...
...
src/components/global/notify.vue
View file @
a8116397
...
...
@@ -4,11 +4,11 @@
class=
"no-border-radius flex column"
>
<q-tabs
v-model=
"tab"
class=
"text-grey"
active-color=
"secondary"
indicator-color=
"secondary"
align=
"justify"
narrow-indicator
inline-label
>
<
!--
<
q-tab
alert=
"negative"
name=
"msg"
>
<q-tab
alert=
"negative"
name=
"msg"
>
<inline-svg
class=
"svg-icon q-mr-xs"
:class=
"[tab=='msg'?'svg-icon-secondary':'svg-icon-grey']"
src=
"icons/svg/Communication/Chat-check.svg"
></inline-svg>
<span>
消息
</span>
</q-tab>
-->
</q-tab>
<q-tab
name=
"notify"
>
<inline-svg
class=
"svg-icon q-mr-xs"
:class=
"[tab=='notify'?'svg-icon-secondary':'svg-icon-grey']"
src=
"icons/svg/Communication/Urgent-mail.svg"
></inline-svg>
...
...
@@ -23,22 +23,28 @@
<q-tab-panels
v-model=
"tab"
class=
"q-mt-none col"
animated
swipeable
transition-prev=
"jump-up"
transition-next=
"jump-up"
>
<q-tab-panel
name=
"msg"
class=
"scroll _scrollbar"
>
<q-list
v-if=
"
dataList
.length>0"
>
<q-item
class=
"q-my-sm q-pa-xs items-start"
v-for=
"(x,i) in
dataList
"
:key=
"i"
clickable
v-ripple
<q-list
v-if=
"
socektObj
.length>0"
>
<q-item
class=
"q-my-sm q-pa-xs items-start"
v-for=
"(x,i) in
socektObj
"
:key=
"i"
clickable
v-ripple
@
click=
"undefinedGongneng"
>
<q-item-section
avatar
>
<
!--
<
q-item-section
avatar
>
<q-avatar
:style=
"
{'background-color':x.icons.backgroundColor}" rounded size="40px"
:text-color="x.icons.color">
<inline-svg
:class=
"['svg-icon',`svg-icon-$
{x.icons.color}`]" :src="x.icons.icon"
v-if="x.icons.icon.length>1">
</inline-svg>
<span
v-else
>
{{
x
.
icons
.
icon
}}
</span>
</q-avatar>
</q-item-section>
-->
<q-item-section
avatar
>
<q-avatar
:style=
"
{'background-color':'#e1f0ff'}" rounded size="40px"
text-color="negative">
<inline-svg
:class=
"['svg-icon',`svg-icon-primary`]"
src=
"icons/svg/Shopping/Bag2.svg"
></inline-svg>
</q-avatar>
</q-item-section>
<q-item-section>
<q-item-label
class=
"text-weight-bold"
>
{{
x
.
Title
}}
</q-item-label>
<q-item-label
caption
lines=
"3"
class=
"remark-font"
>
{{
x
.
Content
}}
</q-item-label>
</q-item-section>
<q-item-section
side
class=
"remark-font"
>
{{
x
.
Time
}}
</q-item-section>
<q-item-section
side
class=
"remark-font"
>
{{
x
.
Send
Time
}}
</q-item-section>
</q-item>
</q-list>
<none-data
v-else
></none-data>
...
...
@@ -89,6 +95,10 @@
showObj
:
{
type
:
Object
,
default
:
null
},
socektObj
:{
type
:
Array
,
default
:
null
}
},
components
:
{
...
...
@@ -98,7 +108,7 @@
return
{
persistent
:
true
,
saveLoading
:
false
,
tab
:
"
notify
"
,
tab
:
"
msg
"
,
icons
:
{
'退'
:
{
backgroundColor
:
'#ffe2e5'
,
...
...
@@ -250,6 +260,7 @@
created
()
{
this
.
init
();
this
.
getNotify
();
console
.
log
(
this
.
socektObj
,
'socektObj'
);
},
methods
:
{
init
()
{
...
...
src/layouts/MainLayout.vue
View file @
a8116397
...
...
@@ -73,7 +73,7 @@
</div>
</q-page-container>
<user-info-box
v-if=
"persistent"
:show-obj=
"userInfo"
@
close=
"closeSaveForm"
></user-info-box>
<notify
v-if=
"persistentNotify"
:show-obj=
"userInfo"
@
close=
"closeSaveForm"
></notify>
<notify
v-if=
"persistentNotify"
:show-obj=
"userInfo"
:socekt-obj=
"socketMsg"
@
close=
"closeSaveForm"
></notify>
</q-layout>
</template>
...
...
@@ -112,6 +112,7 @@
isExpend
:
false
,
IsShowLeft
:
true
,
userCenterMenuList
:
[],
//用户中心菜单
socketMsg
:[]
}
},
components
:
{
...
...
@@ -174,16 +175,18 @@
},
methods
:
{
getMsg
()
{
let
userinfo
=
this
.
getLocalStorage
();
var
SendData
=
{
AppId
:
"JiaHeJiaoYu"
,
ClientId
:
"1"
,
ClientId
:
userinfo
.
Id
,
};
//
sendSock(SendData, this.getDataFunc)
sendSock
(
SendData
,
this
.
getDataFunc
)
},
getDataFunc
(
e
)
{
if
(
e
.
data
)
{
var
newData
=
JSON
.
parse
(
e
.
data
)
console
.
log
(
"getDataFunc"
,
newData
)
console
.
log
(
"getDataFunc"
,
newData
);
this
.
socketMsg
=
newData
;
this
.
showNotification
(
newData
[
0
].
Title
,
newData
[
0
].
Content
,
newData
.
CoverImg
)
}
},
...
...
@@ -194,9 +197,6 @@
* @param imgUrl
*/
showNotification
(
title
,
msg
,
imgUrl
)
{
console
.
log
(
"title"
,
title
)
console
.
log
(
"msg"
,
msg
)
console
.
log
(
"imgUrl"
,
imgUrl
)
var
Notification
=
window
.
Notification
||
window
.
mozNotification
||
window
.
webkitNotification
;
// 判断浏览器是否支持桌面通知
if
(
Notification
)
{
...
...
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