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
4293c384
Commit
4293c384
authored
Apr 26, 2021
by
罗超
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/luochao/confucius
into master
parents
32d8576d
e85db7e0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
610 additions
and
152 deletions
+610
-152
socket.js
src/api/common/socket.js
+84
-0
lesson-form.vue
src/components/course/lesson-form.vue
+321
-104
record-form.vue
src/components/course/record-form.vue
+74
-5
MainLayout.vue
src/layouts/MainLayout.vue
+131
-43
No files found.
src/api/common/socket.js
0 → 100644
View file @
4293c384
var
websock
=
null
;
var
global_callback
=
null
;
//webSocket连接端口
var
serverPort
=
'10086'
;
/**
* 初始化weosocket
*/
function
initWebSocket
()
{
//ws地址
var
wsuri
=
"ws://192.168.20.8:"
+
serverPort
;
websock
=
new
WebSocket
(
wsuri
);
websock
.
onmessage
=
function
(
e
)
{
websocketonmessage
(
e
);
}
websock
.
onclose
=
function
(
e
)
{
websocketclose
(
e
);
}
websock
.
onopen
=
function
()
{
websocketOpen
();
}
//连接发生错误的回调方法
websock
.
onerror
=
function
()
{
console
.
log
(
"WebSocket连接发生错误"
);
}
}
/**
* 实际调用发送消息的方法
* @param {*} postData 参数
* @param {*} callback 回调函数
*/
function
sendSock
(
postData
,
callback
)
{
global_callback
=
callback
;
if
(
websock
.
readyState
===
websock
.
OPEN
)
{
//若是ws开启状态
websocketsend
(
postData
)
}
else
if
(
websock
.
readyState
===
websock
.
CONNECTING
)
{
// 若是 正在开启状态,则等待1s后重新调用
setTimeout
(
function
()
{
sendSock
(
postData
,
callback
);
},
1000
);
}
else
{
// 若未开启 ,则等待1s后重新调用
setTimeout
(
function
()
{
sendSock
(
postData
,
callback
);
},
1000
);
}
}
/**
* 数据接收
*/
function
websocketonmessage
(
e
)
{
global_callback
(
e
);
}
/**
* 数据发送
* @param {*} agentData
*/
function
websocketsend
(
agentData
)
{
websock
.
send
(
JSON
.
stringify
(
agentData
));
}
/**
* 关闭
*/
function
websocketclose
(
e
)
{
console
.
log
(
"connection closed ("
+
e
.
code
+
")"
);
}
/**
* 连接
*/
function
websocketOpen
(
e
)
{
console
.
log
(
"连接成功"
);
}
initWebSocket
();
export
{
sendSock
}
src/components/course/lesson-form.vue
View file @
4293c384
This diff is collapsed.
Click to expand it.
src/components/course/record-form.vue
View file @
4293c384
...
...
@@ -79,15 +79,46 @@
<
template
>
<div
class=
"page-body"
>
<div
class=
"page-content recordForm"
>
<div
class=
"row wrap"
style=
"display:flex;justify-content:flex-end"
>
<div
class=
"row wrap"
style=
"display:flex;justify-content:space-between;align-items:center;margin-bottom:16px;"
>
<div
class=
"col-3"
>
<el-radio-group
v-model=
"checkType"
size=
"mini"
>
<el-radio-button
:label=
"1"
>
列表模式
</el-radio-button>
<el-radio-button
:label=
"2"
>
时间轴模式
</el-radio-button>
</el-radio-group>
</div>
<div
class=
"col-3"
>
<q-select
filled
stack-label
option-value=
"TId"
@
input=
"changeRecord()"
option-label=
"TeacherName"
v-model=
"TeacherId"
ref=
"Teacher_Id"
:options=
"TeacherList"
label=
"关联教师"
:dense=
"false"
class=
"col-6
q-pr-lg q-pb-lg
"
emit-value
map-options
/>
class=
"col-6"
emit-value
map-options
/>
</div>
</div>
<div>
<div
class=
"col-10"
style=
"margin:20px 0 60px 0;display:flex;"
<template
v-if=
"checkType==1"
>
<q-table
:pagination=
"msg"
no-data-label=
"暂无相关数据"
flat
class=
"sticky-column-table"
separator=
"none"
:data=
"dataList.resultList"
:columns=
"columns"
>
<template
v-slot:body-cell-YearStr=
"props"
>
<q-td
auto-width
:props=
"props"
style=
"width:25%"
>
{{
props
.
row
.
YearStr
}}
-
{{
props
.
row
.
MonthStr
}}
-
{{
props
.
row
.
DayStr
}}
</q-td>
</
template
>
<
template
v-slot:body-cell-CheckNum=
"props"
>
<q-td
auto-width
:props=
"props"
style=
"width:25%"
>
<span
style=
"color:green;"
>
{{
props
.
row
.
CheckNum
}}
</span>
</q-td>
</
template
>
<
template
v-slot:body-cell-NoCheckNum=
"props"
>
<q-td
auto-width
:props=
"props"
style=
"width:25%"
>
<span
style=
"color:red;"
>
{{
props
.
row
.
NoCheckNum
}}
</span>
</q-td>
</
template
>
<
template
v-slot:bottom
>
<q-pagination
class=
"full-width justify-end"
v-model=
"msg.PageIndex"
color=
"primary"
:max=
"pageCount"
:input=
"true"
@
input=
"changePage"
/>
</
template
>
</q-table>
</template>
<
template
v-else
>
<div
class=
"col-10"
style=
"margin-bottom:20px;display:flex;"
v-if=
"dataList.resultList&&dataList.resultList.length>0"
>
<div
class=
"col-4"
id=
"timeleft"
>
<div
v-for=
"item in dataList.resultList"
>
...
...
@@ -109,6 +140,10 @@
</div>
</div>
</div>
<q-pagination
class=
"full-width justify-end"
style=
"margin-bottom:80px;padding-right:43px;"
v-model=
"msg.PageIndex"
color=
"primary"
:max=
"pageCount"
:input=
"true"
@
input=
"changePage"
/>
</
template
>
</div>
</div>
</div>
...
...
@@ -135,13 +170,41 @@
msg
:
{
TeacherId
:
0
,
PageIndex
:
1
,
PageSize
:
12
,
PageSize
:
10
,
rowsPerPage
:
10
,
School_Id
:
0
,
ClassId
:
0
},
TeacherId
:
0
,
dataList
:
{},
TeacherList
:
[],
//关联老师下拉
pageCount
:
0
,
columns
:
[{
name
:
'TeacherName'
,
label
:
'教师'
,
field
:
'TeacherName'
,
align
:
'left'
},
{
name
:
'YearStr'
,
label
:
'日期'
,
field
:
'YearStr'
,
align
:
'left'
,
},
{
name
:
'CheckNum'
,
label
:
'签到数'
,
field
:
'CheckNum'
,
align
:
'left'
},
{
name
:
'NoCheckNum'
,
label
:
'缺勤数'
,
field
:
'NoCheckNum'
,
align
:
'left'
}
],
checkType
:
1
,
//默认列表模式
}
},
created
()
{
...
...
@@ -160,6 +223,7 @@
GetClassPlanLogPageList
(
this
.
msg
).
then
(
res
=>
{
if
(
res
.
Code
==
1
)
{
this
.
dataList
=
res
.
Data
.
PageData
;
this
.
pageCount
=
res
.
Data
.
PageCount
;
}
})
},
...
...
@@ -170,9 +234,14 @@
GetClassPlanLogPageList
(
this
.
msg
).
then
(
res
=>
{
if
(
res
.
Code
==
1
)
{
this
.
dataList
=
res
.
Data
.
PageData
;
this
.
pageCount
=
res
.
Data
.
PageCount
;
}
})
},
//翻页
changePage
(
val
)
{
this
.
msg
.
pageIndex
=
val
;
this
.
getRecord
()
},
//获取教师下拉
GetTeacherList
()
{
...
...
src/layouts/MainLayout.vue
View file @
4293c384
...
...
@@ -9,8 +9,8 @@
{{
name
}}
</q-toolbar-title>
<q-tabs
v-model=
"tab"
@
input=
"changeNavs"
inline-label
style=
"margin:0 auto;height:60px;flex:1;justify-content: left;font-weight:bold;"
shrink
stretch
v-if=
"userInfo"
active-color=
"primary"
>
style=
"margin:0 auto;height:60px;flex:1;justify-content: left;font-weight:bold;"
shrink
stretch
v-if=
"userInfo"
active-color=
"primary"
>
<q-tab
v-for=
"(x, i) in userInfo.MenuList"
class=
"q-mr-md"
:key=
"i"
@
click=
"setNavs(i)"
:name=
"`navs_$
{i}`"
:label="x.MenuName" :icon="x.MenuIcon" />
</q-tabs>
...
...
@@ -20,14 +20,14 @@
</span>
<inline-svg
class=
"svg-icon svg-icon-primary"
src=
"icons/svg/Code/Compiling.svg"
></inline-svg>
</div>
<q-btn
flat
color=
"text-black"
style=
"height:50px"
@
click=
"showInfo"
>
<q-btn
flat
color=
"text-black"
style=
"height:50px"
@
click=
"showInfo"
>
<span
class=
"text-grey q-mr-xs"
>
Hi
</span>
<span
class=
"text-dark q-mr-md"
>
{{
(
userInfo
&&
userInfo
.
AccountName
?
userInfo
.
AccountName
:
""
)
}}
</span>
<q-avatar
size=
"35px"
rounded
style=
"background:#C9F7F5"
text-color=
"white"
>
<img
:src=
"userInfo.UserIcon"
v-if=
"userInfo&&userInfo.UserIcon"
>
<span
v-else
>
{{
(
userInfo
&&
userInfo
.
AccountName
?
userInfo
.
AccountName
.
substring
(
0
,
1
):
""
)
}}
</span>
</q-avatar>
</q-btn>
</q-btn>
</div>
</q-toolbar>
</q-header>
...
...
@@ -40,7 +40,7 @@
<div
class=
"is-show-menu-2"
@
click=
"changeLeft"
>
<!--
<a
v-if=
"!IsShowLeft"
title=
"收起"
><<</a>
-->
<i
v-if=
"!IsShowLeft"
class=
"iconfont icon-shouqi"
title=
"收起"
></i>
<i
v-else
class=
"iconfont icon-zhankai is_Show_menu_3"
title=
"展开"
></i>
<i
v-else
class=
"iconfont icon-zhankai is_Show_menu_3"
title=
"展开"
></i>
<!--
<a
v-else
class=
"is_Show_menu_3"
title=
"展开"
>
>>
</a>
-->
</div>
<q-list
style=
"width:180px;overflow:hidden"
>
...
...
@@ -52,7 +52,7 @@
</q-item-section>
<q-item-section>
{{
x
.
MenuName
}}
</q-item-section>
</q-item>
<q-expansion-item
v-else
:label=
"x.MenuName"
>
<q-expansion-item
v-else
:label=
"x.MenuName"
>
<q-item
:to=
"y.MenuUrl"
clickable
v-ripple
:active=
"currentPath==y.MenuUrl"
v-for=
"(y, yi) in x.SubList"
:key=
"yi"
>
<q-item-section
avatar
style=
"padding-right:0;min-width:30px;"
>
...
...
@@ -83,6 +83,9 @@
}
from
'vuex'
import
userInfoBox
from
'../components/global/user-right-box'
import
notify
from
'../components/global/notify'
import
{
sendSock
}
from
'../api/common/socket'
export
default
{
name
:
'MainLayout'
,
data
()
{
...
...
@@ -104,14 +107,14 @@
width
:
'6px'
,
opacity
:
0.5
},
persistent
:
false
,
persistentNotify
:
false
,
persistent
:
false
,
persistentNotify
:
false
,
isExpend
:
false
,
IsShowLeft
:
true
,
userCenterMenuList
:
[],
//用户中心菜单
}
},
components
:{
components
:
{
userInfoBox
,
notify
},
...
...
@@ -167,16 +170,88 @@
if
(
this
.
userInfo
&&
this
.
userInfo
.
MenuList
)
{
this
.
secondNavs
=
this
.
userInfo
.
MenuList
.
length
>
0
?
this
.
userInfo
.
MenuList
[
i
].
SubList
:
[]
}
this
.
getMsg
();
},
methods
:
{
getMsg
()
{
var
SendData
=
{
AppId
:
"JiaHeJiaoYu"
,
ClientId
:
"1"
,
};
//sendSock(SendData, this.getDataFunc)
},
getDataFunc
(
e
)
{
if
(
e
.
data
)
{
var
newData
=
JSON
.
parse
(
e
.
data
)
console
.
log
(
"getDataFunc"
,
newData
)
this
.
showNotification
(
newData
[
0
].
Title
,
newData
[
0
].
Content
,
newData
.
CoverImg
)
}
},
/**
* 通过Html调用显示系统通知
* @param title
* @param msg
* @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
)
{
Notification
.
requestPermission
(
function
(
result
)
{
//result 默认值'default'等同于拒绝 'denied' -用户选择了拒绝 'granted' -用户同意启用通知
if
(
"granted"
!=
result
)
{
console
.
log
(
'请授权浏览器能够进行通知!'
);
return
false
;
}
else
{
var
tag
=
"sds"
+
Math
.
random
();
var
notify
=
new
Notification
(
title
,
{
dir
:
'auto'
,
lang
:
'zh-CN'
,
tag
:
tag
,
//实例化的notification的id
icon
:
imgUrl
,
//通知的缩略图,icon 支持ico、png、jpg、jpeg格式
title
:
title
,
//通知的标题
body
:
msg
//通知的具体内容
}
);
// 定义通知窗口点击函数
notify
.
onclick
=
function
()
{
//如果通知消息被点击,通知窗口将被激活
window
.
focus
();
};
// 定义通知错误事件
notify
.
onerror
=
function
()
{
// console.log("");
};
// 定义通知显示事件 可以设置多少秒之后关闭 也可以不设置关闭
notify
.
onshow
=
function
()
{
// 窗口显示3S后关闭
setTimeout
(
function
()
{
notify
.
close
();
},
3000
);
};
// 定义通知关闭事件
notify
.
onclose
=
function
()
{
};
}
});
}
else
{
// 提示不支持系统通知
console
.
log
(
'您的浏览器不支持系统通知,建议使用Chrome浏览'
);
}
},
changeLeft
()
{
this
.
IsShowLeft
=
!
this
.
IsShowLeft
;
},
showInfo
(){
this
.
persistent
=
true
showInfo
()
{
this
.
persistent
=
true
},
showNotify
(){
this
.
persistentNotify
=
true
showNotify
()
{
this
.
persistentNotify
=
true
},
changeNavs
(
val
)
{
let
i
=
val
.
split
(
'_'
)[
1
]
...
...
@@ -184,7 +259,7 @@
},
closeSaveForm
()
{
this
.
persistent
=
false
this
.
persistentNotify
=
false
this
.
persistentNotify
=
false
},
setNavs
(
val
)
{
//防止页面数据丢失
...
...
@@ -202,6 +277,7 @@
<
style
>
@import
url('~assets/css/common.css')
;
.full-width
{
height
:
100%
;
}
...
...
@@ -210,20 +286,23 @@
position
:
absolute
;
color
:
#a1a4a9
;
cursor
:
pointer
;
right
:
75px
;
bottom
:
7px
;
z-index
:
999
;
right
:
75px
;
bottom
:
7px
;
z-index
:
999
;
}
.is-show-menu-2
i
{
font-size
:
30px
;
.is-show-menu-2
i
{
font-size
:
30px
;
}
.is_Show_menu_3
{
.is_Show_menu_3
{
position
:
absolute
;
left
:
75px
;
bottom
:
7px
;
bottom
:
7px
;
cursor
:
pointer
;
z-index
:
10
;
}
.head-bg
{
/*background-image: url('~assets/images/page/top.png');
background-position: right;
...
...
@@ -231,10 +310,12 @@
background-size: auto 100%;*/
background-color
:
#FFF
;
}
.head-bg
.q-tab__label
{
.head-bg
.q-tab__label
{
font-weight
:
bold
!important
;
font-size
:
15px
;
}
.second-menu-bg
{
background-image
:
url('~assets/images/page/left.png')
;
background-position
:
bottom
;
...
...
@@ -314,25 +395,29 @@
width
:
60px
;
}
}
.changeShowqidonghua
{
animation
:
shouqidonghua
0.5s
linear
;
width
:
60px
!important
;
overflow-x
:
hidden
;
}
.wave_wrapper
{
.wave_wrapper
{
margin
:
0px
20px
0px
0
;
width
:
50px
;
height
:
50px
;
position
:
relative
;
display
:
flex
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
border-radius
:
5px
;
cursor
:
pointer
;
}
.wave_wrapper
:hover
{
.wave_wrapper
:hover
{
background-color
:
#f3f6f9
;
}
.wave_wrapper
.dona
{
position
:
absolute
;
width
:
50%
;
...
...
@@ -343,26 +428,29 @@
border-radius
:
50%
;
z-index
:
2
;
}
.wave_wrapper
span
.wave_scale
{
animation
:
wave_scale
2s
both
infinite
;
animation
:
wave_scale
2s
both
infinite
;
}
@keyframes
wave_scale
{
0
%
{
transform
:
translate3d
(
-41px
,
-41px
,
0px
)
scale
(
1
,
1
);
-webkit-transform
:
scale
(
1
,
1
);
opacity
:
1
;
}
50
%
{
transform
:
translate3d
(
-41px
,
-41px
,
0px
)
scale
(
10
,
10
);
-webkit-transform
:
scale
(
2.5
,
2.5
);
opacity
:
0
;
}
100
%
{
transform
:
translate3d
(
-41px
,
-41px
,
0px
)
scale
(
1
,
1
);
-webkit-transform
:
scale
(
1
,
1
);
opacity
:
0
;
}
0
%
{
transform
:
translate3d
(
-41px
,
-41px
,
0px
)
scale
(
1
,
1
);
-webkit-transform
:
scale
(
1
,
1
);
opacity
:
1
;
}
50
%
{
transform
:
translate3d
(
-41px
,
-41px
,
0px
)
scale
(
10
,
10
);
-webkit-transform
:
scale
(
2.5
,
2.5
);
opacity
:
0
;
}
100
%
{
transform
:
translate3d
(
-41px
,
-41px
,
0px
)
scale
(
1
,
1
);
-webkit-transform
:
scale
(
1
,
1
);
opacity
:
0
;
}
}
</
style
>
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