Commit 6fb4671a authored by zhengke's avatar zhengke

修改

parent 981e3eb4
......@@ -382,6 +382,28 @@ export function SetNoticeOperation(data) {
})
}
/**
* 获取日志列表
*/
export function GetMsgLogList() {
return request({
url: "/Public/GetMsgLogList",
method: 'post'
})
}
/**
* 看过后删除推送
*/
export function BeatchReadMsgLog(data) {
return request({
url: "/Public/BeatchReadMsgLog",
method: 'post',
data
})
}
......
......@@ -4,7 +4,7 @@
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 v-if="socektObj.length>0" alert="negative" name="msg">
<q-tab v-if="socektArr.length>0" 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>
......@@ -28,9 +28,9 @@
<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="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-list v-if="socektArr.length>0">
<q-item class="q-my-sm q-pa-xs items-start" v-for="(x,i) in socektArr" :key="i" clickable v-ripple
@click="goMsgDetail(x.JumpUrl),readMsgLog(x.Id,i)">
<!-- <q-item-section avatar>
<q-avatar :style="{'background-color':x.icons.backgroundColor}" rounded size="40px"
:text-color="x.icons.color">
......@@ -90,8 +90,13 @@
<script>
import {
GetMyNoticePageList
GetMyNoticePageList,
GetMsgLogList,
BeatchReadMsgLog
} from '../../api/course/index'
import {
sendSock
} from '../../api/common/socket'
import noneData from './none-data'
import NoneData from './none-data.vue'
......@@ -259,12 +264,15 @@
pageSize:5
},
Count:0,
noticeList:[]
noticeList:[],
socektArr:[],
}
},
created() {
this.init();
this.getNotify();
this.getLogList();
this.getMsg();
},
methods: {
init() {
......@@ -293,6 +301,15 @@
// }).onOk(() => {
// });
},
//获取日志列表
getLogList(){
GetMsgLogList().then(res => {
if (res.Code == 1) {
console.log(res,'日志数据');
this.socektArr = res.Data;
}
})
},
//请求公告数据
getNotify() {
GetMyNoticePageList(this.noticeMsg).then(res => {
......@@ -315,6 +332,96 @@
     query: {NoticeId:item.Id}
   });
   window.open(routeUrl.href, '_blank');
},
getMsg() {
let userinfo = this.getLocalStorage();
var SendData = {
AppId: "JiaHeJiaoYu",
ClientId: userinfo.Id,
};
sendSock(SendData, this.getDataFunc)
},
getDataFunc(e) {
console.log("socketData",e);
if (e.data) {
var newData = JSON.parse(e.data)
console.log(newData,'newData');
this.socektArr = this.socektArr.concat(newData)
this.showNotification(newData[0].Title, newData[0].Content, newData.CoverImg)
}
},
/**
* 通过Html调用显示系统通知
* @param title
* @param msg
* @param imgUrl
*/
showNotification(title, msg, 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浏览');
}
},
//跳转链接 新页面打开
goMsgDetail(url){
if(url){
window.open(url);
}
},
//看过后删除
readMsgLog(Id,index){
let msg = {
Ids:[]
}
msg.Ids.push(Id);
BeatchReadMsgLog(msg).then(res => {
if (res.Code == 1) {
this.socektArr.splice(index,1);
}
})
}
},
}
......
......@@ -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" :socekt-obj="socketMsg" @close="closeSaveForm"></notify>
<notify v-if="persistentNotify" :show-obj="userInfo" @close="closeSaveForm"></notify>
</q-layout>
</template>
......@@ -112,7 +112,6 @@
isExpend: false,
IsShowLeft: true,
userCenterMenuList: [], //用户中心菜单
socketMsg:[]
}
},
components: {
......@@ -171,79 +170,8 @@
if (this.userInfo && this.userInfo.MenuList) {
this.secondNavs = this.userInfo.MenuList.length > 0 ? this.userInfo.MenuList[i].SubList : []
}
this.getMsg();
},
methods: {
getMsg() {
let userinfo = this.getLocalStorage();
var SendData = {
AppId: "JiaHeJiaoYu",
ClientId: userinfo.Id,
};
sendSock(SendData, this.getDataFunc)
},
getDataFunc(e) {
console.log("socketData",e);
if (e.data) {
var newData = JSON.parse(e.data)
this.socketMsg = newData;
this.showNotification(newData[0].Title, newData[0].Content, newData.CoverImg)
}
},
/**
* 通过Html调用显示系统通知
* @param title
* @param msg
* @param imgUrl
*/
showNotification(title, msg, 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;
},
......
......@@ -179,7 +179,7 @@
</div>
</div>
<div style="margin-top:30px;">
<div style="margin-top:30px;" v-if="isShowEdit">
<span class="beikeModule" @click="saveInfo(1)">存为模板</span>
<q-btn label="提交" size="md" color="accent q-px-md" @click="saveInfo(0)" />
</div>
......@@ -229,6 +229,8 @@
initialFrameHeight: 150,
},
IsShowLessForm: false,
nowDate:'',
isShowEdit:false, //是否显示提交按钮
}
},
created() {},
......@@ -239,6 +241,15 @@
this.msg.ClassPlanId = this.$route.query.ClassPlanId;
}
this.getList();
var today=new Date();
var y=today.getFullYear();
var m=today.getMonth()+1;
var d=today.getDate();
var h=today.getHours();
var i=today.getMinutes();
var s=today.getSeconds();// 在小于10的数字钱前加一个‘0’
this.nowDate = y+'-'+m+'-'+d+' '+ h +':'+i+':'+s;
},
methods: {
getList() {
......@@ -263,6 +274,13 @@
}
this.TeacherName = data.TeacherName;
this.WorkDate = data.WorkDate;
var beginTimes =this.nowDate.replace(/-/g,"/"); //当前
var endTimes =data.ClassStartTime.replace(/-/g,"/"); //开始时间
var a =(Date.parse(endTimes)-Date.parse(beginTimes))/3600/1000;
if(a>0){
this.isShowEdit=true; //可以编辑
}
}
})
},
......
......@@ -160,8 +160,10 @@
<div class="text14-l">{{x.Duration}}分钟-{{x.DurationEndTime}}</div>
<div class="text14-o" v-html="x.ProjectContent"></div>
<div style="width: 100%;background: #F0F5FB;border-radius: 5px;margin: 10px 0">
<div v-if="data.IsEditSummary>0" style="width: 100%;background: #F0F5FB;border-radius: 5px;padding:10px;">
{{x.Summary}}
</div>
<div v-else style="width: 100%;background: #F0F5FB;border-radius: 5px;margin: 10px 0">
<q-input
style="background:#F0F5FB ;font-size: 12px"
v-model="x.Summary"
......@@ -381,8 +383,6 @@
})
},
saveOrderInfo(){
// this.Dloading= true;
console.log(this.data,'data');
let count=0,LessonNum=0;
this.data.LessonPlanList.forEach(x=>{
x.LessonPlanDetailsList.forEach(y=>{
......@@ -392,8 +392,6 @@
})
LessonNum+=x.LessonPlanDetailsList.length;
})
console.log(count,'count');
console.log(LessonNum,'LessonNum');
if(count==LessonNum){
this.$q.notify({
type: 'negative',
......@@ -404,7 +402,6 @@
return
}
updateClassLessPlan(this.data).then(res => {
this.Dloading= false;
if (res.Code == 1) {
this.$q.notify({
icon: 'iconfont icon-chenggong',
......@@ -413,6 +410,7 @@
message: res.Message,
position: 'top'
})
this.getList();
}
})
}
......
......@@ -296,7 +296,7 @@
},
dataList: [],
newDataList:[],
AccountType:true
AccountType:true,
}
},
created() {},
......
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