推送修改
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
* yinjihuan
|
* yinjihuan
|
||||||
*/
|
*/
|
||||||
document.addEventListener("plusready", function() {
|
document.addEventListener("plusready", function() {
|
||||||
message = document.getElementById("message");
|
|
||||||
// 监听点击消息事件
|
// 监听点击消息事件
|
||||||
plus.push.addEventListener("click", function(msg) {
|
plus.push.addEventListener("click", function(msg) {
|
||||||
// 判断是从本地创建还是离线推送的消息
|
// 判断是从本地创建还是离线推送的消息
|
||||||
@@ -16,13 +15,35 @@ document.addEventListener("plusready", function() {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (plus.os.name == "Android"){
|
if (plus.os.name == "Android"){
|
||||||
payload = JSON.parse(payload);
|
try {
|
||||||
|
payload = JSON.parse(payload);
|
||||||
|
} catch(err) {
|
||||||
|
|
||||||
|
}
|
||||||
if (payload.type == "0") {
|
if (payload.type == "0") {
|
||||||
plus.ui.alert(title+"\n"+content);
|
plus.ui.alert(title+"\n"+content);
|
||||||
} else if (payload.type == "1") {
|
} else if (payload.type == "1") {
|
||||||
plus.ui.alert(title+"\n"+content,function(){
|
plus.ui.alert(title+"\n"+content,function(){
|
||||||
window.location.href = payload.url;
|
if (payload.url == '/house/index') {
|
||||||
});
|
plus.webview.show('yfindex.html');
|
||||||
|
} else {
|
||||||
|
plus.webview.show(BASE_PATH + payload.url);
|
||||||
|
}
|
||||||
|
//切换选项卡高亮
|
||||||
|
var defaultTab = document.getElementById("defaultTab");
|
||||||
|
var quotations = document.getElementById("quotations");
|
||||||
|
var selfInfo = document.getElementById("selfInfo");
|
||||||
|
defaultTab.classList.remove("mui-active");
|
||||||
|
quotations.classList.remove("mui-active");
|
||||||
|
selfInfo.classList.remove("mui-active");
|
||||||
|
if (payload.url == '/quotations/index') {
|
||||||
|
quotations.classList.add("mui-active");
|
||||||
|
} else if(payload.url == '/selfInfo/index') {
|
||||||
|
selfInfo.classList.add("mui-active");
|
||||||
|
} else {
|
||||||
|
defaultTab.classList.add("mui-active");
|
||||||
|
}
|
||||||
|
});
|
||||||
} else if (payload.type == "2") {
|
} else if (payload.type == "2") {
|
||||||
plus.ui.alert(title+"\n"+content,function(){
|
plus.ui.alert(title+"\n"+content,function(){
|
||||||
openUrl(BASE_PATH+'/message/openView?url='+payload.url);
|
openUrl(BASE_PATH+'/message/openView?url='+payload.url);
|
||||||
@@ -33,11 +54,29 @@ document.addEventListener("plusready", function() {
|
|||||||
plus.ui.alert(content);
|
plus.ui.alert(content);
|
||||||
} else if (payload.type == "1") {
|
} else if (payload.type == "1") {
|
||||||
plus.ui.alert(content,function(){
|
plus.ui.alert(content,function(){
|
||||||
window.location.href = payload.url;
|
if (payload.url == '/house/index') {
|
||||||
});
|
plus.webview.show('yfindex.html');
|
||||||
|
} else {
|
||||||
|
plus.webview.show(BASE_PATH + payload.url);
|
||||||
|
}
|
||||||
|
//切换选项卡高亮
|
||||||
|
var defaultTab = document.getElementById("defaultTab");
|
||||||
|
var quotations = document.getElementById("quotations");
|
||||||
|
var selfInfo = document.getElementById("selfInfo");
|
||||||
|
defaultTab.classList.remove("mui-active");
|
||||||
|
quotations.classList.remove("mui-active");
|
||||||
|
selfInfo.classList.remove("mui-active");
|
||||||
|
if (payload.url == '/quotations/index') {
|
||||||
|
quotations.classList.add("mui-active");
|
||||||
|
} else if(payload.url == '/selfInfo/index') {
|
||||||
|
selfInfo.classList.add("mui-active");
|
||||||
|
} else {
|
||||||
|
defaultTab.classList.add("mui-active");
|
||||||
|
}
|
||||||
|
});
|
||||||
} else if (payload.type == "2") {
|
} else if (payload.type == "2") {
|
||||||
plus.ui.alert(content,function(){
|
plus.ui.alert(content,function(){
|
||||||
openUrl(basePath+'/message/openView?url='+payload.url);
|
openUrl(BASE_PATH+'/message/openView?url='+payload.url);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -55,7 +94,26 @@ document.addEventListener("plusready", function() {
|
|||||||
plus.ui.alert(title+"\n"+content);
|
plus.ui.alert(title+"\n"+content);
|
||||||
} else if (payload.type == "1") {
|
} else if (payload.type == "1") {
|
||||||
plus.ui.alert(title+"\n"+content,function(){
|
plus.ui.alert(title+"\n"+content,function(){
|
||||||
window.location.href = payload.url;
|
if (payload.url == '/house/index') {
|
||||||
|
plus.webview.show('yfindex.html');
|
||||||
|
} else {
|
||||||
|
plus.webview.show(BASE_PATH + payload.url);
|
||||||
|
}
|
||||||
|
|
||||||
|
//切换选项卡高亮
|
||||||
|
var defaultTab = document.getElementById("defaultTab");
|
||||||
|
var quotations = document.getElementById("quotations");
|
||||||
|
var selfInfo = document.getElementById("selfInfo");
|
||||||
|
defaultTab.classList.remove("mui-active");
|
||||||
|
quotations.classList.remove("mui-active");
|
||||||
|
selfInfo.classList.remove("mui-active");
|
||||||
|
if (payload.url == '/quotations/index') {
|
||||||
|
quotations.classList.add("mui-active");
|
||||||
|
} else if(payload.url == '/selfInfo/index') {
|
||||||
|
selfInfo.classList.add("mui-active");
|
||||||
|
} else {
|
||||||
|
defaultTab.classList.add("mui-active");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else if (payload.type == "2") {
|
} else if (payload.type == "2") {
|
||||||
plus.ui.alert(title+"\n"+content,function(){
|
plus.ui.alert(title+"\n"+content,function(){
|
||||||
@@ -64,3 +122,7 @@ document.addEventListener("plusready", function() {
|
|||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
|
function openUrl(url){
|
||||||
|
clicked(url,true);
|
||||||
|
}
|
||||||
@@ -29,7 +29,8 @@
|
|||||||
</nav>
|
</nav>
|
||||||
<script src="js/mui.min.js"></script>
|
<script src="js/mui.min.js"></script>
|
||||||
<script src="config.js"></script>
|
<script src="config.js"></script>
|
||||||
<script src="js/push-common.js"></script>
|
<script src="js/common.js"></script>
|
||||||
|
<script src="js/push-common.js"></script>
|
||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
document.getElementById("quotations").setAttribute("href", BASE_PATH + '/quotations/index');
|
document.getElementById("quotations").setAttribute("href", BASE_PATH + '/quotations/index');
|
||||||
document.getElementById("selfInfo").setAttribute("href", BASE_PATH + '/selfInfo/index');
|
document.getElementById("selfInfo").setAttribute("href", BASE_PATH + '/selfInfo/index');
|
||||||
|
|||||||
Reference in New Issue
Block a user