init.html 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>APP启动</title>
  6. <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=0,viewport-fit=cover">
  7. <script src="html5plus://ready"></script>
  8. <link href="css/swiper.css" rel="stylesheet" type="text/css">
  9. </head>
  10. <body>
  11. <style>
  12. html, body {
  13. position: relative;
  14. height: 100vh;
  15. }
  16. body {
  17. background: #eee;
  18. font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
  19. font-size: 14px;
  20. color:#000;
  21. margin: 0;
  22. padding: 0;
  23. }
  24. .swiper-container {
  25. width: 100%;
  26. height: 100%;
  27. }
  28. .swiper-slide {
  29. text-align: center;
  30. font-size: 18px;
  31. background: #fff;
  32. /* Center slide text vertically */
  33. display: -webkit-box;
  34. display: -ms-flexbox;
  35. display: -webkit-flex;
  36. display: flex;
  37. -webkit-box-pack: center;
  38. -ms-flex-pack: center;
  39. -webkit-justify-content: center;
  40. justify-content: center;
  41. -webkit-box-align: center;
  42. -ms-flex-align: center;
  43. -webkit-align-items: center;
  44. align-items: center;
  45. }
  46. </style>
  47. <div id="app" style="height: 100%;">
  48. <div class="swiper-container">
  49. <div class="swiper-wrapper">
  50. <div class="swiper-slide" @click="go_home(index)" v-for="(item, index) in pic" :style="'background-image: url('+item.url+'); background-position: center center; background-repeat:no-repeat; background-size: 100% auto; height:100%;'">
  51. </div>
  52. </div>
  53. <div class="swiper-pagination" style="bottom:5px;"></div>
  54. </div>
  55. </div>
  56. <script src="script/swiper.js"></script>
  57. <script src="script/vue.js"></script>
  58. <script src="script/axios.js"></script>
  59. <script src="script/fastclick.js"></script>
  60. <script>
  61. plus.navigator.setFullscreen(true);
  62. var vue_obj = new Vue({
  63. el: '#app',
  64. data: {
  65. pic: []
  66. },
  67. created(){
  68. this.get_pic();
  69. },
  70. methods: {
  71. go_home(key){
  72. if(this.pic.length == key + 1){
  73. this.pic_close()
  74. }
  75. },
  76. set_item(key, val){
  77. if(window.plus){
  78. return plus.storage.setItem(key, val)
  79. }else{
  80. return localStorage.setItem(key, val)
  81. }
  82. },
  83. get_item(key){
  84. if(window.plus){
  85. return plus.storage.getItem(key)
  86. }else{
  87. return localStorage.getItem(key)
  88. }
  89. },
  90. pic_close(){
  91. if(window.plus){
  92. plus.navigator.setFullscreen(false);
  93. plus.webview.getWebviewById(plus.runtime.appid).evalJS('document.documentElement.style.opacity = "1"');
  94. plus.navigator.setStatusBarBackground("#26a2ff");
  95. plus.navigator.setStatusBarStyle('light');
  96. plus.webview.currentWebview().close();
  97. }else{
  98. window.location.href = 'index.html';
  99. }
  100. },
  101. get_pic(){
  102. var _this = this;
  103. axios.get('https://www.g107.com/app_init_swiper.php', {params:{w: window.innerWidth, h: window.innerHeight}}).then(function (res) {
  104. _this.pic = res.data;
  105. if(res.data.length == 0){
  106. _this.pic_close()
  107. return
  108. }
  109. _this.$nextTick(function () {
  110. var swiper = new Swiper('.swiper-container',{
  111. pagination: {
  112. el: '.swiper-pagination',
  113. },
  114. });
  115. })
  116. }).catch(function (e) {
  117. _this.pic_close()
  118. })
  119. }
  120. }
  121. });
  122. </script>
  123. </body>
  124. </html>
  125. <script>
  126. FastClick.attach(document.body)
  127. </script>