WXtrialInterface.html 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. <meta name="x5-orientation" content="portrait" />
  7. <meta name="screen-orientation" content="portrait" />
  8. <meta name="apple-mobile-web-app-capable" content="yes">
  9. <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
  10. <!-- 删除苹果默认的工具栏和菜单栏 -->
  11. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  12. <!-- 设置苹果工具栏颜 -->
  13. <meta name="format-detection" content="telphone=no, email=no">
  14. <!-- 忽略页面中的数字识别为电话,忽略email识别 -->
  15. <!-- 启用360浏览器的极速模(webkit) -->
  16. <meta name="renderer" content="webkit">
  17. <!-- 避免IE使用兼容模式 -->
  18. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  19. <!-- 针对手持设备优化,主要是针对一些老的不识别viewport的浏览器,比如黑 -->
  20. <meta name="HandheldFriendly" content="true">
  21. <!-- 微软的老式浏览 -->
  22. <meta name="MobileOptimized" content="320">
  23. <!-- 不能旋转,问题出在这 -->
  24. <!-- UC强制全屏 -->
  25. <meta name="full-screen" content="yes">
  26. <!-- QQ强制全屏 -->
  27. <meta name="x5-fullscreen" content="true">
  28. <!-- UC应用模式 -->
  29. <meta name="browsermode" content="application">
  30. <!-- QQ应用模式 -->
  31. <meta name="x5-page-mode" content="app">
  32. <!-- windows phone 点击无高 -->
  33. <meta name="msapplication-tap-highlight" content="no">
  34. <link rel="stylesheet" type="text/css" href="css/WXtrialInterface.css" />
  35. <link rel="stylesheet" href="https://cdn.bootcss.com/weui/1.1.3/style/weui.min.css" />
  36. <link rel="stylesheet" href="https://cdn.bootcss.com/jquery-weui/1.2.1/css/jquery-weui.min.css" />
  37. <style>
  38. .try-use-wrap, .buy-phone-wrap, .look-wrap{
  39. width: 100%;
  40. height: 100%;
  41. position: fixed;
  42. top: 0;
  43. left: 0;
  44. z-index: 9999;
  45. background: rgba(0, 0, 0, 0.5);
  46. display: none;
  47. }
  48. .try-use-container{
  49. width: 80%;
  50. height: 409px;
  51. position: absolute;
  52. top: 50%;
  53. left: 50%;
  54. transform: translate(-50%, -50%);
  55. background-color: #FFFFFF;
  56. border-radius: 0.66em;
  57. }
  58. .time-close-wrap{
  59. width: 5.46em;
  60. height: 2em;
  61. line-height: 2em;
  62. text-align: center;
  63. position: absolute;
  64. top: 0.24em;
  65. right: 0.3em;
  66. background: rgba(0, 0, 0, 0.49);
  67. border-radius: 1.26em;
  68. font-size: 12px;
  69. color: #FFFFFF;
  70. }
  71. .bug-wrap{
  72. width: 90%;
  73. height: 115px;
  74. background: #FFFFFF;
  75. border-radius: 10px;
  76. position: absolute;
  77. top: 50%;
  78. left: 50%;
  79. transform: translate(-50%, -50%);
  80. }
  81. .bug-title{
  82. text-align: center;
  83. margin: 25px 0;
  84. font-size: 18px;
  85. font-weight: 600;
  86. color: #333333;
  87. }
  88. .btn-list{
  89. width: 100%;
  90. height: 44px;
  91. line-height: 44px;
  92. border-top: 1px solid rgba(238,238,238,1);
  93. position: absolute;
  94. bottom: 0;
  95. left: 0;
  96. display: flex;
  97. align-items: center;
  98. }
  99. .btn{
  100. flex: 1;
  101. text-align: center;
  102. }
  103. .cannel-btn{
  104. font-size: 18px;
  105. color: #666666;
  106. }
  107. .go-bug{
  108. font-size: 18px;
  109. color: #3B7FFF;
  110. border-left: 1px solid rgba(238,238,238,1);
  111. }
  112. </style>
  113. </head>
  114. <body class="scroll h-player" style="overscroll-behavior: contain;">
  115. <div class="container" id="player">
  116. <div class="muted" id="btnMuted">
  117. <div class="control-right-img" data-id="1">
  118. <img src="../static/img/xuanfu_icon.png">
  119. </div>
  120. </div>
  121. <div id="wine">
  122. <div id="box">
  123. <canvas id="playCanvas" width="450" height="800"></canvas>
  124. </div>
  125. </div>
  126. <div class="leftmains">
  127. <div class="PictureQualityMain">
  128. <div class="PictureQuality" data-id="4">高清</div>
  129. <div class="PictureQuality avit" data-id="3">标清</div>
  130. <div class="PictureQuality" data-id="2">极速</div>
  131. </div>
  132. <div class="operation">
  133. <div class="upload" id="showsuss" data-text="uploads">
  134. <img src="../static/img/wx/shangchuan_icon.png">
  135. <div>上传</div>
  136. </div>
  137. <div class="upload" onclick="showShearPlate()" data-text="Shearplate">
  138. <img src="../static/img/wx/jianqieban_icon.png">
  139. <div>剪贴板</div>
  140. </div>
  141. <div class="upload" id="upload" data-text="Signout">
  142. <img src="../static/img/wx/tuichu_icon.png">
  143. <div>退出</div>
  144. </div>
  145. </div>
  146. </div>
  147. <div class="bottommains">
  148. <div class="botmat1">
  149. <div class="botmat1img" data-text="gengduo">
  150. <img src="../static/img/wx/gengduo_icon.png">
  151. </div>
  152. </div>
  153. <div class="botmat1">
  154. <div class="botmat1img" data-text="home">
  155. <img src="../static/img/wx/home_icon.png">
  156. </div>
  157. </div>
  158. <div class="botmat1">
  159. <div class="botmat1img" data-text="return">
  160. <img src="../static/img/wx/fanhui_icon.png">
  161. </div>
  162. </div>
  163. </div>
  164. <img class="loading loading_sceen_pic" />
  165. </div>
  166. <div class="mask">
  167. <div class="box-shear-plate"></div>
  168. <img class="close" onclick="handleClose()" src="img/guanbi_icon@2x.png" alt="">
  169. </div>
  170. <div class="weui-mask_transparent"></div>
  171. <div class="weui-toast weui_loading_toast weui-toast--visible">
  172. <div class="weui_loading"><i class="weui-loading weui-icon_toast"></i></div>
  173. <p class="weui-toast_content">数据加载中</p>
  174. </div>
  175. <div class="try-use-wrap">
  176. <div class="try-use-container">
  177. <video width="100%" height="100%" id="source" muted autoplay="autoplay" loop="loop">
  178. 您的浏览器不支持 video 标签。
  179. </video>
  180. <div class="time-close-wrap"><span class="time-node"></span> 关闭</div>
  181. </div>
  182. </div>
  183. <div class="buy-phone-wrap">
  184. <div class="bug-wrap">
  185. <div class="bug-title">获得极致体验服务请购买云手机</div>
  186. <div class="btn-list">
  187. <div class="btn cannel-btn">取消</div>
  188. <div class="btn go-bug">去购买</div>
  189. </div>
  190. </div>
  191. </div>
  192. <div class="look-wrap">
  193. <div class="bug-wrap">
  194. <div class="bug-title">关闭广告会退出云手机是否继续观看</div>
  195. <div class="btn-list">
  196. <div class="btn cannel-btn cannel-ad-btn">放弃</div>
  197. <div class="btn go-bug looking">继续观看</div>
  198. </div>
  199. </div>
  200. </div>
  201. <script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></script>
  202. <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
  203. <script src="https://lf1-cdn-tos.bytegoofy.com/goofy/developer/jssdk/jssdk-1.0.3.js"></script>
  204. <script type="text/javascript" src="jquery-1.11.0.min.js"></script>
  205. <!-- ffm软解 -->
  206. <script type="text/javascript" src="helper.js"></script>
  207. <script type="text/javascript" src="jquery-weui.min.js"></script>
  208. <script type="text/javascript" src="pcm-player.js"></script>
  209. <script type="text/javascript" src="webgl.js"></script>
  210. <script type="text/javascript" src="https://cdn.bootcss.com/vConsole/3.2.0/vconsole.min.js"></script>
  211. <script type="text/javascript" src="WXdraw.js"></script>
  212. <script type="text/javascript">
  213. $(function () {
  214. //手指滑动多少距离就认为是滑成功
  215. //这个值不能太大,否则影响斜着滑动时,垂直滑动的流畅性,也不能太小,太灵敏也不好
  216. var diffXDistance = 50;
  217. //当前滑动的对象
  218. var currentObject;
  219. //上一次滑动的对象
  220. var lastObject;
  221. //是否可以左右滑动,在上下滑的时候禁止左右滑
  222. var canSlide = true;
  223. //用于记录按下的点
  224. var startPoint;
  225. $(".slide-content").css({
  226. width: $(".slide-wrapper").width()
  227. });
  228. $(".slide-scroll").css({
  229. width: $(".slide-wrapper").width() + $(".slide-content-button").width()
  230. })
  231. .on('touchstart', function (e) {
  232. currentObject = this;
  233. startPoint = {
  234. x: e.originalEvent.changedTouches[0].pageX,
  235. y: e.originalEvent.changedTouches[0].pageY
  236. };
  237. })
  238. .on('touchmove', function (e) {
  239. //如果是左右滑动,就禁止上下的滑动
  240. //如果是上下的滑动,就禁止左右滑动
  241. if (Math.abs(e.originalEvent.changedTouches[0].pageX - startPoint.x) > Math.abs(e.originalEvent.changedTouches[0].pageY - startPoint.y)) {
  242. event.preventDefault();
  243. } else {
  244. canSlide = false;
  245. }
  246. })
  247. .on('touchend', function (e) {
  248. //如果是上下滑动,这里就直接返回了
  249. if (!canSlide) {
  250. canSlide = true;
  251. return true;
  252. }
  253. //点击除当前左滑对象之外的任意其他位置
  254. if (lastObject && currentObject != lastObject) {
  255. //右滑→
  256. $(lastObject).removeClass("animate-slide");
  257. //清空上一个左滑的对象
  258. lastObject = undefined;
  259. }
  260. var diffX = e.originalEvent.changedTouches[0].pageX - startPoint.x;
  261. if (diffX < -diffXDistance) {
  262. //左滑←
  263. $(currentObject).addClass("animate-slide");
  264. if (lastObject && lastObject != currentObject) {
  265. //右滑→
  266. $(lastObject).removeClass("animate-slide");
  267. }
  268. //记录上一个左滑的对象
  269. lastObject = currentObject;
  270. } else if (diffX >= diffXDistance) {
  271. if (currentObject == lastObject) {
  272. //右滑→
  273. $(currentObject).removeClass("animate-slide");
  274. //清空上一个左滑的对象
  275. lastObject = undefined;
  276. }
  277. }
  278. });
  279. });
  280. </script>
  281. <script>
  282. var videoTimer = null, videoTime = 0, adType = 0, sourceType = 0, disconnectionFlag = false;
  283. var topwinHeight = window.screen.height - window.innerHeight + 30; //计算title top 头部
  284. var url = window.location.href;
  285. url = url.split('/');
  286. var baseUrl = url[0] + '//' + url[2];
  287. console.log(baseUrl)
  288. var parameters = GetRequest();
  289. var form = {};
  290. form.token = parameters['token'];
  291. form.mealType = parameters['mealType'];
  292. form.userCardId = parameters['userCardId'];
  293. if (parameters['mealType'] === 'VIP') {
  294. $(".loading_sceen_pic").attr('src', '../static/img/home_bg_VIP.png');
  295. } else if (parameters['mealType'] === 'SVIP') {
  296. $(".loading_sceen_pic").attr('src', '../static/img/home_bg_SVIP.png');
  297. } else if (parameters['mealType'] === 'STAR') {
  298. $(".loading_sceen_pic").attr('src', '../static/img/home_bg_STAR.png');
  299. } else if (parameters['mealType'] === 'STARPRO') {
  300. $(".loading_sceen_pic").attr('src', '../static/img/home_bg_PRO.png');
  301. }
  302. $('#wine').css({
  303. "width": window.screen.width,
  304. "height": window.screen.height - topwinHeight - 20,
  305. "position": "absolute"
  306. })
  307. $('.loading').css({
  308. "width": window.screen.width,
  309. "height": window.screen.height - topwinHeight - 20
  310. });
  311. var winese = document.createElement("wine");
  312. wine.style.top = "-" + winese + 'px';
  313. var isAudioPlay = false;
  314. adInit();
  315. $.alert({
  316. title: '提示',
  317. text: '开始使用云手机',
  318. onOK: function () {
  319. isAudioPlay = true;
  320. }
  321. });
  322. var orientation = 0; //0 竖屏,1横屏
  323. function array_unique(arr) {
  324. return arr.filter(function (e, i) {
  325. return arr.indexOf(e) === i;
  326. })
  327. }
  328. var cutList = [];
  329. let timer, isFlag = true;
  330. function showShearPlate() {
  331. stopManyClick(() => {
  332. $('.box-shear-plate').empty();
  333. $.ajax({
  334. url: baseUrl + "/api/public/v5/shear/content",
  335. headers: {
  336. 'Authorization': form.token
  337. },
  338. type: 'get',
  339. dataType: 'json',
  340. success: function (res) {
  341. if (res.status === 0) {
  342. if (res.data.length) {
  343. cutList = array_unique(res.data)
  344. var str = '<div class="title">剪贴板<div onclick="handleClear()" class="btn-clear">清空</div></div><div class="slide-wrapper-content">'
  345. cutList.forEach(function (item) {
  346. str += "<div class='slide-wrapper'><div class='slide-scroll animate-slide-start'><div class='slide-content'><div onclick='handleCopy(\"" + item.content + "\")'>" + item.content + "</div></div><div class='slide-content-button'><button onclick='handleDelete(" + item.id + ")'>删除</button></div></div></div>"
  347. })
  348. str += '</div>'
  349. $('.box-shear-plate').append(str);
  350. } else {
  351. $('.box-shear-plate').append('<img class="empty" src="img/jianqieban_pic@2x.png" alt="" /><div class="empty-txt">剪贴板为空</div>')
  352. }
  353. $('.mask').show();
  354. initSlider();
  355. } else {
  356. $('.box-shear-plate').append('<img class="empty" src="img/jianqieban_pic@2x.png" alt="" /><div class="empty-txt">剪贴板为空</div>')
  357. $('.mask').show();
  358. }
  359. }
  360. })
  361. })
  362. }
  363. //防止提示一秒内重复显示
  364. function stopManyClick(fn) {
  365. if (isFlag) {
  366. fn();
  367. }
  368. isFlag = false;
  369. if (timer) { clearTimeout(timer); }
  370. timer = setTimeout(() => { isFlag = true }, 1500);
  371. }
  372. // 清空剪贴板
  373. function handleClear() {
  374. var ids = '';
  375. cutList.forEach(function (item) {
  376. ids += 'ids=' + item.id + '&'
  377. });
  378. ids = ids.substring(0, ids.lastIndexOf('&'));
  379. $.confirm("确定清空剪贴板?", function () {
  380. $.ajax({
  381. url: baseUrl + "/api/public/v5/shear/content?" + ids,
  382. headers: {
  383. 'Authorization': form.token
  384. },
  385. type: 'DELETE',
  386. dataType: 'json',
  387. success: function (res) {
  388. if (res.status === 0) {
  389. showShearPlate();
  390. } else {
  391. $.toast(res.msg, "text");
  392. }
  393. }
  394. })
  395. });
  396. }
  397. function handleCopy(content) {
  398. var cutting = {
  399. "type": "cutting",
  400. "data": {
  401. "str": content
  402. }
  403. }
  404. wsss.send(JSON.stringify(cutting));
  405. }
  406. // 删除剪贴板
  407. function handleDelete(id) {
  408. $.ajax({
  409. url: baseUrl + "/api/public/v5/shear/content?ids=" + id,
  410. headers: {
  411. 'Authorization': form.token
  412. },
  413. type: 'DELETE',
  414. dataType: 'json',
  415. success: function (res) {
  416. if (res.status === 0) {
  417. showShearPlate();
  418. } else {
  419. $.toast(res.msg, "text");
  420. }
  421. }
  422. })
  423. }
  424. function initSlider() {
  425. //手指滑动多少距离就认为是滑成功
  426. //这个值不能太大,否则影响斜着滑动时,垂直滑动的流畅性,也不能太小,太灵敏也不好
  427. var diffXDistance = 50;
  428. //当前滑动的对象
  429. var currentObject;
  430. //上一次滑动的对象
  431. var lastObject;
  432. //是否可以左右滑动,在上下滑的时候禁止左右滑
  433. var canSlide = true;
  434. //用于记录按下的点
  435. var startPoint;
  436. $(".slide-content").css({
  437. width: $(".slide-wrapper").width()
  438. });
  439. document.body.removeEventListener('touchmove', function (e) {
  440. e.preventDefault()
  441. }, {
  442. passive: false
  443. })
  444. $(".slide-scroll").css({
  445. width: $(".slide-wrapper").width() + $(".slide-content-button").width()
  446. })
  447. .on('touchstart', function (e) {
  448. currentObject = this;
  449. startPoint = {
  450. x: e.originalEvent.changedTouches[0].pageX,
  451. y: e.originalEvent.changedTouches[0].pageY
  452. };
  453. })
  454. .on('touchmove', function (e) {
  455. //如果是左右滑动,就禁止上下的滑动
  456. //如果是上下的滑动,就禁止左右滑动
  457. if (Math.abs(e.originalEvent.changedTouches[0].pageX - startPoint.x) > Math.abs(e.originalEvent.changedTouches[0].pageY - startPoint.y)) {
  458. event.preventDefault();
  459. } else {
  460. canSlide = false;
  461. }
  462. })
  463. .on('touchend', function (e) {
  464. //如果是上下滑动,这里就直接返回了
  465. if (!canSlide) {
  466. canSlide = true;
  467. return true;
  468. }
  469. //点击除当前左滑对象之外的任意其他位置
  470. if (lastObject && currentObject != lastObject) {
  471. //右滑→
  472. $(lastObject).removeClass("animate-slide");
  473. //清空上一个左滑的对象
  474. lastObject = undefined;
  475. }
  476. var diffX = e.originalEvent.changedTouches[0].pageX - startPoint.x;
  477. if (diffX < -diffXDistance) {
  478. //左滑←
  479. $(currentObject).addClass("animate-slide");
  480. if (lastObject && lastObject != currentObject) {
  481. //右滑→
  482. $(lastObject).removeClass("animate-slide");
  483. }
  484. //记录上一个左滑的对象
  485. lastObject = currentObject;
  486. } else if (diffX >= diffXDistance) {
  487. if (currentObject == lastObject) {
  488. //右滑→
  489. $(currentObject).removeClass("animate-slide");
  490. //清空上一个左滑的对象
  491. lastObject = undefined;
  492. }
  493. }
  494. });
  495. }
  496. var btnMuted = document.querySelector("#btnMuted");
  497. btnMuted && (function () {
  498. var setHistory = function (left, top) {
  499. try {
  500. localStorage.setItem("muted-btn-loc", JSON.stringify({
  501. left: left,
  502. top: top
  503. }));
  504. } catch (ex) { }
  505. };
  506. var getHistory = function () {
  507. try {
  508. var value = localStorage.getItem("muted-btn-loc");
  509. if (!value) return null;
  510. value = JSON.parse(value);
  511. if (!value) return null;
  512. return value;
  513. } catch (ex) {
  514. return null
  515. }
  516. };
  517. var fixLoc = function (loc) {
  518. var rect = btnMuted.getBoundingClientRect();
  519. rect = {
  520. top: rect.top,
  521. left: rect.left,
  522. width: rect.width,
  523. height: rect.height
  524. }; // 部分低版本浏览器,该属性为只读
  525. if (loc) {
  526. rect.left = loc.left;
  527. rect.top = loc.top;
  528. }
  529. var minX = 0;
  530. var minY = 0;
  531. var docRect = document.documentElement.getBoundingClientRect();
  532. var maxY = docRect.height - rect.height;
  533. var maxX = docRect.width - rect.width;
  534. var left = rect.left;
  535. var top = rect.top;
  536. left = Math.min(left, maxX);
  537. left = Math.max(left, minX);
  538. top = Math.min(top, maxY);
  539. top = Math.max(top, minY);
  540. if (loc || top !== rect.top || left !== rect.left) {
  541. btnMuted.style.cssText += "left:" + left + "px;top:" + top + "px;";
  542. }
  543. }
  544. window.addEventListener("resize", function () {
  545. fixLoc();
  546. });
  547. var touchPoint = {
  548. pageY: 0,
  549. pageX: 0
  550. };
  551. var currentLoc = {
  552. top: 0,
  553. left: 0,
  554. curTop: 0,
  555. curLeft: 0
  556. };
  557. var toMove = false;
  558. var touchmove = function (e) {
  559. e.preventDefault();
  560. var point = e.changedTouches[0];
  561. var top = -touchPoint.pageY + point.pageY;
  562. var left = -touchPoint.pageX + point.pageX;
  563. if (toMove) {
  564. top += currentLoc.top;
  565. left += currentLoc.left;
  566. currentLoc.curLeft = left;
  567. currentLoc.curTop = top;
  568. btnMuted.style.cssText += "left:" + left + "px;top:" + top + "px;";
  569. } else {
  570. if (Math.abs(top) >= 5 || Math.abs(left) >= 5) {
  571. toMove = true;
  572. }
  573. }
  574. };
  575. var touchend = function () {
  576. window.removeEventListener("touchmove", touchmove, {
  577. passive: false
  578. });
  579. window.removeEventListener("touchend", touchend, {
  580. passive: false
  581. });
  582. if (toMove) {
  583. setHistory(currentLoc.curLeft, currentLoc.curTop);
  584. fixLoc();
  585. } else {
  586. //按点击处理
  587. var set = $('.control-right-img').attr("data-id")
  588. if (set == '1') {
  589. $('.control-right-img').attr({
  590. "data-id": "2"
  591. })
  592. $(".leftmains").css({
  593. "right": "0rem"
  594. })
  595. } else {
  596. $('.control-right-img').attr({
  597. "data-id": "1"
  598. })
  599. $(".leftmains").css({
  600. "right": "-4rem"
  601. })
  602. }
  603. }
  604. }
  605. btnMuted.addEventListener("touchstart", function (e) {
  606. e.preventDefault();
  607. toMove = false;
  608. var point = e.changedTouches[0];
  609. touchPoint.pageX = point.pageX;
  610. touchPoint.pageY = point.pageY;
  611. var rect = e.target.getBoundingClientRect();
  612. currentLoc.top = rect.top;
  613. currentLoc.left = rect.left;
  614. window.addEventListener("touchmove", touchmove, {
  615. passive: false
  616. });
  617. window.addEventListener("touchend", touchend, {
  618. passive: false
  619. });
  620. }, {
  621. passive: false
  622. });
  623. var history = getHistory();
  624. if (history) {
  625. fixLoc(history);
  626. }
  627. btnMuted.classList.remove("hide");
  628. })();
  629. $("#upload").on("click", function () {
  630. decodeWoker.postMessage('close');
  631. decodeWoker.terminate();
  632. webSocketWorker.terminate();
  633. if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
  634. tt.miniProgram.switchTab({
  635. url: '/pages/home/home'
  636. })
  637. } else if(window.__wxjs_environment === 'miniprogram') {
  638. wx.miniProgram.switchTab({
  639. url: '/pages/home/home'
  640. })
  641. } else {
  642. location.href = 'http://test_zt_ip62.phone.androidscloud.com/cloud/phone/web/#/pages/index/index'
  643. // 动态设置有问题 https://ask.dcloud.net.cn/question/96060
  644. // document.addEventListener('UniAppJSBridgeReady', function() {
  645. // console.log(222)
  646. // uni.navigateTo({
  647. // url: '/pages/index/index'
  648. // });
  649. // })
  650. }
  651. })
  652. function handleClose() {
  653. $('.mask').hide();
  654. }
  655. var decodeCount = 1;
  656. var isFinish = false;
  657. var player = new PCMPlayer({
  658. encoding: '16bitInt',
  659. channels: 2,
  660. sampleRate: 44100,
  661. flushingTime: 22,
  662. debug: false
  663. });
  664. Module = {};
  665. Module.onRuntimeInitialized = function () {
  666. isFinish = true;
  667. }
  668. function decodeAAC(data) {
  669. var retPtr = Module._malloc(4 * 5 * 1024); //接收的数据
  670. var inputPtr = Module._malloc(4 * data.length); //输入数据
  671. for (var i = 0; i < data.length; i++) {
  672. Module.HEAPU8[(inputPtr) + i] = data[i]; //转换为堆数据
  673. }
  674. var pcmLen = Module._feedData(retPtr, inputPtr, data.length);
  675. if (pcmLen >= 0) {
  676. var pcmData = new Uint8Array(pcmLen);
  677. for (var i = 0; i < pcmLen; i++) {
  678. pcmData[i] = Module.HEAPU8[(retPtr) + i]
  679. }
  680. player.feed(pcmData);
  681. }
  682. decodeCount++;
  683. Module._free(inputPtr);
  684. Module._free(retPtr);
  685. }
  686. var decodeWoker = new Worker('decoder.js');
  687. var myVideo = document.getElementById("playCanvas");
  688. var logicWidth = 720;
  689. var logicHeight = 1280;
  690. decodeWoker.onmessage = function (event) {
  691. var objData = event.data;
  692. switch (objData.cmd) {
  693. case 0:
  694. break;
  695. case 1:
  696. if (logicWidth != objData.width || logicHeight != objData.height) {
  697. logicWidth = objData.width;
  698. logicHeight = objData.height;
  699. }
  700. webglPlayer.renderFrame(objData.data, logicWidth, logicHeight, logicWidth * logicHeight, (logicWidth / 2) * (logicHeight / 2));
  701. $('.weui-mask_transparent').hide()
  702. $('.weui-toast').hide()
  703. $('.loading').hide()
  704. break;
  705. case 5:
  706. var buffer = RequestIFrame();
  707. webSocketWorker.postMessage(buffer);
  708. }
  709. }
  710. var isFinish = false;
  711. var webglPlayer = new WebGLPlayer(myVideo, {
  712. preserveDrawingBuffer: false
  713. });
  714. function GetRequest() {
  715. var url = location.search; // 获取url中"?"符后的字串
  716. var obj = new Object();
  717. if (url.indexOf("?") != -1) {
  718. var str = url.substr(1);
  719. strs = str.split("&");
  720. for (var i = 0; i < strs.length; i++) {
  721. obj[strs[i].split("=")[0]] = (strs[i].split("=")[1]);
  722. }
  723. }
  724. return obj;
  725. }
  726. var ip = parameters["ip"];
  727. var appletPushAddress = parameters["appletPushAddress"];
  728. var token = parameters["cardToken"];
  729. var webSocketWorker = new Worker('websocket.js?ip=' + ip + '&appletPushAddress=' + appletPushAddress + '&token=' + token);
  730. webSocketWorker.onmessage = function (event) {
  731. var input = event.data;
  732. if (input[0] == 0xff && isAudioPlay) {
  733. decodeAAC(input);
  734. }
  735. if (input[0] == 0 && input[1] == 0 && input[2] == 0 && input[3] == 1) {
  736. var cmd = {
  737. type: "rawData",
  738. data: event.data
  739. };
  740. decodeWoker.postMessage(cmd);
  741. }
  742. if (input[0] == 0x68) {
  743. if (input[23] == 0x5c) {
  744. if (CheckVerifyCode(input)) {
  745. webSocketWorker.postMessage(ConfigChannel('RK3923C1201900139'));
  746. var checkBuffer = GetScreenState();
  747. webSocketWorker.postMessage(checkBuffer);
  748. }
  749. else {
  750. $.toast("画面异常,请重新进入", "text");
  751. decodeWoker.postMessage('close');
  752. decodeWoker.terminate();
  753. webSocketWorker.terminate();
  754. if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
  755. tt.miniProgram.switchTab({
  756. url: '/pages/home/home'
  757. })
  758. } else if(window.__wxjs_environment === 'miniprogram') {
  759. wx.miniProgram.switchTab({
  760. url: '/pages/home/home'
  761. })
  762. } else {
  763. location.href = 'http://test_zt_ip62.phone.androidscloud.com/cloud/phone/web/#/pages/index/index'
  764. // document.addEventListener('UniAppJSBridgeReady', function() {
  765. // uni.navigateTo({
  766. // url: '/pages/index/index'
  767. // });
  768. // })
  769. }
  770. }
  771. }
  772. if (input[23] == 0x05) { //横竖屏标识
  773. var state = CheckScreenDirection(input.slice(24, 24 + 8));
  774. if (state == 1) {
  775. console.log("安卓卡此时竖屏");
  776. //竖屏处理
  777. resolving = 1;
  778. } else {
  779. console.log("安卓卡此时横屏");
  780. //横屏处理
  781. resolving = 0;
  782. }
  783. }
  784. if (input[23] == 0x0b) {
  785. console.log("多端登陆");
  786. }
  787. }
  788. if (event.data === 'close') {
  789. $.toast("画面异常,请重新进入", "text");
  790. decodeWoker.postMessage('close');
  791. decodeWoker.terminate();
  792. webSocketWorker.terminate();
  793. if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
  794. tt.miniProgram.switchTab({
  795. url: '/pages/home/home'
  796. })
  797. } else if(window.__wxjs_environment === 'miniprogram') {
  798. wx.miniProgram.switchTab({
  799. url: '/pages/home/home'
  800. })
  801. } else {
  802. location.href = 'http://test_zt_ip62.phone.androidscloud.com/cloud/phone/web/#/pages/index/index'
  803. // document.addEventListener('UniAppJSBridgeReady', function() {
  804. // uni.navigateTo({
  805. // url: '/pages/index/index'
  806. // });
  807. // })
  808. }
  809. }
  810. }
  811. // 激活码广告相关配置
  812. function getConfigByPhoneType() {
  813. console.log('form', form)
  814. return new Promise((resolve, reject) => {
  815. $.ajax({
  816. url: baseUrl + "/api/pay/v5/trialCodeConfig/getConfigByPhoneType",
  817. headers: {
  818. 'Authorization': form.token
  819. },
  820. data: {
  821. userCardId: form.userCardId,
  822. phoneType: form.mealType
  823. },
  824. type: 'get',
  825. dataType: 'json',
  826. success: function (res) {
  827. console.log(res)
  828. let obj = res.data;
  829. if (res.status === 0) {
  830. resolve(obj)
  831. } else {
  832. $.toast(res.msg, "text");
  833. }
  834. }
  835. })
  836. })
  837. }
  838. //列表
  839. function getSetmealList() {
  840. return new Promise((resolve, reject) => {
  841. $.ajax({
  842. url: baseUrl + "/api/resources/v4/freetrial/setmeal/list",
  843. headers: {
  844. 'Authorization': form.token
  845. },
  846. type: 'get',
  847. dataType: 'json',
  848. success: function (res) {
  849. if (res.status === 0) {
  850. let list = res.data;
  851. list.map((item) => {
  852. if(item.phoneType === parameters['mealType']){
  853. resolve(item)
  854. }
  855. })
  856. } else {
  857. $.toast(res.msg, "text");
  858. }
  859. }
  860. })
  861. })
  862. }
  863. //广告信息
  864. function adInit() {
  865. sourceType = parameters['sourceType'];
  866. if(sourceType == 1) {
  867. getSetmealList().then((res) => {
  868. if(res.pushFlowAdvert === 1){
  869. getAdList(15);
  870. }
  871. if(res.intervalSwitch === 1) {
  872. let time = res.intervalAdvertDuration * 60 * 1000;
  873. setInterval(() => {
  874. $('.try-use-wrap').eq(0).hide();
  875. getAdList(16);
  876. }, time);
  877. }
  878. })
  879. }else if(sourceType == 2) {
  880. getConfigByPhoneType().then((res) => {
  881. if(res.isDisconnectionTime === 1){
  882. let time = res.disconnectionTime * 60 * 1000;
  883. setTimeout(() => {
  884. disconnectionFlag = true;
  885. $('.buy-phone-wrap').eq(0).show();
  886. }, time);
  887. }
  888. if(res.isShowAd === 1){
  889. getAdList(15);
  890. }
  891. if(res.isIntervalPlayAd === 1) {
  892. let time = res.intervalPlayAdTime * 60 * 1000;
  893. setInterval(() => {
  894. $('.try-use-wrap').eq(0).hide();
  895. getAdList(16);
  896. }, time);
  897. }
  898. })
  899. }
  900. }
  901. // 广告接口
  902. function getAdList(type){
  903. adType = type;
  904. $.ajax({
  905. url: baseUrl + "/api/public/v5/advertising/getAdInfoByAdPlace",
  906. headers: {
  907. 'Authorization': form.token
  908. },
  909. data: JSON.stringify({
  910. adPlace: type,
  911. os: 0
  912. }),
  913. type: 'POST',
  914. dataType: 'json',
  915. contentType: "application/json;charset=UTF-8",
  916. success: function (res) {
  917. if (res.status === 0) {
  918. let list = res.data;
  919. videoTime = list[0].forcedTime;
  920. // $('#source').src = list[0].adVideoBase.videoUrl;
  921. $("#source").attr("src", list[0].adVideoBase.videoUrl);//更新url
  922. $("#source").attr("autoplay", "true");//直接播放
  923. videoTimer = setInterval(() =>{
  924. if(videoTime > 0) {
  925. videoTime--;
  926. $('.time-node').eq(0).text(videoTime + 's');
  927. } else {
  928. clearInterval(videoTimer);
  929. $('.time-node').eq(0).text('');
  930. }
  931. },1000)
  932. if (adType === 16 && sourceType == 1) { // 间隔广告和试用才上报
  933. report(0);
  934. }
  935. $('.try-use-wrap').eq(0).show();
  936. } else {
  937. $.toast(res.msg, "text");
  938. }
  939. }
  940. })
  941. }
  942. //间隔广告上报
  943. function report(type) {
  944. $.ajax({
  945. url: baseUrl + "/api/resources/v1/trial/report",
  946. headers: {
  947. 'Authorization': form.token
  948. },
  949. data: JSON.stringify({
  950. userCardId: form.userCardId,
  951. reportType: type
  952. }),
  953. type: 'POST',
  954. dataType: 'json',
  955. contentType: "application/json;charset=UTF-8",
  956. success: function (res) {}
  957. })
  958. }
  959. //关闭广告
  960. $('.time-close-wrap')[0].addEventListener('click', () => {
  961. $('.buy-phone-wrap').eq(0).show();
  962. })
  963. // 点击取消
  964. $('.cannel-btn')[0].addEventListener('click', () => {
  965. $('.buy-phone-wrap').eq(0).hide();
  966. if (disconnectionFlag) {//设置了断线时间,取消直接退出
  967. systemBuriedPoint('激活码-断线-取消');
  968. wx.miniProgram.switchTab({
  969. url: '/pages/home/home'
  970. })
  971. return
  972. }
  973. let pointName = '';
  974. if(sourceType == 1){
  975. pointName = videoTime == 0 ? '免费试用-关闭-取消' : '免费试用-强制关闭-取消';
  976. } else {
  977. pointName = videoTime == 0 ? '激活码-关闭-取消' : '激活码-强制关闭-取消';
  978. }
  979. systemBuriedPoint(pointName);
  980. if(videoTime == 0) {
  981. if (adType === 16 && sourceType == 1) {
  982. report(1);
  983. }
  984. $('.try-use-wrap').eq(0).hide();
  985. return
  986. }
  987. $('.look-wrap').eq(0).show();
  988. })
  989. // 点击去购买
  990. $('.go-bug')[0].addEventListener('click', () => {
  991. let pointName = '';
  992. if(disconnectionFlag) {
  993. pointName = '激活码-断线-去购买';
  994. } else if(sourceType == 1){
  995. pointName = videoTime == 0 ? '免费试用-关闭-去购买' : '免费试用-强制关闭-去购买';
  996. } else {
  997. pointName = videoTime == 0 ? '激活码-关闭-去购买' : '激活码-强制关闭-去购买';
  998. }
  999. systemBuriedPoint(pointName);
  1000. wx.miniProgram.navigateTo({
  1001. url: '/packageA/order/renew/index?record=' + form.userCardId
  1002. })
  1003. })
  1004. // 放弃
  1005. $('.cannel-ad-btn')[0].addEventListener('click', () => {
  1006. if(sourceType == 1){
  1007. systemBuriedPoint('免费试用-强制关闭-放弃');
  1008. } else {
  1009. systemBuriedPoint('激活码-强制关闭-放弃');
  1010. }
  1011. wx.miniProgram.switchTab({
  1012. url: '/pages/home/home'
  1013. })
  1014. })
  1015. // 继续观看
  1016. $('.looking')[0].addEventListener('click', () => {
  1017. $('.look-wrap').eq(0).hide();
  1018. if(sourceType == 1){
  1019. systemBuriedPoint('免费试用-强制关闭-继续观看');
  1020. } else {
  1021. systemBuriedPoint('激活码-强制关闭-继续观看');
  1022. }
  1023. })
  1024. // 埋点
  1025. function systemBuriedPoint(pointName){
  1026. $.ajax({
  1027. url: baseUrl + "/api/public/v1/systemBuriedPoint/stat",
  1028. headers: {
  1029. 'Authorization': form.token
  1030. },
  1031. type: 'post',
  1032. data:JSON.stringify({
  1033. pointName: pointName
  1034. }),
  1035. contentType:"application/json",
  1036. dataType: 'json',
  1037. success: function (res) {}
  1038. })
  1039. }
  1040. function Close() { // webworker 关闭,清理
  1041. var cmd = {
  1042. cmd: 0
  1043. };
  1044. decodeWoker.postMessage(cmd);
  1045. decodeWoker.terminate();
  1046. webSocketWorker.postMessage(cmd);
  1047. webSocketWorker.terminate();
  1048. }
  1049. var isDrag = false;
  1050. myVideo.onkeydown = function (event) {
  1051. ExexuteKeyDown(e.keyCode);
  1052. }
  1053. var level = 2;
  1054. function switchSharpness() {
  1055. var cmd = {
  1056. type: "switchSharpness",
  1057. };
  1058. decodeWoker.postMessage(cmd);//通知解码器worker切换分辨率
  1059. var buffer = makeSharpness(level);
  1060. webSocketWorker.postMessage(buffer);
  1061. if (level < 4) {
  1062. level++;
  1063. } else {
  1064. level = 0;
  1065. }
  1066. }
  1067. window.onbeforeunload = function () {
  1068. wsss.close();
  1069. decodeWoker.postMessage('close');
  1070. decodeWoker.terminate();
  1071. webSocketWorker.terminate();
  1072. }
  1073. </script>
  1074. <script type="text/javascript" src="aac.js"></script>
  1075. </body>
  1076. </html>