Commit 6fb4671a authored by zhengke's avatar zhengke

修改

parent 981e3eb4
...@@ -382,6 +382,28 @@ export function SetNoticeOperation(data) { ...@@ -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 @@ ...@@ -4,7 +4,7 @@
class="no-border-radius flex column"> class="no-border-radius flex column">
<q-tabs v-model="tab" class="text-grey" active-color="secondary" indicator-color="secondary" align="justify" <q-tabs v-model="tab" class="text-grey" active-color="secondary" indicator-color="secondary" align="justify"
narrow-indicator inline-label> 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']" <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> src="icons/svg/Communication/Chat-check.svg"></inline-svg>
<span>消息</span> <span>消息</span>
...@@ -28,9 +28,9 @@ ...@@ -28,9 +28,9 @@
<q-tab-panels v-model="tab" class="q-mt-none col" animated swipeable transition-prev="jump-up" <q-tab-panels v-model="tab" class="q-mt-none col" animated swipeable transition-prev="jump-up"
transition-next="jump-up"> transition-next="jump-up">
<q-tab-panel name="msg" class="scroll _scrollbar"> <q-tab-panel name="msg" class="scroll _scrollbar">
<q-list v-if="socektObj.length>0"> <q-list v-if="socektArr.length>0">
<q-item class="q-my-sm q-pa-xs items-start" v-for="(x,i) in socektObj" :key="i" clickable v-ripple <q-item class="q-my-sm q-pa-xs items-start" v-for="(x,i) in socektArr" :key="i" clickable v-ripple
@click="undefinedGongneng"> @click="goMsgDetail(x.JumpUrl),readMsgLog(x.Id,i)">
<!-- <q-item-section avatar> <!-- <q-item-section avatar>
<q-avatar :style="{'background-color':x.icons.backgroundColor}" rounded size="40px" <q-avatar :style="{'background-color':x.icons.backgroundColor}" rounded size="40px"
:text-color="x.icons.color"> :text-color="x.icons.color">
...@@ -90,8 +90,13 @@ ...@@ -90,8 +90,13 @@
<script> <script>
import { import {
GetMyNoticePageList GetMyNoticePageList,
GetMsgLogList,
BeatchReadMsgLog
} from '../../api/course/index' } from '../../api/course/index'
import {
sendSock
} from '../../api/common/socket'
import noneData from './none-data' import noneData from './none-data'
import NoneData from './none-data.vue' import NoneData from './none-data.vue'
...@@ -259,12 +264,15 @@ ...@@ -259,12 +264,15 @@
pageSize:5 pageSize:5
}, },
Count:0, Count:0,
noticeList:[] noticeList:[],
socektArr:[],
} }
}, },
created() { created() {
this.init(); this.init();
this.getNotify(); this.getNotify();
this.getLogList();
this.getMsg();
}, },
methods: { methods: {
init() { init() {
...@@ -293,6 +301,15 @@ ...@@ -293,6 +301,15 @@
// }).onOk(() => { // }).onOk(() => {
// }); // });
}, },
//获取日志列表
getLogList(){
GetMsgLogList().then(res => {
if (res.Code == 1) {
console.log(res,'日志数据');
this.socektArr = res.Data;
}
})
},
//请求公告数据 //请求公告数据
getNotify() { getNotify() {
GetMyNoticePageList(this.noticeMsg).then(res => { GetMyNoticePageList(this.noticeMsg).then(res => {
...@@ -315,6 +332,96 @@ ...@@ -315,6 +332,96 @@
     query: {NoticeId:item.Id}      query: {NoticeId:item.Id}
   });    });
   window.open(routeUrl.href, '_blank');    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 @@ ...@@ -73,7 +73,7 @@
</div> </div>
</q-page-container> </q-page-container>
<user-info-box v-if="persistent" :show-obj="userInfo" @close="closeSaveForm"></user-info-box> <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> </q-layout>
</template> </template>
...@@ -112,7 +112,6 @@ ...@@ -112,7 +112,6 @@
isExpend: false, isExpend: false,
IsShowLeft: true, IsShowLeft: true,
userCenterMenuList: [], //用户中心菜单 userCenterMenuList: [], //用户中心菜单
socketMsg:[]
} }
}, },
components: { components: {
...@@ -171,79 +170,8 @@ ...@@ -171,79 +170,8 @@
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() {
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() { changeLeft() {
this.IsShowLeft = !this.IsShowLeft; this.IsShowLeft = !this.IsShowLeft;
}, },
......
...@@ -179,7 +179,7 @@ ...@@ -179,7 +179,7 @@
</div> </div>
</div> </div>
<div style="margin-top:30px;"> <div style="margin-top:30px;" v-if="isShowEdit">
<span class="beikeModule" @click="saveInfo(1)">存为模板</span> <span class="beikeModule" @click="saveInfo(1)">存为模板</span>
<q-btn label="提交" size="md" color="accent q-px-md" @click="saveInfo(0)" /> <q-btn label="提交" size="md" color="accent q-px-md" @click="saveInfo(0)" />
</div> </div>
...@@ -229,6 +229,8 @@ ...@@ -229,6 +229,8 @@
initialFrameHeight: 150, initialFrameHeight: 150,
}, },
IsShowLessForm: false, IsShowLessForm: false,
nowDate:'',
isShowEdit:false, //是否显示提交按钮
} }
}, },
created() {}, created() {},
...@@ -239,6 +241,15 @@ ...@@ -239,6 +241,15 @@
this.msg.ClassPlanId = this.$route.query.ClassPlanId; this.msg.ClassPlanId = this.$route.query.ClassPlanId;
} }
this.getList(); 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: { methods: {
getList() { getList() {
...@@ -263,6 +274,13 @@ ...@@ -263,6 +274,13 @@
} }
this.TeacherName = data.TeacherName; this.TeacherName = data.TeacherName;
this.WorkDate = data.WorkDate; 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 @@ ...@@ -160,8 +160,10 @@
<div class="text14-l">{{x.Duration}}分钟-{{x.DurationEndTime}}</div> <div class="text14-l">{{x.Duration}}分钟-{{x.DurationEndTime}}</div>
<div class="text14-o" v-html="x.ProjectContent"></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 <q-input
style="background:#F0F5FB ;font-size: 12px" style="background:#F0F5FB ;font-size: 12px"
v-model="x.Summary" v-model="x.Summary"
...@@ -381,8 +383,6 @@ ...@@ -381,8 +383,6 @@
}) })
}, },
saveOrderInfo(){ saveOrderInfo(){
// this.Dloading= true;
console.log(this.data,'data');
let count=0,LessonNum=0; let count=0,LessonNum=0;
this.data.LessonPlanList.forEach(x=>{ this.data.LessonPlanList.forEach(x=>{
x.LessonPlanDetailsList.forEach(y=>{ x.LessonPlanDetailsList.forEach(y=>{
...@@ -392,8 +392,6 @@ ...@@ -392,8 +392,6 @@
}) })
LessonNum+=x.LessonPlanDetailsList.length; LessonNum+=x.LessonPlanDetailsList.length;
}) })
console.log(count,'count');
console.log(LessonNum,'LessonNum');
if(count==LessonNum){ if(count==LessonNum){
this.$q.notify({ this.$q.notify({
type: 'negative', type: 'negative',
...@@ -404,7 +402,6 @@ ...@@ -404,7 +402,6 @@
return return
} }
updateClassLessPlan(this.data).then(res => { updateClassLessPlan(this.data).then(res => {
this.Dloading= false;
if (res.Code == 1) { if (res.Code == 1) {
this.$q.notify({ this.$q.notify({
icon: 'iconfont icon-chenggong', icon: 'iconfont icon-chenggong',
...@@ -413,6 +410,7 @@ ...@@ -413,6 +410,7 @@
message: res.Message, message: res.Message,
position: 'top' position: 'top'
}) })
this.getList();
} }
}) })
} }
......
...@@ -296,7 +296,7 @@ ...@@ -296,7 +296,7 @@
}, },
dataList: [], dataList: [],
newDataList:[], newDataList:[],
AccountType:true AccountType:true,
} }
}, },
created() {}, 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