welcome.blade.php 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  6. <meta name="viewport" content="user-scalable=no" />
  7. <meta name="viewport"
  8. content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,viewport-fit=cover" />
  9. <script src="//cdn-novel.iycdm.com/static/jquery-3.4.1.min.js" type="text/javascript"></script>
  10. </head>
  11. <body>
  12. <style>
  13. html,
  14. body,
  15. p,
  16. div,
  17. section {
  18. margin: 0;
  19. padding: 0;
  20. }
  21. img {
  22. width: 100%;
  23. -webkit-tap-highlight-color: transparent;
  24. }
  25. a {
  26. color: currentColor;
  27. -webkit-tap-highlight-color: transparent;
  28. }
  29. .application-content {
  30. padding: 12px;
  31. max-width: 100%;
  32. transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  33. }
  34. .application-content .content-wrap {
  35. width: 100%;
  36. margin-right: auto;
  37. margin-left: auto;
  38. }
  39. .content-card {
  40. border-radius: 5px;
  41. max-width: 100%;
  42. outline: none;
  43. text-decoration: none;
  44. transition-property: box-shadow, opacity;
  45. box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2),
  46. 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
  47. padding: 16px;
  48. font-size: 14px;
  49. line-height: 20px;
  50. }
  51. .card-text {
  52. text-align: center;
  53. }
  54. .card-text .wechat-title {
  55. color: red;
  56. font-weight: 700;
  57. margin-bottom: 16px;
  58. font-size: 18px;
  59. }
  60. .card-text .wechat-name {
  61. color: teal;
  62. font-weight: 700;
  63. font-size: 24px;
  64. line-height: 40px;
  65. margin-bottom: 16px;
  66. }
  67. .card-text .wechat-step {
  68. color: #000;
  69. font-weight: 900;
  70. font-size: 18px;
  71. line-height: 24px;
  72. margin-bottom: 16px;
  73. }
  74. .card-text .copy-text {
  75. height: 28px;
  76. min-width: 50px;
  77. padding: 0 12px;
  78. color: #009688;
  79. caret-color: #009688;
  80. border: 1px solid #009688;
  81. background-color: #fff;
  82. border-radius: 5px;
  83. font-size: 20px;
  84. margin: 0 auto 16px;
  85. display: block;
  86. }
  87. .card-text .copy-button {
  88. height: 36px;
  89. min-width: 64px;
  90. padding: 0 16px;
  91. background-color: #ff5252;
  92. border-radius: 5px;
  93. border: 1px solid #ff5252;
  94. color: #fff;
  95. font-size: 20px;
  96. line-height: 36px;
  97. display: block;
  98. margin: 0 auto 16px;
  99. box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2),
  100. 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
  101. }
  102. .toast-wrap {
  103. position: fixed;
  104. top: 50%;
  105. left: 50%;
  106. -webkit-transform: translate(-50%, -50%);
  107. transform: translate(-50%, -50%);
  108. padding: 5px 10px;
  109. color: #fff;
  110. font-size: 14px;
  111. text-align: center;
  112. background: rgba(0, 0, 0, 0.8);
  113. border-radius: 4px;
  114. }
  115. .hw-guide {
  116. width: 100%;
  117. height: 100%;
  118. position: absolute;
  119. top: 0;
  120. left: 0;
  121. display: none;
  122. }
  123. .hw-guide img {
  124. width: 100%;
  125. }
  126. .hw-guide .btn-know {
  127. width: 180px;
  128. height: 40px;
  129. line-height: 40px;
  130. text-align: center;
  131. border: none;
  132. outline: none;
  133. background: linear-gradient(0deg,
  134. rgba(255, 210, 0, 1),
  135. rgba(255, 239, 75, 1));
  136. border-radius: 10px;
  137. text-align: center;
  138. font-size: 14px;
  139. font-family: PingFang-SC-Bold;
  140. font-weight: bold;
  141. color: rgba(255, 93, 123, 1);
  142. position: absolute;
  143. top: 62%;
  144. left: 50%;
  145. margin-left: -90px;
  146. }
  147. .open-gif {
  148. position: absolute;
  149. background: rgba(0, 0, 0, 0.5);
  150. top: 0;
  151. left: 0;
  152. width: 100%;
  153. height: 100%;
  154. }
  155. .open-gif .open-conetent {
  156. width: 53vw;
  157. position: absolute;
  158. height: 0;
  159. top: 0;
  160. bottom: 0;
  161. left: 0;
  162. right: 0;
  163. margin: auto;
  164. background-color: #f7f5eb;
  165. border-radius: 10px;
  166. overflow: hidden;
  167. text-align: center;
  168. }
  169. .open-gif .open-conetent img {
  170. width: 36%;
  171. display: inline-block;
  172. margin-top: 12%;
  173. }
  174. .open-gif .open-conetent p {
  175. margin-top: 8%;
  176. font-size: 14px;
  177. }
  178. .error-tips{
  179. font-size:16px;
  180. color:#fd555d;
  181. margin-top:40px;
  182. text-align:center;
  183. }
  184. </style>
  185. <div class="application-wrap">
  186. <main class="application-content">
  187. <div class="content-wrap" style="display: none;">
  188. <!-- <div class="content-card">
  189. <div class="card-text">
  190. <p class="wechat-title">请认准官方唯一认证公众号:</p>
  191. <p class="wechat-name">{{$gzh_name}}</p>
  192. <p class="wechat-step">
  193. 打开微信 → 右上角+号 → 添加朋友 → 公众号
  194. </p>
  195. <button class="copy-text" type="button">
  196. {{$gzh_code}}
  197. </button>
  198. <button type="button" class="copy-button" id="copy" data-clipboard-text="">
  199. 一键复制公众号
  200. </button>
  201. <img src="https://cdn-novel.iycdm.com/quickapp/static/1.gif" />
  202. </div>
  203. </div> -->
  204. <div class="error-tips">对不起,暂时无法唤醒快应用!</div>
  205. </div>
  206. </main>
  207. <div class="hw-guide">
  208. <img src="https://cdn-novel.iycdm.com/quickapp/static/guide.jpg " />
  209. <div class="btn-know">知道了</div>
  210. </div>
  211. <div class="open-gif">
  212. <div class="open-conetent">
  213. <img src="https://cdn-novel.iycdm.com/quickapp/static/gidf.gif" />
  214. <p>正在打开快应用...</p>
  215. </div>
  216. </div>
  217. <p class="toast-wrap" style="display: none"></p>
  218. </div>
  219. <script type="text/javascript" src="https://cdn-novel.iycdm.com/quickapp/static/clipboard.js" async="async">
  220. </script>
  221. <script type="text/javascript" src="https://statres.quickapp.cn/quickapp/js/routerinline.min.js"></script>
  222. <script type="text/javascript">
  223. //获取url参数
  224. function getQueryString(name) {
  225. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  226. var r = decodeURIComponent(window.location.search)
  227. .substr(1)
  228. .match(reg);
  229. if (r != null) return unescape(r[2]);
  230. return null;
  231. }
  232. //生成三位随机数
  233. function ranMath() {
  234. return Math.random().toString(36).substr(2, 3).toUpperCase();
  235. }
  236. //没有打开快应用注册h5事件及其方法
  237. var wePage = {
  238. showToast: function (text) {
  239. $(".toast-wrap")
  240. .text(text)
  241. .show();
  242. setTimeout(function () {
  243. $(".toast-wrap").hide();
  244. }, 2000);
  245. },
  246. lisen: function () {
  247. var _self = this;
  248. $(".copy-button").on("click", function () {
  249. var clip = new ClipboardJS("#copy");
  250. clip.on("success", function (e) {
  251. _self.showToast("复制成功");
  252. });
  253. clip.on("error", function (e) {
  254. _self.showToast("复制失败");
  255. });
  256. });
  257. var code = '{{$gzh_code}}' + '/' + ranMath();
  258. $('.copy-text').text(code);
  259. $('.copy-button').attr('data-clipboard-text', code);
  260. },
  261. init: function () {
  262. this.lisen();
  263. }
  264. };
  265. //全局变量
  266. var glob = {
  267. ua: window.navigator.userAgent.toLocaleLowerCase(),
  268. isHuaWei: /huawei|honor/.test(window.navigator.userAgent.toLowerCase()),
  269. isOpenApp: false,
  270. obAvailable: false //机型是否支持快应用
  271. };
  272. //快应用配置
  273. var QYY = {
  274. isWx: /micromessenger/.test(glob.ua), //是否微信环境
  275. isIos: /iphone|ipod|ipad/.test(glob.ua), //是否是ios
  276. entry: "views/Reader", //拉起快应用阅读器页面
  277. packName: "{{ package }}", //快应用包名
  278. bid: "{{$hash_bid}}", //书籍id
  279. cid: "{{$cid}}", //章节id
  280. send_order_id: "{{$send_order_id}}",//派单ID
  281. };
  282. //判断机型是否支持快应用
  283. try {
  284. channelReady(function (bAvailable) {
  285. glob.obAvailable = bAvailable;
  286. });
  287. } catch (e) {
  288. glob.obAvailable = false;
  289. }
  290. //显示公众号落地页
  291. function showH5Page() {
  292. wePage.init();
  293. var time = QYY.isIos ? 0 : 5000;
  294. setTimeout(function () {
  295. $(".content-wrap").show();
  296. showPop(false);
  297. }, time);
  298. }
  299. //是否显示拉起快应用弹窗
  300. function showPop(show) {
  301. if (show) {
  302. $(".open-gif").show();
  303. } else {
  304. $(".open-gif").hide();
  305. }
  306. }
  307. //打开快应用逻辑
  308. function openQyy() {
  309. var parmas = {
  310. bid: QYY.bid,
  311. chapter_id: QYY.cid,
  312. send_order_id: QYY.send_order_id
  313. };
  314. try {
  315. //尝试直接拉起
  316. appRouter(QYY.packName, "/" + QYY.entry, parmas);
  317. } catch (e) {
  318. //唤醒失败 尝试url sheme唤醒
  319. routerAHap(parmas);
  320. }
  321. }
  322. //URL唤醒快应用
  323. function routerAHap(data) {
  324. var parmas = $.param(data);
  325. var ohapa = document.createElement("a");
  326. ohapa.href = "hap://app/" + QYY.packName + "/" + QYY.entry + "?" + parmas;
  327. ohapa.setAttribute(
  328. "style",
  329. "position: absolute;left: -1000rem;height: 1rem;width: 1rem;overflow: hidden"
  330. );
  331. document.body.appendChild(ohapa);
  332. ohapa.click();
  333. }
  334. //初始化
  335. function startDeep() {
  336. showH5Page();
  337. !QYY.isIos && openQyy();
  338. }
  339. //华为h5流程
  340. var hwPage = {
  341. init: function () {
  342. this.lisen();
  343. $(".hw-guide").css("height", $(".hw-guide").width() * 1.778);
  344. $(".hw-guide").show();
  345. },
  346. lisen: function () {
  347. $(".btn-know").on("click", function () {
  348. $(".hw-guide").hide();
  349. showPop(true);
  350. startDeep();
  351. });
  352. }
  353. };
  354. $(function () {
  355. //页面流程开始
  356. //处理弹出框的高度
  357. $(".open-conetent").height($(".open-conetent").width() * 0.75);
  358. //华为手机显示提示页
  359. if (glob.isHuaWei) {
  360. setTimeout(function () {
  361. hwPage.init();
  362. showPop(false);
  363. }, 3000);
  364. } else {
  365. startDeep();
  366. }
  367. });
  368. </script>
  369. </body>
  370. </html>