view.jsp
4.08 KB
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
<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="com.engine.common.util.ServiceUtil"%>
<%@ page import="com.engine.mobilemode.service.impl.AppGlobalVarsServiceImpl"%>
<%@ page import="com.weaver.formmodel.apphtml.AppHtmlUtil"%>
<%@ page import="com.weaver.formmodel.mobile.types.ClientType"%>
<%@ page import="com.weaver.formmodel.mobile.ui.manager.MobileAppHomepageManager"%>
<%@ page import="com.weaver.formmodel.mobile.ui.manager.MobiledeviceManager"%>
<%@ page import="com.weaver.formmodel.mobile.ui.model.AppHomepage" %>
<%@ page import="com.weaver.formmodel.mobile.utils.MobileCommonUtil" %>
<%@ page import="com.weaver.formmodel.util.StringHelper" %>
<%@ page import="net.sf.json.JSONObject" %>
<%@ page import="com.engine.mobilemode.service.StaticResourceService" %>
<%@ page import="com.engine.mobilemode.service.impl.StaticResourceServiceImpl" %>
<%@ page import="net.sf.json.JSONArray" %>
<%@ include file="/mobilemode/mobile/base.jsp"%>
<%
int appid = Util.getIntValue(request.getParameter("appid"), -1);
int appHomepageId = Util.getIntValue(request.getParameter("appHomepageId"), -1);
if(appid <= 0){
if(appHomepageId <= 0){
out.println("没有明确指定应用或页面");
return;
}else{
ClientType clienttype = MobileCommonUtil.getClientType(request);
int mobiledeviceid = MobiledeviceManager.getInstance().getDeviceByClienttype(clienttype);
AppHomepage appHomepage = MobileAppHomepageManager.getInstance().getAppHomepage(appHomepageId, mobiledeviceid);
if(appHomepage == null || appHomepage.getId() == null){
out.println("指定的页面不存在");
return;
}
appid = appHomepage.getAppid();
}
}
String appLastModified = AppHtmlUtil.getAppLastModified(appid);
Map<String, Object> paramsMap = new HashMap<String, Object>();
paramsMap.put("appid", Integer.valueOf(appid));
AppGlobalVarsServiceImpl globalVarsService = ServiceUtil.getService(AppGlobalVarsServiceImpl.class, user);
JSONObject globalVars = new JSONObject();
List<Map<String, Object>> vars = globalVarsService.getAppGlobalVars(paramsMap);
for (Map<String, Object> v : vars) {
globalVars.put(StringHelper.null2String(v.get("name")), v.get("value"));
}
// 应用全局静态资源
StaticResourceService staticResourceService = ServiceUtil.getService(StaticResourceServiceImpl.class,user);
List<Map<String, Object>> resources = staticResourceService.getStaticResourceConfig(paramsMap);
JSONArray staticResources = new JSONArray();
for (Map<String, Object> g : resources) {
JSONObject resource = new JSONObject();
resource.put("type",g.get("type"));
resource.put("path",g.get("path"));
staticResources.add(resource);
}
long timestamp = System.currentTimeMillis();
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<meta name="format-detection" content="telephone=no,email=no">
<link rel="stylesheet" id='main-default_css' href="/mobilemode/mobile/dist/css/main-default.css?v=<%=timestamp%>">
<script type="text/javascript">
window.__meta__ = {
appid: "<%=appid%>",
appHomepageId: "<%=(appHomepageId <= 0) ? "" : appHomepageId%>",
resourceVersion: "<%=appLastModified%>",
pageParams: {},
user: <%=MobileCommonUtil.getUserMeta(user)%>,
wechatUser: {
openid: "#EB_USERKEY#",
nickname: "#EB_USERNAME#",
avatar: "#EB_USERAVATAR#"
},
globalVars: <%=globalVars%>,
staticResources: <%=staticResources%>
};
</script>
<script>
if (!window.Promise) {
document.writeln('<script src="/cloudstore/resource/mobile/es6-promise/es6-promise.min.js"><\/script>')
}
</script>
</head>
<body>
<script src="/mobilemode/mobile/dist/js/loader.js?v=<%=timestamp%>" type="text/javascript"></script>
<script type="text/javascript">
(function () {
Loader({
require: {
name: "require",
path: "/mobilemode/mobile/dist/js/lib/require/require.min_wev8.js?v=7eb8e3066f"
},
module: {
name: "main",
path: "/mobilemode/mobile/dist/js/main/main.js?v=<%=timestamp%>"
}
});
})();
</script>
</body>
</html>