forked from Cyril5169/yulan-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
133 lines (124 loc) · 5.1 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<!-- css,图片等文件尽量放在static文件夹下面,路径编译不会出错 -->
<link rel="icon" type="image/x-icon" href="./static/base/img/headerLogo.jpg" />
<link rel="stylesheet" href="./static/base/css/swiper.css">
<title>玉兰B2BAPP</title>
<style>
html,
body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
img {
content: normal !important;
}
</style>
</head>
<body>
<div id="app"></div>
<script>
//导航栏图标颜色 #89CB81
var vm, app, notificationlist,
page_customer,//主页
page_myPersonal,//个人中心
page_shoppingcart//购物车
;
var urlArr = {
local: {
baseUrl: 'http://localhost:49438/',
//orderBaseUrl: "http://120.79.140.75:567/yulan-order",//java后台测试
orderBaseUrl: "http://14.29.223.114:10250/yulan-order",//java后台正式
fileCenterUrl: "http://47.107.56.156:1001/",//下载中心
describe: "本地调试"//在我的->检查新版本处显示
},
test: {
baseUrl: 'http://47.107.56.156:568/',
orderBaseUrl: "http://120.79.140.75:567/yulan-order",
fileCenterUrl: "http://47.107.56.156:1001/",//下载中心
describe: "测试服务器"//在我的->检查新版本处显示
},
formal: {
baseUrl: 'http://14.29.223.114:568/',
orderBaseUrl: "http://14.29.223.114:10250/yulan-order",
fileCenterUrl: "http://61.145.202.7:1001/",
describe: ""
}
}
//var urlSetting = urlArr.local;//本地
//var urlSetting = urlArr.test;//测试
var urlSetting = urlArr.formal;//正式
var baseUrl = urlSetting.baseUrl;
var orderBaseUrl = urlSetting.orderBaseUrl;
var fileCenterUrl = urlSetting.fileCenterUrl;
var updateUrl = baseUrl + "app/version.json";
document.addEventListener("plusready", function (a) {
window.plus = plus;
//处理点击推送消息
function handlerPushMsg(payload) {
console.log(payload.msg_type);
console.log(payload.bill_id);
//公告提醒
if (payload.msg_type == "notification") {
vm.showPushNotification(payload.bill_id);
} else if (payload.msg_type == "customer_balance_period") {//对账单提醒
vm.showPush_customer_balance_period();
} else if (payload.msg_type == "order") {
}
var loginname = app.$store.getters.getCId;
var cid = plus.push.getClientInfo().clientid;
console.log(loginname);
console.log(cid);
//更新响应的时间
vm.UpdatePushResponseTime(loginname, cid, payload.bill_id, payload.msg_type, "all");
}
//创建本地消息
function createLocalPushMsg(message, payload) {
var options = { cover: true };
plus.push.createMessage(message, payload, options);
if (plus.os.name == "iOS") {
console.log('*如果无法创建消息,请到"设置"->"通知"中配置应用在通知中心显示!');
}
}
//获取推送通知,IOS收到消息后,创建本地消息覆盖本来的消息,因为本来的消息内容是显示content中的内容,与安卓不同
plus.push.addEventListener(
"receive",
function (msg) {
console.log("接收到的透传推送 " + JSON.stringify(msg));
var content = JSON.parse(msg.content);
console.log(plus.os.name);
if (plus.os.name == "iOS") {
if (msg.payload.LocalMSG) {
handlerPushMsg(content);
} else {
//生成本地推送消息
content.LocalMSG = true;
createLocalPushMsg(content.message, JSON.stringify(content));
}
} else {
console.log(JSON.stringify(content));
handlerPushMsg(content);
}
},
false
);
//点击推送进来
plus.push.addEventListener(
"click",
function (msg) {
// 判断是从本地创建还是离线推送的消息
console.log("点击处理消息 " + JSON.stringify(msg));
},
false
);
}, false);
</script>
</body>
</html>