App-Android(使用App+htnl5框架,解决消息推送兼容SignalR问题)
loulijun2021
2022-10-22 40711118c33369ccad7ceda0fdd729bd9f117f65
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
134
135
136
<!DOCTYPE HTML>
<html>
    <head>
        <meta charset="utf-8"/>
        <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"/>
        <meta name="HandheldFriendly" content="true"/>
        <meta name="MobileOptimized" content="320"/>
        <title>titleNView</title>
        <script type="text/javascript" src="../js/common.js"></script>
        <script type="text/javascript">
var ws = null;
// H5 plus事件处理
function plusReady(){
    ws = plus.webview.currentWebview();
}
document.addEventListener('plusready', plusReady, false);
 
var bAlign = false;
function switchTitleAlign(){
  ws.setStyle({
    titleNView: {
      titleAlign: bAlign?'left':'center'
    }
  });
  bAlign = !bAlign;
}
 
function setBackgroundImage(){
  ws.setStyle({
    titleNView: {
      backgroundImage: '../img/ui.png'
    }
  });
}
function setBackgroundGradient(){
  ws.setStyle({
    titleNView: {
      backgroundImage: 'linear-gradient(to top, #a80077, #66ff00)'
    }
  });
}
 
function setRedDot(){
  ws.setStyle({
    titleNView:{
      redDotColor: '#00FF00',
      backButton: {
        redDot: true
      }
    }
  })
}
function hideRedDot(){
  ws.setStyle({
    titleNView: {
      backButton: {
        redDot: false
      }
    }
  });
}
 
function setBadge(){
  ws.setStyle({
    titleNView: {
      backButton: {
        badgeText: '8',
        badgeBackground: '#CCCCCC',
        badgeColor: '#FF0000',
        title: ''
      }
    }
  });
}
function removeBadge(){
  ws.setStyle({
    titleNView: {
      backButton: {
        badgeText: ''
      }
    }
  });
}
 
function multiTitle(){
  ws.setStyle({
    titleNView: {
      titleText: '新标题文本内容',
      subtitleText: '副标题文本内容'
    }
  });
}
function singleTitle(){
  ws.setStyle({
    titleNView: {
      subtitleText: ''
    }
  });
}
 
function setIcon(){
  ws.setStyle({
    titleNView: {
      titleIcon: '../img/ui.png',
      titleIconRadius: '5px',
    }
  });
}
function removeIcon(){
  ws.setStyle({
    titleNView: {
      titleIcon: '',
      titleIconRadius: '',
    }
  });
}
        </script>
        <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8"/>
    </head>
    <body>
    <br/><br/>
    <span class="des">此页面演示自定义返回按钮、标题栏对其方式、标题栏背景图等功能</span>
        <br/><br/>
        <div class="button" onclick="switchTitleAlign()">切换标题对齐方式</div>
        <div class="button" onclick="setBackgroundImage()">设置背景图片</div>
        <div class="button" onclick="setBackgroundGradient()">设置背景渐变色</div>
        <div class="button" onclick="setBadge()">设置返回按钮角标</div>
        <div class="button" onclick="removeBadge()">移除返回按钮角标</div>
        <div class="button" onclick="multiTitle()">多行标题</div>
        <div class="button" onclick="singleTitle()">单行标题</div>
        <div class="button" onclick="setIcon()">显示标题图标</div>
        <div class="button" onclick="removeIcon()">隐藏标题图标</div>
        <br/>
        <div style="width:100%;height:1000px"></div>
    </body>
</html>