App-Android(使用App+htnl5框架,解决消息推送兼容SignalR问题)
loulijun2021
2022-09-21 32383daed1b498577da8c37145e66e2a93e28b2d
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
<!DOCTYPE HTML>
<html>
    <head>
        <meta charset="utf-8"/>
        <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
        <meta name="HandheldFriendly" content="true"/>
        <meta name="MobileOptimized" content="320"/>
        <title>Uploaded Data & File</title>
        <script type="text/javascript">
// H5 plus事件处理
var ret=null;
function plusReady(){
    ret=plus.storage.getItem('uploader');
    update();
    // 添加删除按钮
    plus.webview.currentWebview().setStyle({titleNView: {
        buttons:[{
            fontSrc: '_www/helloh5.ttf',
            text: '\ue444',
            fontSize: '22px',
            onclick: 'javascript:deleteFiles()'
        }]
    }});
}
if(window.plus){
    plusReady();
}else{
    document.addEventListener('plusready', plusReady, false);
}
// DOM事件
var ce=null;
document.addEventListener('DOMContentLoaded', function(){
    ce=document.getElementById('dcontent');
    update();
}, false);
// 更新内容
var fs=null;
function update(){
    if(!ret||!ce)return;
    var j=JSON.parse(ret);
    var ih='<br/>Datas:<br/><div style="text-align:left;padding:10px 2%;">';
    var ds=j.strings;
    for(d in ds){
        ih += d+' : '+ds[d]+'<br/>';
    }
    ih+='</div><hr/>Files:<br/><div id="fl">';
    fs=j.files;
    for(f in fs){
        ih += '<a class="fitem" onclick="plus.runtime.openURL(\'http://demo.dcloud.net.cn/helloh5/uploader/'+fs[f].url+'\')">'+fs[f].name+'</a>';
    }
    ih+='</div>';
    ce.innerHTML=ih;
}
// 清除上传返回的数据
function resetUploader(){
    plus.storage.setItem('uploader', '');
}
// 删除上传的文件
function deleteFiles(){
    var url='http://demo.dcloud.net.cn/helloh5/uploader/delete.php?';
    for(f in fs){
        url += f+'='+fs[f].name+'&';
    }
    var r=new plus.net.XMLHttpRequest();
    r.open('GET', url);
    r.send();
    document.getElementById('fl').innerHTML='';
}
        </script>
        <script type="text/javascript" src="../js/common.js"></script>
        <style type="text/css">
.fitem {
    width: 96%;
    overflow: hidden;
    padding: 10px 2%;
    border-bottom: 1px solid #c6c6c6;
    color: #6c6c6c;
    text-align: left;
    text-decoration: none;
    display: block;
}
.fitem:active {
    background: #f4f4f4;
}
.fname {
    font-weight: bolder;
    height: 22px;
    font-size: 16px;
}
        </style>
        <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8"/>
    </head>
    <body>
        <div id="dcontent">
        </div>
    </body>
</html>