-
Notifications
You must be signed in to change notification settings - Fork 0
/
setting.html
998 lines (952 loc) · 32 KB
/
setting.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hello MUI</title>
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="stylesheet" href="css/mui.css">
<style>
html,
body {
background-color: #efeff4;
}
.mui-views,
.mui-view,
.mui-pages,
.mui-page,
.mui-page-content {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
width: 100%;
height: 100%;
background-color: #efeff4;
}
.mui-pages {
top: 46px;
height: auto;
}
.mui-scroll-wrapper,
.mui-scroll {
background-color: #efeff4;
}
.mui-page.mui-transitioning {
-webkit-transition: -webkit-transform 300ms ease;
transition: transform 300ms ease;
}
.mui-page-left {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
.mui-ios .mui-page-left {
-webkit-transform: translate3d(-20%, 0, 0);
transform: translate3d(-20%, 0, 0);
}
.mui-navbar {
position: fixed;
right: 0;
left: 0;
z-index: 10;
height: 44px;
background-color: #f7f7f8;
}
.mui-navbar .mui-bar {
position: absolute;
background: transparent;
text-align: center;
}
.mui-android .mui-navbar-inner.mui-navbar-left {
opacity: 0;
}
.mui-ios .mui-navbar-left .mui-left,
.mui-ios .mui-navbar-left .mui-center,
.mui-ios .mui-navbar-left .mui-right {
opacity: 0;
}
.mui-navbar .mui-btn-nav {
-webkit-transition: none;
transition: none;
-webkit-transition-duration: .0s;
transition-duration: .0s;
}
.mui-navbar .mui-bar .mui-title {
display: inline-block;
width: auto;
}
.mui-page-shadow {
position: absolute;
right: 100%;
top: 0;
width: 16px;
height: 100%;
z-index: -1;
content: '';
}
.mui-page-shadow {
background: -webkit-linear-gradient(left, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 10%, rgba(0, 0, 0, .01) 50%, rgba(0, 0, 0, .2) 100%);
background: linear-gradient(to right, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 10%, rgba(0, 0, 0, .01) 50%, rgba(0, 0, 0, .2) 100%);
}
.mui-navbar-inner.mui-transitioning,
.mui-navbar-inner .mui-transitioning {
-webkit-transition: opacity 300ms ease, -webkit-transform 300ms ease;
transition: opacity 300ms ease, transform 300ms ease;
}
.mui-page {
display: none;
}
.mui-pages .mui-page {
display: block;
}
.mui-page .mui-table-view:first-child {
margin-top: 15px;
}
.mui-page .mui-table-view:last-child {
margin-bottom: 30px;
}
.mui-table-view {
margin-top: 20px;
}
.mui-table-view span.mui-pull-right {
color: #999;
}
.mui-table-view-divider {
background-color: #efeff4;
font-size: 14px;
}
.mui-table-view-divider:before,
.mui-table-view-divider:after {
height: 0;
}
.head {
height: 40px;
}
#head {
line-height: 40px;
}
.head-img {
width: 40px;
height: 40px;
}
#head-img1 {
position: absolute;
bottom: 10px;
right: 40px;
width: 40px;
height: 40px;
}
.update {
font-style: normal;
color: #999999;
margin-right: -25px;
font-size: 15px
}
.mui-fullscreen {
position: fixed;
z-index: 20;
background-color: #000;
}
.mui-ios .mui-navbar .mui-bar .mui-title {
position: static;
}
</style>
<link rel="stylesheet" type="text/css" href="css/feedback-page.css" />
</head>
<body class="mui-fullscreen">
<!--页面主结构开始-->
<div id="app" class="mui-views">
<div class="mui-view">
<div class="mui-navbar">
</div>
<div class="mui-pages">
</div>
</div>
</div>
<!--页面主结构结束-->
<!--单页面开始-->
<div id="setting" class="mui-page">
<!--页面标题栏开始-->
<div class="mui-navbar-inner mui-bar mui-bar-nav">
<button type="button" class="mui-left mui-action-back mui-btn mui-btn-link mui-btn-nav mui-pull-left">
<span class="mui-icon mui-icon-left-nav"></span>
</button>
<h1 class="mui-center mui-title">设置</h1>
</div>
<!--页面标题栏结束-->
<!--页面主内容区开始-->
<div class="mui-page-content">
<div class="mui-scroll-wrapper">
<div class="mui-scroll">
<ul class="mui-table-view mui-table-view-chevron">
<li class="mui-table-view-cell mui-media">
<a class="mui-navigate-right" href="#account">
<img class="mui-media-object mui-pull-left head-img" id="head-img" src="image/Mn3.png">
<div class="mui-media-body">
Hello MatrixNum
<p class='mui-ellipsis'>暂不支持注册功能</p>
</div>
</a>
</li>
</ul>
<ul class="mui-table-view mui-table-view-chevron">
<li class="mui-table-view-cell">
<a href="#account" class="mui-navigate-right">账号与安全</a>
</li>
</ul>
<ul class="mui-table-view mui-table-view-chevron">
<div class="mui-input-row">
<label>数字精度</label>
<div class="mui-numbox" data-numbox-min='3' data-numbox-max='10'>
<button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
<input id="preciseInput" class="mui-input-numbox" type="number" value="5" readonly="readonly" onchange="updateConfigPrecise()"/>
<button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
</div>
</div>
<div class="mui-input-row">
<label>随机最小值</label>
<div class="mui-numbox" style="width:150px !important;" data-numbox-min='-1000' data-numbox-max='1000'>
<button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
<input id="randMinInput" class="mui-input-numbox" type="number" value="5" onchange="updateConfigRandMin()"/>
<button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
</div>
</div>
<div class="mui-input-row">
<label>随机最大值</label>
<div class="mui-numbox" style="width:150px !important;" data-numbox-min='-1000' data-numbox-max='1000'>
<button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
<input id="randMaxInput" class="mui-input-numbox" type="number" value="5" onchange="updateConfigRandMax()"/>
<button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
</div>
</div>
<p>
<button type="button" class="mui-btn mui-btn-block" onclick="openDefaultMatrix()">清空矩阵列表</button>
</p>
<p>
<button type="button" class="mui-btn mui-btn-block" onclick="openDefaultSetting()">恢复默认设置</button>
</p>
</ul>
<ul class="mui-table-view mui-table-view-chevron">
<li class="mui-table-view-cell">
<a href="#notifications" class="mui-navigate-right">新消息通知</a>
</li>
<li class="mui-table-view-cell">
<a href="#privacy" class="mui-navigate-right">隐私</a>
</li>
<li class="mui-table-view-cell">
<a href="#general" class="mui-navigate-right">通用</a>
</li>
</ul>
<ul class="mui-table-view mui-table-view-chevron">
<li class="mui-table-view-cell">
<a href="#about" class="mui-navigate-right">关于MatrixNum <i class="mui-pull-right update">V0.1.0</i></a>
</li>
</ul>
<ul class="mui-table-view">
<li class="mui-table-view-cell" style="text-align: center;" id="exitBtn">
<a>退出登录</a>
</li>
</ul>
</div>
</div>
</div>
<!--页面主内容区结束-->
</div>
<!--单页面结束-->
<div id="account" class="mui-page">
<div class="mui-navbar-inner mui-bar mui-bar-nav">
<button type="button" class="mui-left mui-action-back mui-btn mui-btn-link mui-btn-nav mui-pull-left">
<span class="mui-icon mui-icon-left-nav"></span>设置
</button>
<h1 class="mui-center mui-title">账号与安全</h1>
</div>
<div class="mui-page-content">
<div class="mui-scroll-wrapper">
<div class="mui-scroll">
<ul class="mui-table-view">
<li class="mui-table-view-cell">
<a id="head" class="mui-navigate-right">头像
<span class="mui-pull-right head">
<img class="head-img mui-action-preview" id="head-img1" src=""/>
</span>
</a>
</li>
<li class="mui-table-view-cell">
<a>姓名<span class="mui-pull-right">Hbuilder</span></a>
</li>
<li class="mui-table-view-cell">
<a>HBuilder账号<span class="mui-pull-right">[email protected]</span></a>
</li>
</ul>
<ul class="mui-table-view">
<li class="mui-table-view-cell">
<a>QQ号<span class="mui-pull-right">88888888</span></a>
</li>
<li class="mui-table-view-cell">
<a>手机号<span class="mui-pull-right">18688888888</span></a>
</li>
<li class="mui-table-view-cell">
<a>邮箱地址<span class="mui-pull-right">[email protected]</span></a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div id="notifications" class="mui-page">
<div class="mui-navbar-inner mui-bar mui-bar-nav">
<button type="button" class="mui-left mui-action-back mui-btn mui-btn-link mui-btn-nav mui-pull-left">
<span class="mui-icon mui-icon-left-nav"></span>设置
</button>
<h1 class="mui-center mui-title">新消息通知</h1>
</div>
<div class="mui-page-content">
<div class="mui-scroll-wrapper">
<div class="mui-scroll">
<ul class="mui-table-view">
<li class="mui-table-view-cell">
<a>接收新消息通知<span class="mui-pull-right">已开启</span></a>
</li>
</ul>
<ul class="mui-table-view">
<li class="mui-table-view-cell">
通知显示消息详情
<div class="mui-switch mui-active mui-switch-mini">
<div class="mui-switch-handle"></div>
</div>
</li>
</ul>
<div class="mui-content-padded">
<p>若关闭,当收到新消息时,通知提示将不显示发信人和内容摘要</p>
</div>
<ul class="mui-table-view mui-table-view-chevron">
<li class="mui-table-view-cell">
<a href="#notifications_disturb" class="mui-navigate-right">功能消息免打扰</a>
</li>
</ul>
<div class="mui-content-padded">
<p>设置系统功能消息提示声音和震动的时段</p>
</div>
<ul class="mui-table-view">
<li class="mui-table-view-cell">
<a>接收新消息通知<span class="mui-pull-right">已开启</span></a>
</li>
</ul>
<ul class="mui-table-view">
<li class="mui-table-view-cell">
声音
<div class="mui-switch mui-active mui-switch-mini">
<div class="mui-switch-handle"></div>
</div>
</li>
<li class="mui-table-view-cell">
震动
<div class="mui-switch mui-active mui-switch-mini">
<div class="mui-switch-handle"></div>
</div>
</li>
</ul>
<div class="mui-content-padded">
<p>当HelloMUI在运行时,你可以设置是否需要声音或者震动</p>
</div>
<div></div>
</div>
</div>
</div>
</div>
<div id="notifications_disturb" class="mui-page">
<div class="mui-navbar-inner mui-bar mui-bar-nav">
<button type="button" class="mui-left mui-action-back mui-btn mui-btn-link mui-btn-nav mui-pull-left">
<span class="mui-icon mui-icon-left-nav"></span>新消息通知
</button>
<h1 class="mui-center mui-title">功能消息免打扰</h1>
</div>
<div class="mui-page-content">
<div class="mui-scroll-wrapper">
<div class="mui-scroll">
<ul class="mui-table-view mui-table-view-radio">
<li class="mui-table-view-cell">
<a class="mui-navigate-right">开启</a>
</li>
<li class="mui-table-view-cell">
<a class="mui-navigate-right">只在夜间开启</a>
</li>
<li class="mui-table-view-cell">
<a class="mui-navigate-right">关闭</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div id="privacy" class="mui-page">
<div class="mui-navbar-inner mui-bar mui-bar-nav">
<button type="button" class="mui-left mui-action-back mui-btn mui-btn-link mui-btn-nav mui-pull-left">
<span class="mui-icon mui-icon-left-nav"></span>设置
</button>
<h1 class="mui-center mui-title">隐私</h1>
</div>
<div class="mui-page-content">
<div class="mui-scroll-wrapper">
<div class="mui-scroll">
<ul class="mui-table-view">
<li class="mui-table-view-divider">通讯录</li>
<li class="mui-table-view-cell">
加我为朋友时需要验证
<div class="mui-switch mui-active mui-switch-mini">
<div class="mui-switch-handle"></div>
</div>
</li>
</ul>
<ul class="mui-table-view">
<li class="mui-table-view-cell">
向我推荐QQ好友
<div class="mui-switch mui-switch-mini">
<div class="mui-switch-handle"></div>
</div>
</li>
<li class="mui-table-view-cell">
通过QQ号搜索到我
<div class="mui-switch mui-switch-mini">
<div class="mui-switch-handle"></div>
</div>
</li>
</ul>
<ul class="mui-table-view">
<li class="mui-table-view-cell">
可通过手机号搜索到我
<div class="mui-switch mui-active mui-switch-mini">
<div class="mui-switch-handle"></div>
</div>
</li>
<li class="mui-table-view-cell">
向我推荐通讯录朋友
<div class="mui-switch mui-switch-mini">
<div class="mui-switch-handle"></div>
</div>
</li>
<li class="mui-table-view-divider">开启后,为你推荐已经开通HBuilder的手机联系人</li>
</ul>
<ul class="mui-table-view">
<li class="mui-table-view-cell">
通过HBuilder账号搜索到我
<div class="mui-switch mui-active mui-switch-mini">
<div class="mui-switch-handle"></div>
</div>
</li>
<li class="mui-table-view-divider">关闭后,其他用户将不能通过HBuilder号搜索到你</li>
</ul>
</div>
</div>
</div>
</div>
<div id="general" class="mui-page">
<div class="mui-navbar-inner mui-bar mui-bar-nav">
<button type="button" class="mui-left mui-action-back mui-btn mui-btn-link mui-btn-nav mui-pull-left">
<span class="mui-icon mui-icon-left-nav"></span>设置
</button>
<h1 class="mui-center mui-title">通用</h1>
</div>
<div class="mui-page-content">
<div class="mui-scroll-wrapper">
<div class="mui-scroll">
<ul class="mui-table-view">
<li class="mui-table-view-cell">
多语言
</li>
</ul>
<ul class="mui-table-view">
<li class="mui-table-view-cell">
听筒模式
<div class="mui-switch mui-switch-mini">
<div class="mui-switch-handle"></div>
</div>
</li>
</ul>
<ul class="mui-table-view">
<li class="mui-table-view-cell">
功能
</li>
</ul>
</div>
</div>
</div>
</div>
<div id="about" class="mui-page">
<div class="mui-navbar-inner mui-bar mui-bar-nav">
<button type="button" class="mui-left mui-action-back mui-btn mui-btn-link mui-btn-nav mui-pull-left">
<span class="mui-icon mui-icon-left-nav"></span>设置
</button>
<h1 class="mui-center mui-title">关于MUI</h1>
</div>
<div class="mui-page-content">
<div class="mui-scroll-wrapper">
<div class="mui-scroll">
<ul class="mui-table-view">
<li class="mui-table-view-cell mui-plus-visible">
<a id="rate" class="mui-navigate-right">评分鼓励</a>
</li>
<li class="mui-table-view-cell mui-plus-visible">
<a id="welcome" class="mui-navigate-right">欢迎页</a>
</li>
<li class="mui-table-view-cell mui-plus-visible">
<a id="share" class="mui-navigate-right">分享推荐</a>
</li>
<li class="mui-table-view-cell">
<a id="tel" class="mui-navigate-right">客服电话</a>
</li>
<li class="mui-table-view-cell">
<a id="feedback-btn" href="#feedback" class="mui-navigate-right">问题反馈</a>
</li>
<li id="check_update" class="mui-table-view-cell mui-plus-visible">
<a id="update" class="mui-navigate-right">检查更新</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div id="feedback" class="mui-page feedback">
<div class="mui-navbar-inner mui-bar mui-bar-nav">
<button type="button" class="mui-left mui-action-back mui-btn mui-btn-link mui-btn-nav mui-pull-left">
<span class="mui-icon mui-icon-left-nav"></span>关于MatrixNum
</button>
<h1 class="mui-center mui-title">问题反馈</h1>
</div>
<div class="mui-page-content">
<p>问题和意见</p>
<a href="mailto:[email protected]">点击发送邮件</a>
<!--<div class="row mui-input-row">
<textarea id='question' class="mui-input-clear question" placeholder="请详细描述你的问题和意见..."></textarea>
</div>
<p>图片(选填,提供问题截图)</p>
<div id='image-list' class="row image-list">
</div>
<p>QQ/邮箱</p>
<div class="mui-input-row">
<input id='contact' type="text" class="mui-input-clear contact" placeholder="(选填,方便我们联系你 )" />
</div>
<button id='submit' type="button" class="mui-btn mui-btn-green">提交</button>-->
</div>
<p>此示例基于环信 “WebIM SDK” + 环信 “移动客服” 实现,在环信 “移动客服面板” 能够查阅反馈信息。</p>
</div>
</body>
<script src="js/mui.js"></script>
<script src="js/mui.view.js"></script>
<script src='js/easymob-webim-sdk/jquery-1.11.1.js'></script>
<script src='js/easymob-webim-sdk/strophe-custom-2.0.0.js'></script>
<script src='js/easymob-webim-sdk/json2.js'></script>
<script src="js/easymob-webim-sdk/easemob.im-1.0.5.js"></script>
<script src='js/feedback.js'></script>
<script src="js/feedback-page.js"></script>
<script src="js/math.js"></script>
<script src="js/storage.js" type="text/javascript"></script>
<script>
mui.init();
//初始化单页view
var viewApi = mui('#app').view({
defaultPage: '#setting'
});
//初始化单页的区域滚动
mui('.mui-scroll-wrapper').scroll();
//分享操作
var shares = {};
function openDefaultMatrix()
{
var btnArray = ['取消', '确定'];
mui.confirm("确定要删除所有列表中的矩阵吗?此操作不可恢复。", '清空矩阵列表', btnArray, function(e) {
if (e.index == 1) {
defaultMatrics();
} else {
}
})
}
function openDefaultSetting()
{
var btnArray = ['取消', '确定'];
mui.confirm("确定要恢复默认设置吗?", '恢复默认设置', btnArray, function(e) {
if (e.index == 1) {
defaultSetting();
} else {
}
})
}
function initNumberInput()
{
var max=StorageDao.get(CONFIG_RAND_MAX);
var min=StorageDao.get(CONFIG_RAND_MIN);
var precise=StorageDao.get(CONFIG_PRECISION);
document.getElementById("preciseInput").value = precise;
document.getElementById("randMinInput").value = min;
document.getElementById("randMaxInput").value = max;
}
function updateConfigPrecise ()
{
var precise=parseInt(document.getElementById("preciseInput").value);
StorageDao.save(CONFIG_PRECISION,precise);
}
function updateConfigRandMin ()
{
var precise=parseInt(document.getElementById("preciseInput").value);
StorageDao.save(CONFIG_PRECISION,precise);
}
function updateConfigRandMax ()
{
var precise=parseInt(document.getElementById("preciseInput").value);
StorageDao.save(CONFIG_PRECISION,precise);
}
mui.plusReady(function() {
//首页返回键处理
//处理逻辑:1秒内,连续两次按返回键,则退出应用;
var first = null;
initNumberInput();
if(mui.os.ios)
{
document.getElementById("exitBtn").style.display="none";
}
document.getElementById("exitBtn").addEventListener('tap', function(){
//首次按键,提示‘再按一次退出应用’
if(!first){
first = new Date().getTime();
mui.toast('再按一次退出应用');
setTimeout(function(){
first = null;
},1000);
}else{
if(new Date().getTime()-first<1000){
plus.runtime.quit();
}
}
}, false);
plus.share.getServices(function(s) {
if (s && s.length > 0) {
for (var i = 0; i < s.length; i++) {
var t = s[i];
shares[t.id] = t;
}
}
}, function() {
console.log("获取分享服务列表失败");
});
});
setTimeout(function () {
defaultImg();
setTimeout(function() {
initImgPreview();
}, 300);
},500);
//分享链接点击事件
document.getElementById("share").addEventListener('tap', function() {
var ids = [{
id: "weixin",
ex: "WXSceneSession"
}, {
id: "weixin",
ex: "WXSceneTimeline"
}, {
id: "sinaweibo"
}, {
id: "tencentweibo"
}, {
id: "qq"
}],
bts = [{
title: "发送给微信好友"
}, {
title: "分享到微信朋友圈"
}, {
title: "分享到新浪微博"
}, {
title: "分享到腾讯微博"
}, {
title: "分享到QQ"
}];
plus.nativeUI.actionSheet({
cancel: "取消",
buttons: bts
}, function(e) {
var i = e.index;
if (i > 0) {
var s_id = ids[i - 1].id;
var share = shares[s_id];
if (share) {
if (share.authenticated) {
shareMessage(share, ids[i - 1].ex);
} else {
share.authorize(function() {
shareMessage(share, ids[i - 1].ex);
}, function(e) {
console.log("认证授权失败:" + e.code + " - " + e.message);
});
}
} else {
mui.toast("无法获取分享服务,请检查manifest.json中分享插件参数配置,并重新打包")
}
}
});
});
function shareMessage(share, ex) {
var msg = {
extra: {
scene: ex
}
};
msg.href = "http://www.dcloud.io/hellomui/";
msg.title = "最接近原生APP体验的高性能前端框架";
msg.content = "我正在体验HelloMUI,果然很流畅,基本看不出和原生App的差距";
if (~share.id.indexOf('weibo')) {
msg.content += ";体验地址:http://www.dcloud.io/hellomui/";
}
msg.thumbs = ["_www/images/logo.png"];
share.send(msg, function() {
console.log("分享到\"" + share.description + "\"成功! ");
}, function(e) {
console.log("分享到\"" + share.description + "\"失败: " + e.code + " - " + e.message);
});
}
//去评分
document.getElementById("rate").addEventListener('tap', function() {
if (mui.os.ios) {
location.href = 'https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=682211190&pageNumber=0&sortOrdering=2&type=&mt=8';
} else if (mui.os.android) {
plus.runtime.openURL("market://details?id=io.dcloud.HelloMUI", function(e) {
plus.runtime.openURL("market://details?id=io.dcloud.HelloMUI", function(e) {
mui.alert("360手机助手和应用宝,你一个都没装,暂时无法评分,感谢支持");
}, "com.qihoo.appstore");
}, "com.tencent.android.qqdownloader");
}
});
//客服电话
document.getElementById("tel").addEventListener('tap', function() {
if(mui.os.plus){
plus.device.dial("114");
}else{
location.href = 'tel:114';
}
});
// //意见反馈
// document.getElementById("quest").addEventListener('tap', function() {
//
// });
//
//检查更新
document.getElementById("update").addEventListener('tap', function() {
var server = "http://www.dcloud.io/check/update"; //获取升级描述文件服务器地址
mui.getJSON(server, {
"appid": plus.runtime.appid,
"version": plus.runtime.version,
"imei": plus.device.imei
}, function(data) {
if (data.status) {
plus.ui.confirm(data.note, function(i) {
if (0 == i) {
plus.runtime.openURL(data.url);
}
}, data.title, ["立即更新", "取 消"]);
} else {
mui.toast('MatrixNum 已是最新版本~')
}
});
});
var view = viewApi.view;
(function($) {
//处理view的后退与webview后退
var oldBack = $.back;
$.back = function() {
if (viewApi.canBack()) { //如果view可以后退,则执行view的后退
viewApi.back();
} else { //执行webview后退
oldBack();
}
};
//监听页面切换事件方案1,通过view元素监听所有页面切换事件,目前提供pageBeforeShow|pageShow|pageBeforeBack|pageBack四种事件(before事件为动画开始前触发)
//第一个参数为事件名称,第二个参数为事件回调,其中e.detail.page为当前页面的html对象
view.addEventListener('pageBeforeShow', function(e) {
// console.log(e.detail.page.id + ' beforeShow');
});
view.addEventListener('pageShow', function(e) {
// console.log(e.detail.page.id + ' show');
});
view.addEventListener('pageBeforeBack', function(e) {
// console.log(e.detail.page.id + ' beforeBack');
});
view.addEventListener('pageBack', function(e) {
// console.log(e.detail.page.id + ' back');
});
})(mui);
//更换头像
mui(".mui-table-view-cell").on("tap", "#head", function(e) {
mui.alert("抱歉,暂不支持头像拍照");
return;
if(mui.os.plus){
var a = [{
title: "拍照"
}, {
title: "从手机相册选择"
}];
plus.nativeUI.actionSheet({
title: "修改头像",
cancel: "取消",
buttons: a
}, function(b) {
switch (b.index) {
case 0:
break;
case 1:
getImage();
break;
case 2:
galleryImg();
break;
default:
break
}
})
}
});
function getImage() {
mui.alert("暂不支持头像拍照");
return;
var c = plus.camera.getCamera();
c.captureImage(function(e) {
plus.io.resolveLocalFileSystemURL(e, function(entry) {
var s = entry.toLocalURL() + "?version=" + new Date().getTime();
console.log(s);
document.getElementById("head-img").src = s;
document.getElementById("head-img1").src = s;
//变更大图预览的src
//目前仅有一张图片,暂时如此处理,后续需要通过标准组件实现
document.querySelector("#__mui-imageview__group .mui-slider-item img").src = s + "?version=" + new Date().getTime();;;
}, function(e) {
console.log("读取拍照文件错误:" + e.message);
});
}, function(s) {
console.log("error" + s);
}, {
filename: "_doc/head.jpg"
})
}
function galleryImg() {
plus.gallery.pick(function(a) {
plus.io.resolveLocalFileSystemURL(a, function(entry) {
plus.io.resolveLocalFileSystemURL("_doc/", function(root) {
root.getFile("head.jpg", {}, function(file) {
//文件已存在
file.remove(function() {
console.log("file remove success");
entry.copyTo(root, 'head.jpg', function(e) {
var e = e.fullPath + "?version=" + new Date().getTime();
document.getElementById("head-img").src = e;
document.getElementById("head-img1").src = e;
//变更大图预览的src
//目前仅有一张图片,暂时如此处理,后续需要通过标准组件实现
document.querySelector("#__mui-imageview__group .mui-slider-item img").src = e + "?version=" + new Date().getTime();;
},
function(e) {
console.log('copy image fail:' + e.message);
});
}, function() {
console.log("delete image fail:" + e.message);
});
}, function() {
//文件不存在
entry.copyTo(root, 'head.jpg', function(e) {
var path = e.fullPath + "?version=" + new Date().getTime();
document.getElementById("head-img").src = path;
document.getElementById("head-img1").src = path;
//变更大图预览的src
//目前仅有一张图片,暂时如此处理,后续需要通过标准组件实现
document.querySelector("#__mui-imageview__group .mui-slider-item img").src = path;
},
function(e) {
console.log('copy image fail:' + e.message);
});
});
}, function(e) {
console.log("get _www folder fail");
})
}, function(e) {
console.log("读取拍照文件错误:" + e.message);
});
}, function(a) {}, {
filter: "image"
})
};
function defaultImg() {
if(mui.os.plus){
plus.io.resolveLocalFileSystemURL("_doc/head.jpg", function(entry) {
var s = entry.fullPath + "?version=" + new Date().getTime();;
document.getElementById("head-img").src = s;
document.getElementById("head-img1").src = s;
}, function(e) {
document.getElementById("head-img").src = '../images/logo.png';
document.getElementById("head-img1").src = '../images/logo.png';
})
}else{
document.getElementById("head-img").src = '../images/logo.png';
document.getElementById("head-img1").src = '../images/logo.png';
}
}
document.getElementById("head-img1").addEventListener('tap', function(e) {
e.stopPropagation();
});
document.getElementById("welcome").addEventListener('tap', function(e) {
//显示启动导航
mui.openWindow({
id: 'guide',
url: 'guide.html',
show: {
aniShow: 'fade-in',
duration: 300
},
waiting: {
autoShow: false
}
});
});
function initImgPreview() {
var imgs = document.querySelectorAll("img.mui-action-preview");
imgs = mui.slice.call(imgs);
if (imgs && imgs.length > 0) {
var slider = document.createElement("div");
slider.setAttribute("id", "__mui-imageview__");
slider.classList.add("mui-slider");
slider.classList.add("mui-fullscreen");
slider.style.display = "none";
slider.addEventListener("tap", function() {
slider.style.display = "none";
});
slider.addEventListener("touchmove", function(event) {
event.preventDefault();
})
var slider_group = document.createElement("div");
slider_group.setAttribute("id", "__mui-imageview__group");
slider_group.classList.add("mui-slider-group");
imgs.forEach(function(value, index, array) {
//给图片添加点击事件,触发预览显示;
value.addEventListener('tap', function() {
slider.style.display = "block";
_slider.refresh();
_slider.gotoItem(index, 0);
})
var item = document.createElement("div");
item.classList.add("mui-slider-item");
var a = document.createElement("a");
var img = document.createElement("img");
img.setAttribute("src", value.src);
a.appendChild(img)
item.appendChild(a);
slider_group.appendChild(item);
});
slider.appendChild(slider_group);
document.body.appendChild(slider);
var _slider = mui(slider).slider();
}
}
if(mui.os.stream){
document.getElementById("check_update").display = "none";
}
</script>
</html>