Skip to content
This repository has been archived by the owner on Nov 4, 2019. It is now read-only.

Commit

Permalink
bug fix while saving today_list & calculate ,
Browse files Browse the repository at this point in the history
add notification when update,
add changelog link.
  • Loading branch information
eynol committed Mar 15, 2017
1 parent 0c58ba8 commit 961ee5d
Show file tree
Hide file tree
Showing 5 changed files with 186 additions and 165 deletions.
85 changes: 42 additions & 43 deletions public/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ Vue.component('content-setting', {
props: ['sid'],
data: function () {
return {
urlScreenShot :"http://pluscdn.heitaov.cn/Screenrecord-2017-03-12-23-30-39-643.mp4",
urlScreenShot: "http://pluscdn.heitaov.cn/Screenrecord-2017-03-12-23-30-39-643.mp4",
isLoading: false,
config: {
show: false,
Expand All @@ -253,7 +253,7 @@ Vue.component('content-setting', {
}
}
},

// watch:{ config:function(a,b){ console.log(a,b) } },
created: function () {
this
Expand Down Expand Up @@ -308,40 +308,45 @@ Vue.component('content-setting', {
};
},
initConfig: function () {
var mc = new MessageChannel();
var _this = this;
var mc = new MessageChannel();
navigator
.serviceWorker
.controller
.postMessage({
action: "getconfig"
}, [mc.port2]);
mc.port1.onmessage = function (e) {
var _timer = undefined;
_this.config = e.data;
console.log(e)
console.log("recive data")
_this.$watch('config', function (_new, _old) {
//if the input is "" string, let it be 0 at nextTick;
if (_new.first == ""|| _new.first <0) {
_new.first = 0;
}
if (_new.second == ""||_new.second <0) {
_new.second = 0;
}
if (_new.third == ""||_new.third <0) {
_new.third = 0;
}

if (_timer) {
clearTimeout(_timer);
}
_timer = setTimeout(function () {
_this.saveConfig();
clearTimeout(_timer);
}, 1500);
}, {deep: true})
};
.ready
.then(function () {
navigator
.serviceWorker
.controller
.postMessage({
action: "getconfig"
}, [mc.port2]);
mc.port1.onmessage = function (e) {
var _timer = undefined;
_this.config = e.data;
console.log(e)
console.log("recive data")
_this.$watch('config', function (_new, _old) {
//if the input is "" string, let it be 0 at nextTick;
if (_new.first == "" || _new.first < 0) {
_new.first = 0;
}
if (_new.second == "" || _new.second < 0) {
_new.second = 0;
}
if (_new.third == "" || _new.third < 0) {
_new.third = 0;
}

if (_timer) {
clearTimeout(_timer);
}
_timer = setTimeout(function () {
_this.saveConfig();
clearTimeout(_timer);
}, 1500);
}, {deep: true})
};
})
},
saveConfig: function () {
var mc = new MessageChannel();
Expand Down Expand Up @@ -530,17 +535,11 @@ if ('serviceWorker' in navigator) {
.serviceWorker
.ready
.then(function (registration) {
// console.log(registration) console.log(navigator.serviceWorker)
// registration.active.onmessage = function (e) { console.log("OnMessage")
// console.log(e.data) } Notification .requestPermission() .then(function
// (result) { console.log(result); })
// registration.showNotification("3302", { body: "软件工程导论 张西华,\n hell", data:
// "nice work", tag: "yes", icon: './cykb192.png', vibrate: [ 200,
// 100, 200, 100, 200, 100, 200 ], actions: [ {
// action: "dismiss", title: "知道了" }, { action: "arived", title:
// "我到教室了" } ] })
// var publicChanel = new MessageChannel(); publicChanel .port1
// .addEventListener('message', function (e) { console.log(e); })
// registration .active .postMessage({ action: 'activate-publicChanel'
// }, [publicChanel.port2])

})

}

2 changes: 1 addition & 1 deletion public/js/index.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions public/js/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function getListById(sid, callback, option) {
xhr.open('get', './api/kebiao/stu/' + sid + '?t=' + Date.now() + (option.root
? '#ROOTUSER'
: ''));
console.log(option)

xhr.responseType = 'json';
if (option.root) {
xhr.setRequestHeader('X-ROOTUSER', 'ROOT')
Expand All @@ -139,7 +139,7 @@ function getListById(sid, callback, option) {
callback(null, xhr.response)
}
xhr.onerror = function (e) {
console.log(e)

alert("发送失败!")
callback(e);
}
Expand Down
Loading

0 comments on commit 961ee5d

Please sign in to comment.