Commit 4293c384 authored by 罗超's avatar 罗超

Merge branch 'master' of http://gitlab.oytour.com/luochao/confucius into master

parents 32d8576d e85db7e0
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
}
This diff is collapsed.
...@@ -79,15 +79,46 @@ ...@@ -79,15 +79,46 @@
<template> <template>
<div class="page-body"> <div class="page-body">
<div class="page-content recordForm"> <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"> <div class="col-3">
<q-select filled stack-label option-value="TId" @input="changeRecord()" option-label="TeacherName" <q-select filled stack-label option-value="TId" @input="changeRecord()" option-label="TeacherName"
v-model="TeacherId" ref="Teacher_Id" :options="TeacherList" label="关联教师" :dense="false" 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>
<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"> v-if="dataList.resultList&&dataList.resultList.length>0">
<div class="col-4" id="timeleft"> <div class="col-4" id="timeleft">
<div v-for="item in dataList.resultList"> <div v-for="item in dataList.resultList">
...@@ -109,6 +140,10 @@ ...@@ -109,6 +140,10 @@
</div> </div>
</div> </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> </div>
</div> </div>
...@@ -135,13 +170,41 @@ ...@@ -135,13 +170,41 @@
msg: { msg: {
TeacherId: 0, TeacherId: 0,
PageIndex: 1, PageIndex: 1,
PageSize: 12, PageSize: 10,
rowsPerPage: 10,
School_Id: 0, School_Id: 0,
ClassId: 0 ClassId: 0
}, },
TeacherId:0, TeacherId:0,
dataList: {}, dataList: {},
TeacherList: [], //关联老师下拉 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() { created() {
...@@ -160,6 +223,7 @@ ...@@ -160,6 +223,7 @@
GetClassPlanLogPageList(this.msg).then(res => { GetClassPlanLogPageList(this.msg).then(res => {
if (res.Code == 1) { if (res.Code == 1) {
this.dataList = res.Data.PageData; this.dataList = res.Data.PageData;
this.pageCount = res.Data.PageCount;
} }
}) })
}, },
...@@ -170,9 +234,14 @@ ...@@ -170,9 +234,14 @@
GetClassPlanLogPageList(this.msg).then(res => { GetClassPlanLogPageList(this.msg).then(res => {
if (res.Code == 1) { if (res.Code == 1) {
this.dataList = res.Data.PageData; this.dataList = res.Data.PageData;
this.pageCount = res.Data.PageCount;
} }
}) })
},
//翻页
changePage(val) {
this.msg.pageIndex = val;
this.getRecord()
}, },
//获取教师下拉 //获取教师下拉
GetTeacherList() { GetTeacherList() {
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
{{name}} {{name}}
</q-toolbar-title> </q-toolbar-title>
<q-tabs v-model="tab" @input="changeNavs" inline-label <q-tabs v-model="tab" @input="changeNavs" inline-label
style="margin:0 auto;height:60px;flex:1;justify-content: left;font-weight:bold;" style="margin:0 auto;height:60px;flex:1;justify-content: left;font-weight:bold;" shrink stretch
shrink stretch v-if="userInfo" active-color="primary"> 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}`" <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" /> :label="x.MenuName" :icon="x.MenuIcon" />
</q-tabs> </q-tabs>
...@@ -83,6 +83,9 @@ ...@@ -83,6 +83,9 @@
} from 'vuex' } from 'vuex'
import userInfoBox from '../components/global/user-right-box' import userInfoBox from '../components/global/user-right-box'
import notify from '../components/global/notify' import notify from '../components/global/notify'
import {
sendSock
} from '../api/common/socket'
export default { export default {
name: 'MainLayout', name: 'MainLayout',
data() { data() {
...@@ -104,14 +107,14 @@ ...@@ -104,14 +107,14 @@
width: '6px', width: '6px',
opacity: 0.5 opacity: 0.5
}, },
persistent:false, persistent: false,
persistentNotify:false, persistentNotify: false,
isExpend: false, isExpend: false,
IsShowLeft: true, IsShowLeft: true,
userCenterMenuList: [], //用户中心菜单 userCenterMenuList: [], //用户中心菜单
} }
}, },
components:{ components: {
userInfoBox, userInfoBox,
notify notify
}, },
...@@ -167,16 +170,88 @@ ...@@ -167,16 +170,88 @@
if (this.userInfo && this.userInfo.MenuList) { if (this.userInfo && this.userInfo.MenuList) {
this.secondNavs = this.userInfo.MenuList.length > 0 ? this.userInfo.MenuList[i].SubList : [] this.secondNavs = this.userInfo.MenuList.length > 0 ? this.userInfo.MenuList[i].SubList : []
} }
this.getMsg();
}, },
methods: { 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() { changeLeft() {
this.IsShowLeft = !this.IsShowLeft; this.IsShowLeft = !this.IsShowLeft;
}, },
showInfo(){ showInfo() {
this.persistent=true this.persistent = true
}, },
showNotify(){ showNotify() {
this.persistentNotify=true this.persistentNotify = true
}, },
changeNavs(val) { changeNavs(val) {
let i = val.split('_')[1] let i = val.split('_')[1]
...@@ -184,7 +259,7 @@ ...@@ -184,7 +259,7 @@
}, },
closeSaveForm() { closeSaveForm() {
this.persistent = false this.persistent = false
this.persistentNotify=false this.persistentNotify = false
}, },
setNavs(val) { setNavs(val) {
//防止页面数据丢失 //防止页面数据丢失
...@@ -202,6 +277,7 @@ ...@@ -202,6 +277,7 @@
<style> <style>
@import url('~assets/css/common.css'); @import url('~assets/css/common.css');
.full-width { .full-width {
height: 100%; height: 100%;
} }
...@@ -210,20 +286,23 @@ ...@@ -210,20 +286,23 @@
position: absolute; position: absolute;
color: #a1a4a9; color: #a1a4a9;
cursor: pointer; cursor: pointer;
right:75px; right: 75px;
bottom:7px; bottom: 7px;
z-index:999; 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; position: absolute;
left: 75px; left: 75px;
bottom:7px; bottom: 7px;
cursor: pointer; cursor: pointer;
z-index: 10; z-index: 10;
} }
.head-bg { .head-bg {
/*background-image: url('~assets/images/page/top.png'); /*background-image: url('~assets/images/page/top.png');
background-position: right; background-position: right;
...@@ -231,10 +310,12 @@ ...@@ -231,10 +310,12 @@
background-size: auto 100%;*/ background-size: auto 100%;*/
background-color: #FFF; background-color: #FFF;
} }
.head-bg .q-tab__label{
.head-bg .q-tab__label {
font-weight: bold !important; font-weight: bold !important;
font-size: 15px; font-size: 15px;
} }
.second-menu-bg { .second-menu-bg {
background-image: url('~assets/images/page/left.png'); background-image: url('~assets/images/page/left.png');
background-position: bottom; background-position: bottom;
...@@ -314,25 +395,29 @@ ...@@ -314,25 +395,29 @@
width: 60px; width: 60px;
} }
} }
.changeShowqidonghua { .changeShowqidonghua {
animation: shouqidonghua 0.5s linear; animation: shouqidonghua 0.5s linear;
width: 60px !important; width: 60px !important;
overflow-x: hidden; overflow-x: hidden;
} }
.wave_wrapper{
.wave_wrapper {
margin: 0px 20px 0px 0; margin: 0px 20px 0px 0;
width: 50px; width: 50px;
height: 50px; height: 50px;
position: relative; position: relative;
display:flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
border-radius: 5px; border-radius: 5px;
cursor: pointer; cursor: pointer;
} }
.wave_wrapper:hover{
.wave_wrapper:hover {
background-color: #f3f6f9; background-color: #f3f6f9;
} }
.wave_wrapper .dona { .wave_wrapper .dona {
position: absolute; position: absolute;
width: 50%; width: 50%;
...@@ -343,6 +428,7 @@ ...@@ -343,6 +428,7 @@
border-radius: 50%; border-radius: 50%;
z-index: 2; z-index: 2;
} }
.wave_wrapper span.wave_scale { .wave_wrapper span.wave_scale {
animation: wave_scale 2s both infinite; animation: wave_scale 2s both infinite;
} }
...@@ -353,11 +439,13 @@ ...@@ -353,11 +439,13 @@
-webkit-transform: scale(1, 1); -webkit-transform: scale(1, 1);
opacity: 1; opacity: 1;
} }
50% { 50% {
transform: translate3d(-41px, -41px, 0px) scale(10, 10); transform: translate3d(-41px, -41px, 0px) scale(10, 10);
-webkit-transform: scale(2.5, 2.5); -webkit-transform: scale(2.5, 2.5);
opacity: 0; opacity: 0;
} }
100% { 100% {
transform: translate3d(-41px, -41px, 0px) scale(1, 1); transform: translate3d(-41px, -41px, 0px) scale(1, 1);
-webkit-transform: scale(1, 1); -webkit-transform: scale(1, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment