WXtrialInterface.html 62 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>双子星云手机</title>
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  7. <meta name="x5-orientation" content="portrait" />
  8. <meta name="screen-orientation" content="portrait" />
  9. <meta name="viewport"
  10. content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,shrink-to-fit=no,viewport-fit=cover" />
  11. <meta name="apple-mobile-web-app-capable" content="yes" />
  12. <!-- 删除苹果默认的工具栏和菜单栏 -->
  13. <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  14. <!-- 设置苹果工具栏颜? -->
  15. <meta name="format-detection" content="telphone=no, email=no" />
  16. <!-- 忽略页面中的数字识别为电话,忽略email识别 -->
  17. <!-- 启用360浏览器的极速模?(webkit) -->
  18. <meta name="renderer" content="webkit" />
  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="../static/lib/weui/1.1.3/style/weui.min.css" />
  36. <link rel="stylesheet" href="../static/lib/jquery-weui/1.2.1/css/jquery-weui.min.css" />
  37. <!-- <link rel="stylesheet" href="../static/lib/swiper/swiper-bundle.min.css" />
  38. <script src="../static/lib/swiper/swiper-bundle.js"></script> -->
  39. <script src="../static/lib/doT-1.1.3/doT.min.js"></script>
  40. <script src="../static/lib/qs.js"></script>
  41. <script src="../static/lib/copy-to-clipboard.js"></script>
  42. </head>
  43. <body class="scroll h-player" style="overscroll-behavior: contain">
  44. <template id="template-phone-size-item">
  45. {{~ it.list :value:index }}
  46. <div class="phone-size-item {{? value.width === it.active.width && value.height === it.active.height }}active{{?}}"
  47. data-id="{{= value.id }}" data-dpi="{{= value.dpi }}" data-width="{{= value.width }}"
  48. data-height="{{= value.height }}">
  49. <span>{{= value.width }}x{{= value.height }}</span>
  50. </div>
  51. {{~}}
  52. </template>
  53. <template id="template-shear">
  54. {{? it.length }}
  55. <div class="title">
  56. 剪贴板
  57. <div class="btn-clear">清空</div>
  58. </div>
  59. <div class="slide-wrapper-content">
  60. {{~ it :item:index }}
  61. <div class="slide-wrapper" data-id="{{= item.id}}">
  62. <div class="slide-scroll animate-slide-start">
  63. <div class="slide-content" data-content="{{= encodeHtml(item.content)}}">
  64. <div>{{= encodeHtml(item.content)}}</div>
  65. </div>
  66. <div class="slide-content-button" data-id="{{= item.id}}">
  67. <button>删除</button>
  68. </div>
  69. </div>
  70. </div>
  71. {{~}}
  72. </div>
  73. {{??}}
  74. <img class="empty" src="img/jianqieban_pic@2x.png" alt="" />
  75. <div class="empty-txt">剪贴板为空</div>
  76. {{?}}
  77. </template>
  78. <div class="container" id="player">
  79. <div class="muted" id="btnMuted">
  80. <div class="control-right-img" data-id="1">
  81. <img src="../static/img/xuanfu_icon.png" />
  82. </div>
  83. </div>
  84. <div id="wine">
  85. <video id="playerVideo" x5-video-orientation="landscape" playsinline="true" autoplay="true"
  86. webkit-playsinline="true" x5-playsinline="true" x5-video-player-type="h5" x5-video-player-fullscreen="false"
  87. style="
  88. pointer-events: none;
  89. object-fit: fill;
  90. width: 100%;
  91. height: 100%;
  92. "></video>
  93. <div id="box"></div>
  94. <audio preload="auto" autoplay controls poster="images/loader-thumb.jpg" id="audioPlayer"
  95. style="position: absolute; top: 0; width: 0; height: 0"></audio>
  96. <div class="count-view" id="countView">
  97. <div class="fnca"><span class="count"></span><div class="line"></div><img class="wh22" src="../static/img/close.png" alt="" onclick="handleclose()"></div>
  98. </div>
  99. </div>
  100. <div class="leftmains">
  101. <div class="PictureQualityMain">
  102. <div class="menu-btn PictureQuality" data-id="4">高清</div>
  103. <div class="menu-btn PictureQuality avit" data-id="3">标清</div>
  104. <div class="menu-btn PictureQuality" data-id="2">极速</div>
  105. </div>
  106. <!-- <div class="open-set-phone-size-dialog-btn-wrap">
  107. <div class="menu-btn" id="open-set-phone-size-dialog-btn">
  108. <span>分辨率</span>
  109. </div>
  110. </div> -->
  111. <div class="operation">
  112. <div class="upload" id="showsuss" data-text="uploads">
  113. <img src="../static/img/wx/shangchuan_icon.png" />
  114. <div>上传</div>
  115. </div>
  116. <div class="upload" onclick="showShearPlate()" data-text="Shearplate">
  117. <img src="../static/img/wx/jianqieban_icon.png" />
  118. <div>剪贴板</div>
  119. </div>
  120. <div class="upload" id="upload" data-text="Signout" onclick="handleQuit()">
  121. <img src="../static/img/wx/tuichu_icon.png" />
  122. <div>退出</div>
  123. </div>
  124. </div>
  125. </div>
  126. <div class="bottommains">
  127. <div class="botmat1">
  128. <div class="botmat1img" data-text="gengduo">
  129. <img src="../static/img/wx/gengduo_icon.png" />
  130. </div>
  131. </div>
  132. <div class="botmat1">
  133. <div class="botmat1img" data-text="home">
  134. <img src="../static/img/wx/home_icon.png" />
  135. </div>
  136. </div>
  137. <div class="botmat1">
  138. <div class="botmat1img" data-text="return">
  139. <img src="../static/img/wx/fanhui_icon.png" />
  140. </div>
  141. </div>
  142. </div>
  143. <img class="loading loading_sceen_pic" />
  144. </div>
  145. <div class="mask">
  146. <div class="box-shear-plate"></div>
  147. <img class="close" onclick="handleClose()" src="img/guanbi_icon@2x.png" alt="" />
  148. </div>
  149. <div class="weui-mask_transparent"></div>
  150. <div class="weui-toast weui_loading_toast weui-toast--visible">
  151. <div class="weui_loading">
  152. <i class="weui-loading weui-icon_toast"></i>
  153. </div>
  154. <p class="weui-toast_content">数据加载中</p>
  155. </div>
  156. <div class="try-use-wrap">
  157. <div class="try-use-container">
  158. <video width="100%" height="100%" id="source" autoplay="autoplay" loop="loop" webkit-playsinline="true"
  159. playsinline="true" x5-video-player-type="h5-page">
  160. 您的浏览器不支持 video 标签。
  161. </video>
  162. <div class="time-close-wrap"><span class="time-node"></span> 关闭</div>
  163. </div>
  164. </div>
  165. <div class="buy-phone-wrap">
  166. <div class="bug-wrap">
  167. <div class="bug-title">获得极致体验服务请购买云手机</div>
  168. <div class="btn-list">
  169. <div class="btn cannel-btn">取消</div>
  170. <div class="btn go-bug">去购买</div>
  171. </div>
  172. </div>
  173. </div>
  174. <div class="look-wrap">
  175. <div class="bug-wrap">
  176. <div class="bug-title">关闭广告会退出云手机是否继续观看</div>
  177. <div class="btn-list">
  178. <div class="btn cannel-btn cannel-ad-btn">放弃</div>
  179. <div class="btn go-bug looking">继续观看</div>
  180. </div>
  181. </div>
  182. </div>
  183. <!-- <body oncontextmenu="Back()"></body> -->
  184. <div id="set-phone-size-dialog" class="dialog">
  185. <div class="dialog-mask"></div>
  186. <!-- 设置分辨率的弹窗 -->
  187. <div class="dialog-content-border">
  188. <div class="dialog-content">
  189. <div class="dialog-header">
  190. <div class="dialog-btn cancel">
  191. <span>取消</span>
  192. </div>
  193. <div class="dialog-btn confirm">
  194. <span>确定</span>
  195. </div>
  196. </div>
  197. <div class="dialog-main">
  198. <div id="phone-size-list"></div>
  199. </div>
  200. </div>
  201. </div>
  202. </div>
  203. <div class="dialog-jifei">
  204. <div class="apply-wrap">
  205. <div class="apply-container">
  206. <div class="apply-title">应用推荐</div>
  207. <div class="apply-list"></div>
  208. <div class="apply-list-change">换一批</div>
  209. <img
  210. class="apply-close"
  211. src="img/close.png"
  212. alt=""
  213. />
  214. </div>
  215. </div>
  216. <div class="time-lang-wrap">
  217. <div class="time-lang-container">
  218. <img class="time-lang-img" src="img/smallBell.png" />
  219. <div class="time-lang-title">本月时长已用完</div>
  220. <div class="time-lang-tip">您可以去购买时长页面进行购买</div>
  221. <div class="time-lang-btn">续时长</div>
  222. </div>
  223. </div>
  224. <div class="countdown-wrap">
  225. <div class="countdown-container">
  226. <img class="countdown-img" src="img/countdown.png" />
  227. <div class="countdown-title">计费规则</div>
  228. <div class="countdown-tip">进入云机开始计时,下线停止计时</div>
  229. <div class="countdown-tip2">云机时长剩余:<span class="countdown-time"></span></div>
  230. <div class="countdown-btn">我知道了</div>
  231. </div>
  232. </div>
  233. <script type="text/html" id="apply">
  234. <div class="apply-item">
  235. <img class="apply-img" src="{{imageUrl}}" />
  236. <div class="apply-row">
  237. <div class="apply-row-title">{{filename}}</div>
  238. <div class="apply-row-down">{{installNum}}</div>
  239. </div>
  240. <div class="apply-down-btn" data-url="{{downloadUrl}}">下载</div>
  241. </div>
  242. </script>
  243. <img class="w100h130" src="../static/img/jishi-icon.png" alt="">
  244. <div class="fs16">计费规则</div>
  245. <div class="fs14">进入云机开始计时,下线停止计时<br />
  246. 云机时长剩余:<span class="count c00DB88"></span></div>
  247. <div class="jishi-close-icon" onclick="handleCloseDialog()">我知道了</div>
  248. </div>
  249. <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
  250. <script src="https://lf1-cdn-tos.bytegoofy.com/goofy/developer/jssdk/jssdk-1.0.3.js"></script>
  251. <script type="text/javascript" src="../static/js/jquery-1.11.0.min.js"></script>
  252. <script type="text/javascript" src="helper.js"></script>
  253. <script type="text/javascript" src="pcm-player.js"></script>
  254. <script type="text/javascript" src="https://cdn.bootcss.com/vConsole/3.2.0/vconsole.min.js"></script>
  255. <script src="../static/lib/jquery-weui/1.2.1/js/jquery-weui.min.js"></script>
  256. <script type="text/javascript" src="jmuxer.js"></script>
  257. <script type="text/javascript" src="spsParser.js"></script>
  258. <script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></script>
  259. <script>
  260. var url = window.location.href;
  261. url = url.split('/');
  262. var baseUrl = url[0] + '//' + url[2];
  263. var parameters = GetRequest();
  264. var token = parameters['token'];
  265. var mealType = parameters['mealType'];
  266. var userCardId = parameters['userCardId'];
  267. var username = parameters['username'];
  268. var videoTimer = null,
  269. videoTime = 0,
  270. adType = 0,
  271. sourceType = isNaN(parameters['sourceType'])
  272. ? 0
  273. : +parameters['sourceType'],
  274. disconnectionFlag = false,
  275. getDate = false;
  276. var isDev =
  277. /^192\.168\./.test(location.host) ||
  278. /^127\.0\.0\.1/.test(location.host) ||
  279. /^localhost/.test(location.host);
  280. if (parameters['mealType'] === 'VIP') {
  281. $('.loading_sceen_pic').attr('src', '../static/img/home_bg_VIP.png');
  282. } else if (parameters['mealType'] === 'SVIP') {
  283. $('.loading_sceen_pic').attr('src', '../static/img/home_bg_SVIP.png');
  284. } else if (parameters['mealType'] === 'STAR') {
  285. $('.loading_sceen_pic').attr('src', '../static/img/home_bg_STAR.png');
  286. } else if (parameters['mealType'] === 'STARPRO') {
  287. $('.loading_sceen_pic').attr('src', '../static/img/home_bg_PRO.png');
  288. }
  289. initAD();
  290. getResidueTime();
  291. let dbName = parameters['username'],
  292. version = 1,
  293. storeName = 'usercard';
  294. let indexedDB = window.indexedDB;
  295. let db, socketURL, cUrl, cardToken, resolvingPower;
  296. const request = indexedDB.open(dbName, version);
  297. request.onsuccess = function (event) {
  298. db = event.target.result; // 数据库对象
  299. console.log('数据库打开成功');
  300. };
  301. request.onerror = function (event) {
  302. console.log('数据库打开报错');
  303. };
  304. request.onupgradeneeded = function (event) {
  305. // 数据库创建或升级的时候会触发
  306. console.log('onupgradeneeded');
  307. db = event.target.result; // 数据库对象
  308. let objectStore;
  309. if (!db.objectStoreNames.contains(storeName)) {
  310. objectStore = db.createObjectStore(storeName, { keyPath: 'id' }); // 创建表
  311. }
  312. };
  313. // 添加数据
  314. function addData(db, storeName, data) {
  315. let request = db
  316. .transaction([storeName], 'readwrite') // 事务对象 指定表格名称和操作模式("只读"或"读写")
  317. .objectStore(storeName) // 仓库对象
  318. .add(data);
  319. request.onsuccess = function (event) {
  320. console.log('数据写入成功');
  321. };
  322. request.onerror = function (event) {
  323. console.log('数据写入失败');
  324. throw new Error(event.target.error);
  325. };
  326. }
  327. // 根据id获取数据
  328. function getDataByKey(db, storeName, key) {
  329. let transaction = db.transaction([storeName]); // 事务
  330. let objectStore = transaction.objectStore(storeName); // 仓库对象
  331. let request = objectStore.get(key);
  332. request.onerror = function (event) {
  333. connect('add');
  334. };
  335. request.onsuccess = function (event) {
  336. console.log('主键查询结果: ', request.result);
  337. if (request.result) {
  338. socketURL = request.result.socketURL;
  339. cUrl = request.result.cUrl;
  340. cardToken = request.result.cardToken;
  341. resolvingPower = request.result.resolvingPower;
  342. window.currentPhoneSize = {
  343. width: request.result.width,
  344. height: request.result.height,
  345. dpi: request.result.dpi,
  346. };
  347. doConnectBusiness();
  348. doConnectDirectives();
  349. } else {
  350. connect('add');
  351. }
  352. };
  353. }
  354. // 根据id修改数
  355. function updateDB(db, storeName, data) {
  356. let request = db
  357. .transaction([storeName], 'readwrite') // 事务对象
  358. .objectStore(storeName) // 仓库对象
  359. .put(data);
  360. request.onsuccess = function () {
  361. console.log('数据更新成功');
  362. };
  363. request.onerror = function () {
  364. console.log('数据更新失败');
  365. };
  366. }
  367. // 由于打开indexDB是异步的加个定时器避免 db对象还没获取到值导致 报错
  368. setTimeout(() => {
  369. getDataByKey(db, storeName, userCardId);
  370. }, 1000);
  371. var isAudioPlay = false;
  372. if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
  373. var video = document.getElementById('playerVideo');
  374. video.play();
  375. setTimeout(() => {
  376. // 抖音环境需要设置延时,不然会有video默认图显示
  377. $.alert({
  378. title: '提示',
  379. text: '开始使用云手机',
  380. onOK: function () {
  381. setTimeout(() => {
  382. isAudioPlay = true;
  383. }, 1000);
  384. },
  385. });
  386. }, 1000);
  387. } else {
  388. $.alert({
  389. title: '提示',
  390. text: '开始使用云手机',
  391. onOK: function () {
  392. var video = document.getElementById('playerVideo');
  393. video.play();
  394. isAudioPlay = true;
  395. },
  396. });
  397. }
  398. //云机倒计时
  399. let validTime = parameters['validTime'] || 10000;
  400. if (validTime > 32000) {
  401. validTime = 32000;
  402. }
  403. let detailTime = validTime * 60 * 1000;
  404. setTimeout(() => {
  405. $('.bug-title').eq(0).text('尊敬的用户您的云手机试用时间已到期');
  406. getDate = true;
  407. $('.buy-phone-wrap').eq(0).show();
  408. }, detailTime);
  409. var topwinHeight = window.screen.height - window.innerHeight + 30; //计算title top 头部
  410. $('#wine').css({
  411. width: window.screen.width,
  412. height: window.screen.height - topwinHeight - 20,
  413. position: 'absolute',
  414. });
  415. $('.loading').css({
  416. width: window.screen.width,
  417. height: window.screen.height - topwinHeight - 20,
  418. });
  419. var winese = document.createElement('wine');
  420. wine.style.top = '-' + winese + 'px';
  421. var isVisuable = true;
  422. var isFeed = true;
  423. var isFinish = false;
  424. var myVideo = document.getElementById('playerVideo');
  425. Module = {};
  426. Module.onRuntimeInitialized = function () {
  427. isFinish = true;
  428. };
  429. var timerInterval = null,
  430. timeInterval = 0;
  431. function connect(type) {
  432. $.ajax({
  433. url: baseUrl + '/api/resources/user/cloud/connect',
  434. type: 'post',
  435. data: JSON.stringify({
  436. userCardId: Number(userCardId),
  437. }),
  438. headers: {
  439. 'content-Type': 'application/json',
  440. Authorization: token,
  441. },
  442. dataType: 'json',
  443. async: false,
  444. success: function (res) {
  445. if (res.status === 0) {
  446. if (timerInterval) {
  447. timerInterval = clearTimeout();
  448. }
  449. if (res.data.internetHttps) {
  450. socketURL =
  451. 'wss://' +
  452. res.data.internetHttps +
  453. '/plugflow?cardIp=' +
  454. res.data.localIp +
  455. '&token=' +
  456. res.data.cardToken +
  457. '&type=business';
  458. cUrl =
  459. 'wss://' +
  460. res.data.internetHttps +
  461. '/businessChannel?cardIp=' +
  462. res.data.localIp +
  463. '&token=' +
  464. res.data.cardToken +
  465. '&type=directives';
  466. cardToken = res.data.cardToken;
  467. resolvingPower = res.data.resolvingPower;
  468. doConnectBusiness();
  469. doConnectDirectives();
  470. if (type === 'add') {
  471. addData(db, storeName, {
  472. id: userCardId,
  473. socketURL: socketURL,
  474. cUrl: cUrl,
  475. cardToken: res.data.cardToken,
  476. resolvingPower: res.data.resolvingPower,
  477. width: res.data.width,
  478. height: res.data.high,
  479. dpi: res.data.dpi,
  480. });
  481. } else {
  482. updateDB(db, storeName, {
  483. id: userCardId,
  484. socketURL: socketURL,
  485. cUrl: cUrl,
  486. cardToken: res.data.cardToken,
  487. resolvingPower: res.data.resolvingPower,
  488. width: res.data.width,
  489. height: res.data.high,
  490. dpi: res.data.dpi,
  491. });
  492. }
  493. const data = window.phoneSizeList.find(function (v) {
  494. return (
  495. v.width === res.data.width &&
  496. v.height === res.data.height &&
  497. v.dpi === res.data.dpi
  498. );
  499. });
  500. window.currentPhoneSize = data || {
  501. width: res.data.width,
  502. height: res.data.height,
  503. dpi: res.data.dpi,
  504. };
  505. } else {
  506. $.toast('网络异常,请稍后重试', 'text');
  507. setTimeout(() => {
  508. clearInterval(intervaler);
  509. quit();
  510. }, 3000);
  511. }
  512. return;
  513. }
  514. if (res.status === 5200) {
  515. if (timeInterval > 7) {
  516. $.toast('网络异常,请稍后重试', 'text');
  517. setTimeout(() => {
  518. clearInterval(intervaler);
  519. quit();
  520. }, 3000);
  521. timerInterval = clearTimeout();
  522. return;
  523. }
  524. timerInterval = setTimeout(() => {
  525. connect(type);
  526. timeInterval += 1;
  527. }, 3000);
  528. return;
  529. }
  530. if (res.status === 5220) {
  531. $.toast('云手机正在一键修复中', 'text');
  532. setTimeout(() => {
  533. quit();
  534. }, 3000);
  535. return;
  536. }
  537. $.toast('画面异常,请重新进入', 'text');
  538. setTimeout(() => {
  539. clearInterval(intervaler);
  540. quit();
  541. }, 3000);
  542. },
  543. });
  544. }
  545. var jmuxer = new JMuxer({
  546. node: 'playerVideo',
  547. flushingTime: 33,
  548. fps: 30,
  549. mode: 'video',
  550. debug: false,
  551. });
  552. window.onload = function () {
  553. var myPlay = document.getElementById('wine');
  554. myPlay.onkeydown = function (event) {
  555. ExexuteKeyDown(e.keyCode);
  556. };
  557. };
  558. var ws,
  559. errorTime = 0;
  560. // 节流
  561. // 设置一个标志
  562. function throttle(fn, delay) {
  563. let flag = true;
  564. return () => {
  565. if (!flag) return;
  566. flag = false;
  567. errorTime += delay;
  568. timer = setTimeout(() => {
  569. fn();
  570. flag = true;
  571. }, delay);
  572. };
  573. }
  574. var intervaler;
  575. function doConnectBusiness() {
  576. ws = new WebSocket(socketURL);
  577. ws.binaryType = 'arraybuffer';
  578. intervaler = setInterval(() => {
  579. if (ws.readyState === 1) {
  580. ws.send('ping');
  581. } else {
  582. $.toast('画面异常,请重新进入', 'text');
  583. setTimeout(() => {
  584. clearInterval(intervaler);
  585. quit();
  586. }, 3000);
  587. }
  588. }, 3000);
  589. ws.addEventListener('open', function (event) {
  590. // sn只要长度满足17位随机数,不需要从后台获取
  591. var verifyBuffer = VerifyCode('RK3923C1201900139', cardToken);
  592. console.log('鉴权报文:' + PrintArry(verifyBuffer));
  593. ws.send(verifyBuffer);
  594. errorTime = 0;
  595. });
  596. ws.addEventListener('close', function (event) {
  597. if (event.code === 1006) {
  598. clearInterval(intervaler);
  599. throttle(doConnectBusiness, 100);
  600. if (errorTime > 1000) {
  601. $.toast('画面异常,请重新进入', 'text');
  602. setTimeout(() => {
  603. wsss.close();
  604. quit();
  605. }, 3000);
  606. }
  607. }
  608. });
  609. ws.addEventListener('error', function (event) {
  610. ws.close(1006);
  611. });
  612. ws.addEventListener('message', function (event) {
  613. var data = ParseProto(event.data); //JAVA服务器转发
  614. if (isAudioPlay) {
  615. $('.weui-mask_transparent').hide();
  616. $('.weui-toast').hide();
  617. $('.loading').hide();
  618. }
  619. var input = new Uint8Array(event.data);
  620. if (data.audio != null && isAudioPlay) {
  621. //喂音频
  622. if (input[0] == 0xff) {
  623. if (isFinish) {
  624. decodeAAC(input);
  625. }
  626. }
  627. }
  628. if (
  629. data.frameType != undefined &&
  630. data.frameType != 1 &&
  631. data.frameType != 6
  632. ) {
  633. if (data.frameType == 7) {
  634. let info = spsParser(data.video);
  635. if (
  636. info.width != myVideo.videoWidth &&
  637. info.height != myVideo.videoHeight
  638. ) {
  639. if (myVideo.videoWidth == 0) {
  640. console.log(
  641. 'SPS计算得到宽 %d, 高 %d, 控件宽 %d, %d',
  642. info.width,
  643. info.height,
  644. myVideo.videoWidth,
  645. myVideo.videoHeight,
  646. );
  647. }
  648. }
  649. }
  650. }
  651. if (data.video != null) {
  652. //喂视频
  653. if (data.frameType == 0x05 && isVisuable) {
  654. isFeed = true;
  655. }
  656. if (data.frameType == 7 || data.frameType == 8) {
  657. isFeed = true;
  658. isAudioPlay = true;
  659. }
  660. if (isFeed) {
  661. jmuxer.feed(data);
  662. }
  663. }
  664. });
  665. }
  666. /*var hidden, visibilityChange;
  667. if (typeof document.hidden !== 'undefined') {
  668. // Opera 12.10 and Firefox 18 and later support
  669. hidden = 'hidden';
  670. visibilityChange = 'visibilitychange';
  671. } else if (typeof document.msHidden !== 'undefined') {
  672. hidden = 'msHidden';
  673. visibilityChange = 'msvisibilitychange';
  674. } else if (typeof document.webkitHidden !== 'undefined') {
  675. hidden = 'webkitHidden';
  676. visibilityChange = 'webkitvisibilitychange';
  677. }
  678. // 处理页面可见属性的改变
  679. document.addEventListener(
  680. 'visibilitychange',
  681. function () {
  682. if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
  683. visibilitychange();
  684. } else if (window.__wxjs_environment === 'miniprogram') {
  685. visibilitychange();
  686. } else {
  687. if (document[hidden]) {
  688. ws.close();
  689. wsss.close();
  690. uni.webView.navigateBack({
  691. delta: 1,
  692. });
  693. }
  694. }
  695. },
  696. false,
  697. );
  698. function visibilitychange() {
  699. if (document.visibilityState == 'visible') {
  700. var buffer = RequestIFrame();
  701. ws.send(buffer);
  702. isVisuable = true;
  703. } else {
  704. isVisuable = false;
  705. isFeed = false;
  706. myVideo.pause();
  707. }
  708. }*/
  709. myVideo.addEventListener('pause', function () {
  710. isFeed = false;
  711. });
  712. var decodeCount = 1;
  713. var player = new PCMPlayer({
  714. encoding: '16bitInt',
  715. channels: 2,
  716. sampleRate: 44100,
  717. flushingTime: 22,
  718. debug: false,
  719. });
  720. function handleClose() {
  721. $('.mask').hide();
  722. }
  723. function decodeAAC(data) {
  724. var retPtr = Module._malloc(4 * 5 * 1024); // 接收的数据
  725. var inputPtr = Module._malloc(4 * data.length); // 输入数据
  726. for (var i = 0; i < data.length; i++) {
  727. Module.HEAPU8[inputPtr + i] = data[i]; //转换为堆数据
  728. }
  729. var pcmLen = Module._feedData(retPtr, inputPtr, data.length);
  730. if (pcmLen >= 0) {
  731. var pcmData = new Uint8Array(pcmLen);
  732. for (var i = 0; i < pcmLen; i++) {
  733. pcmData[i] = Module.HEAPU8[retPtr + i];
  734. }
  735. player.feed(pcmData);
  736. }
  737. decodeCount++;
  738. Module._free(inputPtr);
  739. Module._free(retPtr);
  740. }
  741. //解协议
  742. function ParseProto(data) {
  743. var input = new Uint8Array(data),
  744. duration,
  745. video,
  746. frameType,
  747. audio;
  748. if (input[0] == 0 && input[1] == 0 && input[2] == 0 && input[3] == 1) {
  749. video = input;
  750. duration = 24;
  751. var nalType = input[4] & 0x1f;
  752. frameType = nalType;
  753. if (!isFeed) {
  754. if (nalType == 0x05 && isVisuable) {
  755. isFeed = true;
  756. }
  757. }
  758. } else if (input[0] == 0xff) {
  759. audio = input;
  760. duration = 24;
  761. } else if (input[0] == 0x68) {
  762. if (input[23] == 0x5c) {
  763. console.log('收到消息:' + PrintArry(input));
  764. if (CheckVerifyCode(input)) {
  765. ws.send(ConfigChannel('RK3923C1201900139'));
  766. var checkBuffer = GetScreenState();
  767. ws.send(checkBuffer);
  768. } else {
  769. connect('update');
  770. }
  771. }
  772. if (input[23] == 0x05) {
  773. if (input[28] == 0x01 && input[29] == 0x01) {
  774. //横竖屏标识
  775. var state = CheckScreenDirection(input.slice(24, 24 + 8));
  776. if (state == 1) {
  777. console.log('安卓卡此时竖屏');
  778. //竖屏处理
  779. resolving = 1;
  780. } else {
  781. console.log('安卓卡此时横屏');
  782. //横屏处理
  783. resolving = 0;
  784. }
  785. }
  786. // window.phoneSizeList = window.phoneSizeListBack.map(function (
  787. // item,
  788. // ) {
  789. // return resolving
  790. // ? item
  791. // : Object.assign({}, item, {
  792. // width: item.height,
  793. // height: item.width,
  794. // });
  795. // });
  796. // wsss.send(
  797. // JSON.stringify({
  798. // type: 'getPhoneSize',
  799. // }),
  800. // );
  801. // 横竖屏变更时获取分辨率要延迟,不然会获取到变更前的分辨率
  802. // setTimeout(function () {
  803. // wsss.send(
  804. // JSON.stringify({
  805. // type: 'getPhoneSize',
  806. // }),
  807. // );
  808. // }, 500);
  809. }
  810. if (input[23] == 0x0b) {
  811. //多端登录处理, 数据从索引24开始取, input 是接收到的原始数据
  812. var jsonobj = checkMultiLoginInfo(input);
  813. }
  814. }
  815. return {
  816. audio: audio,
  817. video: video,
  818. duration: duration,
  819. frameType: frameType,
  820. };
  821. }
  822. function GetRequest() {
  823. var url = location.search; // 获取url中"?"符后的字串
  824. var obj = new Object();
  825. if (url.indexOf('?') != -1) {
  826. var str = url.substr(1);
  827. strs = str.split('&');
  828. for (var i = 0; i < strs.length; i++) {
  829. obj[strs[i].split('=')[0]] = strs[i].split('=')[1];
  830. }
  831. }
  832. return obj;
  833. }
  834. function Back() {
  835. ExexuteKeyDown(4);
  836. window.event.returnValue = false;
  837. return false;
  838. }
  839. function array_unique(arr) {
  840. return arr.filter(function (e, i) {
  841. return arr.indexOf(e) === i;
  842. });
  843. }
  844. var cutList = [];
  845. let timer,
  846. isFlag = true;
  847. const shearTemplate = doT.template(
  848. $('#template-shear').html().replace(/&amp;/g, '&'),
  849. );
  850. function updateShearHtml(list) {
  851. $('.box-shear-plate').html(shearTemplate(list));
  852. }
  853. // 对字符串进行html转义
  854. function encodeHtml(content) {
  855. return [
  856. ['<', '&lt;'],
  857. ['>', '&gt;'],
  858. ['&', '&amp;'],
  859. ['"', '&quot;'],
  860. ].reduce(function (previousValue, currentValue) {
  861. return previousValue.replace(
  862. new RegExp(currentValue[0], 'g'),
  863. currentValue[1],
  864. );
  865. }, content);
  866. }
  867. $('.box-shear-plate').on('click', '.slide-content', function (e) {
  868. handleCopy(e.currentTarget.dataset.content);
  869. });
  870. $('.box-shear-plate').on('click', '.btn-clear', function (e) {
  871. handleClear();
  872. });
  873. $('.box-shear-plate').on('click', '.slide-content-button', function (e) {
  874. handleDelete(e.currentTarget.dataset.id);
  875. });
  876. function showShearPlate() {
  877. if (!isControl) {
  878. return;
  879. }
  880. stopManyClick(function () {
  881. new Promise((resolve, reject) => {
  882. if (window.navigator.clipboard) {
  883. window.navigator.clipboard
  884. .readText()
  885. .then(
  886. function (content) {
  887. return $.ajax({
  888. url: baseUrl + '/api/public/v5/shear/content',
  889. type: 'post',
  890. dataType: 'json',
  891. data: JSON.stringify({
  892. content: content,
  893. }),
  894. headers: {
  895. 'content-Type': 'application/json',
  896. Authorization: token,
  897. },
  898. });
  899. },
  900. function (err) {
  901. $.toast('读取剪贴板失败', 'text');
  902. },
  903. )
  904. .finally(resolve);
  905. } else {
  906. resolve();
  907. }
  908. }).then(function () {
  909. $('.box-shear-plate').empty();
  910. return $.ajax({
  911. url: baseUrl + '/api/public/v5/shear/content',
  912. headers: {
  913. Authorization: token,
  914. },
  915. type: 'get',
  916. dataType: 'json',
  917. success: function (res) {
  918. updateShearHtml(res.status === 0 ? res.data : []);
  919. $('.mask').show();
  920. initSlider();
  921. },
  922. });
  923. });
  924. });
  925. }
  926. //防止提示一秒内重复显示
  927. function stopManyClick(fn) {
  928. if (isFlag) {
  929. fn();
  930. }
  931. isFlag = false;
  932. if (timer) {
  933. clearTimeout(timer);
  934. }
  935. timer = setTimeout(() => {
  936. isFlag = true;
  937. }, 1500);
  938. }
  939. // 清空剪贴板
  940. function handleClear() {
  941. // var ids = '';
  942. // cutList.forEach(function (item) {
  943. // ids += 'ids=' + item.id + '&';
  944. // });
  945. // ids = ids.substring(0, ids.lastIndexOf('&'));
  946. $.confirm('确定清空剪贴板?', function () {
  947. $.ajax({
  948. url:
  949. baseUrl +
  950. '/api/public/v5/shear/content' +
  951. Qs.stringify(
  952. {
  953. ids: Array.from($('.slide-wrapper')).map((v) => v.dataset.id),
  954. },
  955. { arrayFormat: 'repeat', addQueryPrefix: true },
  956. ),
  957. headers: {
  958. Authorization: token,
  959. },
  960. type: 'DELETE',
  961. dataType: 'json',
  962. success: function (res) {
  963. if (res.status === 0) {
  964. showShearPlate();
  965. } else {
  966. $.toast(res.msg, 'text');
  967. }
  968. },
  969. });
  970. });
  971. }
  972. function handleCopy(content) {
  973. var cutting = {
  974. type: 'cutting',
  975. data: {
  976. str: content,
  977. },
  978. };
  979. wsss.send(JSON.stringify(cutting));
  980. }
  981. // 删除剪贴板
  982. function handleDelete(id) {
  983. $.ajax({
  984. url: baseUrl + '/api/public/v5/shear/content?ids=' + id,
  985. headers: {
  986. Authorization: token,
  987. },
  988. type: 'DELETE',
  989. dataType: 'json',
  990. success: function (res) {
  991. if (res.status === 0) {
  992. showShearPlate();
  993. } else {
  994. $.toast(res.msg, 'text');
  995. }
  996. },
  997. });
  998. }
  999. function initSlider() {
  1000. //手指滑动多少距离就认为是滑成功
  1001. //这个值不能太大,否则影响斜着滑动时,垂直滑动的流畅性,也不能太小,太灵敏也不好
  1002. var diffXDistance = 50;
  1003. //当前滑动的对象
  1004. var currentObject;
  1005. //上一次滑动的对象
  1006. var lastObject;
  1007. //是否可以左右滑动,在上下滑的时候禁止左右滑
  1008. var canSlide = true;
  1009. //用于记录按下的点
  1010. var startPoint;
  1011. $('.slide-content').css({
  1012. width: $('.slide-wrapper').width(),
  1013. });
  1014. document.body.removeEventListener(
  1015. 'touchmove',
  1016. function (e) {
  1017. e.preventDefault();
  1018. },
  1019. {
  1020. passive: false,
  1021. },
  1022. );
  1023. $('.slide-scroll')
  1024. .css({
  1025. width:
  1026. $('.slide-wrapper').width() + $('.slide-content-button').width(),
  1027. })
  1028. .on('touchstart', function (e) {
  1029. currentObject = this;
  1030. startPoint = {
  1031. x: e.originalEvent.changedTouches[0].pageX,
  1032. y: e.originalEvent.changedTouches[0].pageY,
  1033. };
  1034. })
  1035. .on('touchmove', function (e) {
  1036. //如果是左右滑动,就禁止上下的滑动
  1037. //如果是上下的滑动,就禁止左右滑动
  1038. if (
  1039. Math.abs(e.originalEvent.changedTouches[0].pageX - startPoint.x) >
  1040. Math.abs(e.originalEvent.changedTouches[0].pageY - startPoint.y)
  1041. ) {
  1042. event.preventDefault();
  1043. } else {
  1044. canSlide = false;
  1045. }
  1046. })
  1047. .on('touchend', function (e) {
  1048. //如果是上下滑动,这里就直接返回了
  1049. if (!canSlide) {
  1050. canSlide = true;
  1051. return true;
  1052. }
  1053. //点击除当前左滑对象之外的任意其他位置
  1054. if (lastObject && currentObject != lastObject) {
  1055. //右滑→
  1056. $(lastObject).removeClass('animate-slide');
  1057. //清空上一个左滑的对象
  1058. lastObject = undefined;
  1059. }
  1060. var diffX = e.originalEvent.changedTouches[0].pageX - startPoint.x;
  1061. if (diffX < -diffXDistance) {
  1062. //左滑←
  1063. $(currentObject).addClass('animate-slide');
  1064. if (lastObject && lastObject != currentObject) {
  1065. //右滑→
  1066. $(lastObject).removeClass('animate-slide');
  1067. }
  1068. //记录上一个左滑的对象
  1069. lastObject = currentObject;
  1070. } else if (diffX >= diffXDistance) {
  1071. if (currentObject == lastObject) {
  1072. //右滑→
  1073. $(currentObject).removeClass('animate-slide');
  1074. //清空上一个左滑的对象
  1075. lastObject = undefined;
  1076. }
  1077. }
  1078. });
  1079. }
  1080. $('#wine').on('click', function (e) {
  1081. console.log('🚀 ~ file: WXdraw.js ~ line 4 ~ e', e);
  1082. $('.control-right-img').attr({
  1083. 'data-id': '1',
  1084. });
  1085. $('.leftmains').css({
  1086. right: '-4rem',
  1087. });
  1088. });
  1089. var btnMuted = document.querySelector('#btnMuted');
  1090. btnMuted &&
  1091. (function () {
  1092. var setHistory = function (left, top) {
  1093. try {
  1094. localStorage.setItem(
  1095. 'muted-btn-loc',
  1096. JSON.stringify({
  1097. left: left,
  1098. top: top,
  1099. }),
  1100. );
  1101. } catch (ex) { }
  1102. };
  1103. var getHistory = function () {
  1104. try {
  1105. var value = localStorage.getItem('muted-btn-loc');
  1106. if (!value) return null;
  1107. value = JSON.parse(value);
  1108. if (!value) return null;
  1109. return value;
  1110. } catch (ex) {
  1111. return null;
  1112. }
  1113. };
  1114. var fixLoc = function (loc) {
  1115. var rect = btnMuted.getBoundingClientRect();
  1116. rect = {
  1117. top: rect.top,
  1118. left: rect.left,
  1119. width: rect.width,
  1120. height: rect.height,
  1121. }; //部分低版本浏览器,该属性为只读
  1122. if (loc) {
  1123. rect.left = loc.left;
  1124. rect.top = loc.top;
  1125. }
  1126. var minX = 0;
  1127. var minY = 0;
  1128. var docRect = document.documentElement.getBoundingClientRect();
  1129. var maxY = docRect.height - rect.height;
  1130. var maxX = docRect.width - rect.width;
  1131. var left = rect.left;
  1132. var top = rect.top;
  1133. left = Math.min(left, maxX);
  1134. left = Math.max(left, minX);
  1135. top = Math.min(top, maxY);
  1136. top = Math.max(top, minY);
  1137. if (loc || top !== rect.top || left !== rect.left) {
  1138. btnMuted.style.cssText +=
  1139. 'left:' + left + 'px;top:' + top + 'px;';
  1140. }
  1141. };
  1142. window.addEventListener('resize', function () {
  1143. fixLoc();
  1144. });
  1145. var touchPoint = {
  1146. pageY: 0,
  1147. pageX: 0,
  1148. };
  1149. var currentLoc = {
  1150. top: 0,
  1151. left: 0,
  1152. curTop: 0,
  1153. curLeft: 0,
  1154. };
  1155. var toMove = false;
  1156. var touchmove = function (e) {
  1157. e.preventDefault();
  1158. var point = e.changedTouches[0];
  1159. var top = -touchPoint.pageY + point.pageY;
  1160. var left = -touchPoint.pageX + point.pageX;
  1161. if (toMove) {
  1162. top += currentLoc.top;
  1163. left += currentLoc.left;
  1164. currentLoc.curLeft = left;
  1165. currentLoc.curTop = top;
  1166. btnMuted.style.cssText +=
  1167. 'left:' + left + 'px;top:' + top + 'px;';
  1168. } else {
  1169. if (Math.abs(top) >= 5 || Math.abs(left) >= 5) {
  1170. toMove = true;
  1171. }
  1172. }
  1173. };
  1174. var touchend = function () {
  1175. window.removeEventListener('touchmove', touchmove, {
  1176. passive: false,
  1177. });
  1178. window.removeEventListener('touchend', touchend, {
  1179. passive: false,
  1180. });
  1181. if (toMove) {
  1182. setHistory(currentLoc.curLeft, currentLoc.curTop);
  1183. fixLoc();
  1184. } else {
  1185. //按点击处理
  1186. var set = $('.control-right-img').attr('data-id');
  1187. if (set == '1') {
  1188. $('.control-right-img').attr({
  1189. 'data-id': '2',
  1190. });
  1191. $('.leftmains').css({
  1192. right: '0rem',
  1193. });
  1194. } else {
  1195. $('.control-right-img').attr({
  1196. 'data-id': '1',
  1197. });
  1198. $('.leftmains').css({
  1199. right: '-4rem',
  1200. });
  1201. }
  1202. }
  1203. };
  1204. btnMuted.addEventListener(
  1205. 'touchstart',
  1206. function (e) {
  1207. e.preventDefault();
  1208. toMove = false;
  1209. var point = e.changedTouches[0];
  1210. touchPoint.pageX = point.pageX;
  1211. touchPoint.pageY = point.pageY;
  1212. var rect = e.target.getBoundingClientRect();
  1213. currentLoc.top = rect.top;
  1214. currentLoc.left = rect.left;
  1215. window.addEventListener('touchmove', touchmove, {
  1216. passive: false,
  1217. });
  1218. window.addEventListener('touchend', touchend, {
  1219. passive: false,
  1220. });
  1221. },
  1222. {
  1223. passive: false,
  1224. },
  1225. );
  1226. var history = getHistory();
  1227. if (history) {
  1228. fixLoc(history);
  1229. }
  1230. btnMuted.classList.remove('hide');
  1231. })();
  1232. // 激活码广告相关配置
  1233. function getConfigByPhoneType() {
  1234. return new Promise((resolve, reject) => {
  1235. $.ajax({
  1236. url: baseUrl + '/api/pay/v5/trialCodeConfig/getConfigByPhoneType',
  1237. headers: {
  1238. Authorization: token,
  1239. },
  1240. data: {
  1241. userCardId: userCardId,
  1242. phoneType: mealType,
  1243. },
  1244. type: 'get',
  1245. dataType: 'json',
  1246. success: function (res) {
  1247. let obj = res.data;
  1248. if (res.status === 0) {
  1249. resolve(obj);
  1250. } else {
  1251. $.toast(res.msg, 'text');
  1252. }
  1253. },
  1254. });
  1255. });
  1256. }
  1257. //列表
  1258. function getSetmealList() {
  1259. return new Promise((resolve, reject) => {
  1260. $.ajax({
  1261. url: baseUrl + '/api/resources/v4/freetrial/setmeal/list',
  1262. headers: {
  1263. Authorization: token,
  1264. },
  1265. type: 'get',
  1266. dataType: 'json',
  1267. success: function (res) {
  1268. if (res.status === 0) {
  1269. let list = res.data;
  1270. list.map((item) => {
  1271. if (item.phoneType === parameters['mealType']) {
  1272. resolve(item);
  1273. }
  1274. });
  1275. } else {
  1276. $.toast(res.msg, 'text');
  1277. }
  1278. },
  1279. });
  1280. });
  1281. }
  1282. var residueTimer = null;
  1283. // 获取云机剩余时长
  1284. function getResidueTime() {
  1285. let value = localStorage.getItem('isShowRecommend');
  1286. if(value) {
  1287. return
  1288. }
  1289. return $.ajax({
  1290. url: baseUrl + `/api/resources/yearMember/getResidueTime?userCardId=${userCardId}`,
  1291. headers: {
  1292. Authorization: token,
  1293. },
  1294. type: 'get',
  1295. dataType: 'json',
  1296. contentType: 'application/json;charset=UTF-8',
  1297. }).then(function (res) {
  1298. if (res.status === 0) {
  1299. let time = res.data;
  1300. $('.countdown-wrap').eq(0).show();
  1301. residueTimer = setInterval(() => {
  1302. time--;
  1303. if(time < 0) {
  1304. $('.apply-wrap').eq(0).hide();
  1305. $('.countdown-wrap').eq(0).hide();
  1306. $('.time-lang-wrap').eq(0).show();
  1307. }
  1308. showTime = getResultTime(time);
  1309. $('.countdown-time').eq(0).text(showTime);
  1310. }, 1000)
  1311. } else {
  1312. return Promise.reject(new Error(res.msg));
  1313. }
  1314. });
  1315. }
  1316. // 秒转化为时分秒
  1317. function getResultTime(time) {
  1318. let theTime = parseInt(time);// 秒
  1319. let theTime1 = 0;// 分
  1320. let theTime2 = 0;// 小时
  1321. if(theTime > 60) {
  1322. theTime1 = parseInt(theTime/60);
  1323. theTime = parseInt(theTime%60);
  1324. if(theTime1 > 60) {
  1325. theTime2 = parseInt(theTime1/60);
  1326. theTime1 = parseInt(theTime1%60);
  1327. }
  1328. }
  1329. let result = '' + parseInt(theTime);
  1330. if(theTime1 > 0) {
  1331. result = '' + parseInt(theTime1) + ':' + result;
  1332. }
  1333. if(theTime2 > 0) {
  1334. result = '' + parseInt(theTime2) + ':' + result;
  1335. }
  1336. return result;
  1337. }
  1338. // 推荐列表
  1339. function getRecommend() {
  1340. return $.ajax({
  1341. url: baseUrl + `/api/public/v1/market/get/recommend?userCardId=${userCardId}`,
  1342. headers: {
  1343. Authorization: token,
  1344. },
  1345. type: 'get',
  1346. dataType: 'json',
  1347. contentType: 'application/json;charset=UTF-8',
  1348. }).then(function (res) {
  1349. if (res.status === 0) {
  1350. $('.apply-wrap').eq(0).show();
  1351. let list = res.data;
  1352. let result = '';
  1353. list.map(item => {
  1354. item.installNum = `有${item.installNum}人下载`
  1355. result += $('#apply').text().replace(/{{(.*?)}}/g, function(node, key) {
  1356. return item[key];
  1357. })
  1358. })
  1359. $('.apply-list').eq(0).append(result)
  1360. } else {
  1361. return Promise.reject(new Error(res.msg));
  1362. }
  1363. });
  1364. }
  1365. //点击了换一批
  1366. $('.apply-list-change')[0].addEventListener('click',() => {
  1367. $('.apply-list').eq(0).empty();
  1368. getRecommend();
  1369. })
  1370. //点击了关闭按钮
  1371. $('.apply-close')[0].addEventListener('click',() => {
  1372. localStorage.setItem('isShowRecommend', true);
  1373. $('.apply-wrap').eq(0).hide();
  1374. })
  1375. // 点击下载按钮
  1376. $('.apply-wrap')[0].addEventListener('click',(e)=>{
  1377. let downloadUrl = e.target.dataset.url;
  1378. let className = e.target.className;
  1379. if(className === 'apply-down-btn'){
  1380. window.location.href = downloadUrl;
  1381. }
  1382. })
  1383. // 点击了我知道了
  1384. $('.countdown-btn')[0].addEventListener('click',() => {
  1385. $('.countdown-wrap').eq(0).hide();
  1386. clearInterval(residueTimer);
  1387. getRecommend();
  1388. })
  1389. // 点击了续时长
  1390. $('.time-lang-btn')[0].addEventListener('click',() => {
  1391. $('.time-lang-wrap').eq(0).hide();
  1392. if (window.__wxjs_environment === 'miniprogram') {
  1393. wx.miniProgram.navigateTo({
  1394. url:`/packageA/order/renew/index?record=` + userCardId
  1395. });
  1396. } else {
  1397. uni.webView.navigateTo({
  1398. url: '/pages/order/renew?record=' + userCardId
  1399. })
  1400. }
  1401. })
  1402. //广告信息
  1403. var adData = null; // 广告数据
  1404. var adLastTime = 0; // 广告时间
  1405. var intervalTime = 0; // 间隔时间
  1406. // let adType = 0;
  1407. console.log(
  1408. '🚀 ~ file: WXtrialInterface.html ~ line 973 ~ sourceType',
  1409. sourceType,
  1410. );
  1411. // 拉取广告数据
  1412. function getAD() {
  1413. return $.ajax({
  1414. url: baseUrl + '/api/public/v5/advertising/getAdInfoByAdPlace',
  1415. headers: {
  1416. Authorization: token,
  1417. },
  1418. data: JSON.stringify({
  1419. adPlace: adType,
  1420. os: 0,
  1421. }),
  1422. type: 'POST',
  1423. dataType: 'json',
  1424. contentType: 'application/json;charset=UTF-8',
  1425. }).then(function (res) {
  1426. if (res.status === 0) {
  1427. var list = res.data.filter(
  1428. (v) => v.adType === 1 && !!v.adVideoBase.videoUrl,
  1429. );
  1430. adData = list[Math.floor(Math.random() * list.length)];
  1431. console.log(
  1432. '🚀 ~ file: WXtrialInterface.html ~ line 990 ~ getAD ~ adData',
  1433. adData,
  1434. );
  1435. return adData;
  1436. } else {
  1437. return Promise.reject(new Error(res.msg));
  1438. }
  1439. });
  1440. }
  1441. // 播放广告
  1442. function playAD() {
  1443. var nowTime = Date.now();
  1444. if (
  1445. adData &&
  1446. // [1, 2].includes(sourceType) &&
  1447. $('.try-use-wrap').eq(0).is(':hidden') &&
  1448. nowTime > adLastTime + intervalTime
  1449. ) {
  1450. $('#source').attr('src', adData.adVideoBase.videoUrl);
  1451. $('.try-use-wrap').eq(0).show();
  1452. $('#source')[0].play();
  1453. videoTime = adData.forcedTime;
  1454. adData = null;
  1455. adLastTime = nowTime;
  1456. videoTimer = setInterval(() => {
  1457. if (videoTime > 0) {
  1458. videoTime--;
  1459. $('.time-node')
  1460. .eq(0)
  1461. .text(videoTime + 's');
  1462. } else {
  1463. clearInterval(videoTimer);
  1464. $('.time-node').eq(0).text('');
  1465. }
  1466. }, 1000);
  1467. if (intervalTime > 0) {
  1468. // 间隔广告拉取下一次广告数据
  1469. adType = 16;
  1470. getAD();
  1471. }
  1472. if (adType === 16 && sourceType == 1) {
  1473. // 间隔广告和试用才上报
  1474. report(0);
  1475. }
  1476. }
  1477. }
  1478. /**
  1479. * 初始化广告
  1480. * 因移动端video无法自动播放,play()方法不能异步调用。
  1481. * 解决方案,初始化时预先请求广告数据,在用户对云手机touchmove事件中去播放广告并请求下一次广告数据。
  1482. */
  1483. function initAD() {
  1484. console.log(
  1485. '🚀 ~ file: WXtrialInterface.html ~ line 1052 ~ initAD ~ sourceType',
  1486. sourceType,
  1487. );
  1488. (function () {
  1489. switch (sourceType) {
  1490. case 1: {
  1491. return getSetmealList().then(function (res) {
  1492. intervalTime =
  1493. res.intervalSwitch === 1
  1494. ? res.intervalAdvertDuration * 1000 * 60
  1495. : 0;
  1496. if (res.pushFlowAdvert === 1) {
  1497. adType = 15;
  1498. adTime = 0;
  1499. } else if (intervalTime > 0) {
  1500. adType = 16;
  1501. adTime = date.now();
  1502. }
  1503. });
  1504. }
  1505. case 2: {
  1506. return getConfigByPhoneType().then(function (res) {
  1507. if (res.isDisconnectionTime === 1) {
  1508. var time = res.disconnectionTime * 60 * 1000;
  1509. setTimeout(() => {
  1510. disconnectionFlag = true;
  1511. $('.buy-phone-wrap').eq(0).show();
  1512. }, time);
  1513. }
  1514. intervalTime =
  1515. res.isIntervalPlayAd === 1
  1516. ? res.intervalPlayAdTime * 1000 * 60
  1517. : 0;
  1518. if (res.isShowAd === 1) {
  1519. adType = 15;
  1520. adTime = 0;
  1521. } else if (intervalTime > 0) {
  1522. adType = 16;
  1523. adTime = date.now();
  1524. }
  1525. });
  1526. }
  1527. default: {
  1528. return Promise.reject();
  1529. }
  1530. }
  1531. })().then(function () {
  1532. console.log(adType);
  1533. this.$('#wine').on('touchstart', playAD);
  1534. getAD();
  1535. });
  1536. }
  1537. // 观看广告次数上报
  1538. function reportFrequency() {
  1539. $.ajax({
  1540. url: baseUrl + '/api/resoures/v1/trial/reportFrequency/' + userCardId,
  1541. headers: {
  1542. Authorization: token,
  1543. },
  1544. type: 'post',
  1545. contentType: 'application/json',
  1546. dataType: 'json',
  1547. success: function (res) { },
  1548. });
  1549. }
  1550. //广告信息
  1551. // function adInit() {
  1552. // sourceType = parameters['sourceType'];
  1553. // if (sourceType == 1) {
  1554. // getSetmealList().then((res) => {
  1555. // if (res.pushFlowAdvert === 1) {
  1556. // getAdList(15);
  1557. // }
  1558. // if (res.intervalSwitch === 1) {
  1559. // let time = res.intervalAdvertDuration * 60 * 1000;
  1560. // setInterval(() => {
  1561. // $('.try-use-wrap').eq(0).hide();
  1562. // getAdList(16);
  1563. // }, time);
  1564. // }
  1565. // })
  1566. // } else if (sourceType == 2) {
  1567. // getConfigByPhoneType().then((res) => {
  1568. // if (res.isDisconnectionTime === 1) {
  1569. // let time = res.disconnectionTime * 60 * 1000;
  1570. // setTimeout(() => {
  1571. // disconnectionFlag = true;
  1572. // $('.buy-phone-wrap').eq(0).show();
  1573. // }, time);
  1574. // }
  1575. // if (res.isShowAd === 1) {
  1576. // getAdList(15);
  1577. // }
  1578. // if (res.isIntervalPlayAd === 1) {
  1579. // let time = res.intervalPlayAdTime * 60 * 1000;
  1580. // setInterval(() => {
  1581. // $('.try-use-wrap').eq(0).hide();
  1582. // getAdList(16);
  1583. // }, time);
  1584. // }
  1585. // })
  1586. // }
  1587. // }
  1588. // 广告接口
  1589. // function getAdList(type) {
  1590. // adType = type;
  1591. // $.ajax({
  1592. // url: baseUrl + '/api/public/v5/advertising/getAdInfoByAdPlace',
  1593. // headers: {
  1594. // Authorization: form.token,
  1595. // },
  1596. // data: JSON.stringify({
  1597. // adPlace: type,
  1598. // os: 0,
  1599. // }),
  1600. // type: 'POST',
  1601. // dataType: 'json',
  1602. // contentType: 'application/json;charset=UTF-8',
  1603. // success: function (res) {
  1604. // if (res.status === 0) {
  1605. // let list = res.data;
  1606. // let indexs = Math.floor(Math.random() * list.length);
  1607. // videoTime = list[indexs].forcedTime;
  1608. // // $('#source').src = list[0].adVideoBase.videoUrl;
  1609. // $('#source').attr('src', list[indexs].adVideoBase.videoUrl); //更新url
  1610. // $('#source').attr('autoplay', 'true'); //直接播放
  1611. // videoTimer = setInterval(() => {
  1612. // if (videoTime > 0) {
  1613. // videoTime--;
  1614. // $('.time-node')
  1615. // .eq(0)
  1616. // .text(videoTime + 's');
  1617. // } else {
  1618. // clearInterval(videoTimer);
  1619. // $('.time-node').eq(0).text('');
  1620. // }
  1621. // }, 1000);
  1622. // if (adType === 16 && sourceType == 1) {
  1623. // // 间隔广告和试用才上报
  1624. // report(0);
  1625. // }
  1626. // $('.try-use-wrap').eq(0).show();
  1627. // } else {
  1628. // $.toast(res.msg, 'text');
  1629. // }
  1630. // },
  1631. // });
  1632. // }
  1633. //间隔广告上报
  1634. function report(type) {
  1635. $.ajax({
  1636. url: baseUrl + '/api/resources/v1/trial/report',
  1637. headers: {
  1638. Authorization: token,
  1639. },
  1640. data: JSON.stringify({
  1641. userCardId: userCardId,
  1642. reportType: type,
  1643. }),
  1644. type: 'POST',
  1645. dataType: 'json',
  1646. contentType: 'application/json;charset=UTF-8',
  1647. success: function (res) { },
  1648. });
  1649. }
  1650. //关闭广告
  1651. $('.time-close-wrap')[0].addEventListener('click', () => {
  1652. if (videoTime == 0) {
  1653. reportFrequency();
  1654. }
  1655. $('.buy-phone-wrap').eq(0).show();
  1656. });
  1657. // 点击取消
  1658. $('.cannel-btn')[0].addEventListener('click', () => {
  1659. $('.buy-phone-wrap').eq(0).hide();
  1660. if (disconnectionFlag || getDate) {
  1661. //设置了断线时间,取消直接退出
  1662. systemBuriedPoint('激活码-断线-取消');
  1663. quit();
  1664. return;
  1665. }
  1666. let pointName = '';
  1667. if (sourceType == 1) {
  1668. pointName =
  1669. videoTime == 0 ? '免费试用-关闭-取消' : '免费试用-强制关闭-取消';
  1670. } else {
  1671. pointName =
  1672. videoTime == 0 ? '激活码-关闭-取消' : '激活码-强制关闭-取消';
  1673. }
  1674. systemBuriedPoint(pointName);
  1675. if (videoTime == 0) {
  1676. if (adType === 16 && sourceType == 1) {
  1677. report(1);
  1678. }
  1679. $('.try-use-wrap').eq(0).hide();
  1680. $('#source')[0].pause();
  1681. return;
  1682. }
  1683. $('.look-wrap').eq(0).show();
  1684. });
  1685. // 点击去购买
  1686. $('.go-bug')[0].addEventListener('click', () => {
  1687. let pointName = '';
  1688. if (disconnectionFlag) {
  1689. pointName = '激活码-断线-去购买';
  1690. } else if (sourceType == 1) {
  1691. pointName =
  1692. videoTime == 0
  1693. ? '免费试用-关闭-去购买'
  1694. : '免费试用-强制关闭-去购买';
  1695. } else {
  1696. pointName =
  1697. videoTime == 0 ? '激活码-关闭-去购买' : '激活码-强制关闭-去购买';
  1698. }
  1699. systemBuriedPoint(pointName);
  1700. if (getDate) {
  1701. wx.miniProgram.navigateTo({
  1702. url: '/packageA/order/buy/index?buyType=试用界面购买',
  1703. });
  1704. } else {
  1705. // 过期续费按钮进入
  1706. wx.miniProgram.navigateTo({
  1707. url:
  1708. `/packageA/order/renew/index?buyType=${sourceType == 1
  1709. ? '试用弹窗购买按钮进入-普通试用'
  1710. : '试用弹窗购买按钮进入-激活码试用'
  1711. }&record=` + userCardId,
  1712. });
  1713. }
  1714. });
  1715. // 放弃
  1716. $('.cannel-ad-btn')[0].addEventListener('click', () => {
  1717. if (sourceType == 1) {
  1718. systemBuriedPoint('免费试用-强制关闭-放弃');
  1719. } else {
  1720. systemBuriedPoint('激活码-强制关闭-放弃');
  1721. }
  1722. quit();
  1723. });
  1724. // 继续观看
  1725. $('.looking')[0].addEventListener('click', () => {
  1726. $('.look-wrap').eq(0).hide();
  1727. if (sourceType == 1) {
  1728. systemBuriedPoint('免费试用-强制关闭-继续观看');
  1729. } else {
  1730. systemBuriedPoint('激活码-强制关闭-继续观看');
  1731. }
  1732. });
  1733. window.onbeforeunload = function () {
  1734. wsss.close();
  1735. ws.close();
  1736. };
  1737. // 埋点
  1738. function systemBuriedPoint(pointName) {
  1739. $.ajax({
  1740. url: baseUrl + '/api/public/v1/systemBuriedPoint/stat',
  1741. headers: {
  1742. Authorization: token,
  1743. },
  1744. type: 'post',
  1745. data: JSON.stringify({
  1746. pointName: pointName,
  1747. }),
  1748. contentType: 'application/json',
  1749. dataType: 'json',
  1750. success: function (res) { },
  1751. });
  1752. }
  1753. function quit() {
  1754. if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
  1755. tt.miniProgram.switchTab({
  1756. url: '/pages/home/home',
  1757. });
  1758. } else if (window.__wxjs_environment === 'miniprogram') {
  1759. wx.miniProgram.switchTab({
  1760. url: '/pages/home/home',
  1761. });
  1762. } else {
  1763. uni.webView.navigateBack({
  1764. delta: 1,
  1765. });
  1766. }
  1767. }
  1768. function updatePhoneSizeListHtml() {
  1769. const templatePhoneSizeItem = doT.template(
  1770. $('#template-phone-size-item').html().replace(/&amp;/g, '&'),
  1771. );
  1772. // console.log({
  1773. // list: window.phoneSizeList,
  1774. // active: window.activePhoneSize,
  1775. // resolving,
  1776. // });
  1777. const phoneSizeListItemsHtml = templatePhoneSizeItem({
  1778. list: window.phoneSizeList,
  1779. active: window.activePhoneSize,
  1780. resolving,
  1781. });
  1782. $('#phone-size-list').html(phoneSizeListItemsHtml);
  1783. }
  1784. $('#open-set-phone-size-dialog-btn').on('click', async function (e) {
  1785. !window.phoneSizeList.length && (await getPhoneSizeList());
  1786. window.activePhoneSize = window.currentPhoneSize;
  1787. updatePhoneSizeListHtml();
  1788. $('#set-phone-size-dialog').addClass('show');
  1789. });
  1790. // $('#set-phone-size-dialog').addClass('show');
  1791. $('.dialog .dialog-mask')
  1792. .add('.dialog .dialog-btn.cancel')
  1793. .on('click', function (e) {
  1794. $(e.currentTarget).parents('.dialog').removeClass('show');
  1795. });
  1796. // 分辨率列表
  1797. window.phoneSizeList = [];
  1798. // 当前生效的分辨率
  1799. // 选中的分辨率
  1800. // window.activePhoneSize = window.currentPhoneSize;
  1801. async function getPhoneSizeList() {
  1802. const response = await $.ajax({
  1803. url:
  1804. baseUrl + '/api/resources/v5/machine/resolution/getResolvingPower',
  1805. headers: {
  1806. Authorization: token,
  1807. },
  1808. type: 'get',
  1809. dataType: 'json',
  1810. data: {
  1811. userCardId,
  1812. },
  1813. });
  1814. const phoneSizeList = response.data.map(function (v) {
  1815. return {
  1816. id: v.id,
  1817. dpi: v.dpi,
  1818. width: v.width,
  1819. height: v.high,
  1820. };
  1821. });
  1822. window.phoneSizeList = phoneSizeList;
  1823. // 关联上当前云机分辨率
  1824. const currentPhoneSize = phoneSizeList.find(function (v) {
  1825. return (
  1826. window.currentPhoneSize &&
  1827. v.width === window.currentPhoneSize.width &&
  1828. v.height === window.currentPhoneSize.height &&
  1829. v.dpi === window.currentPhoneSize.dpi
  1830. );
  1831. });
  1832. window.currentPhoneSize = currentPhoneSize || window.currentPhoneSize;
  1833. }
  1834. /*
  1835. getPhoneSizeList().then(function (phoneSizeList) {
  1836. window.phoneSizeList = phoneSizeList;
  1837. // window.phoneSizeListBack = phoneSizeList; // 备份下数据,用户横竖切换时。
  1838. const currentPhoneSize = window.phoneSizeList.find(function (v) {
  1839. return (
  1840. window.currentPhoneSize &&
  1841. v.width === window.currentPhoneSize.width &&
  1842. v.height === window.currentPhoneSize.height &&
  1843. v.dpi === window.currentPhoneSize.dpi
  1844. );
  1845. });
  1846. window.currentPhoneSize = currentPhoneSize || window.currentPhoneSize;
  1847. // return updatePhoneSizeListHtml();
  1848. });
  1849. */
  1850. // const phoneSizeListSwiper = new Swiper('#phone-size-list-swiper', {
  1851. // direction: 'vertical',
  1852. // slidesPerView: 'auto',
  1853. // loop: false,
  1854. // centeredSlides: true,
  1855. // });
  1856. let lastSetPhone = 0;
  1857. function setPhoneSize(config) {
  1858. if (config.id === currentPhoneSize.id) {
  1859. return;
  1860. }
  1861. if (Date.now() <= lastSetPhone + 1000 * 5) {
  1862. throw new Error('请勿频繁操作');
  1863. }
  1864. lastSetPhone = Date.now();
  1865. // config = Object.assign({}, config, {
  1866. // width: config.width,
  1867. // height: config.height,
  1868. // });
  1869. // 修改云机分辨率
  1870. wsss.send(
  1871. JSON.stringify({
  1872. type: 'setPhoneSize',
  1873. data: {
  1874. id: config.id,
  1875. width: config.width,
  1876. height: config.height,
  1877. dpi: config.dpi,
  1878. },
  1879. }),
  1880. );
  1881. // XXX: 去除了,改为中台发送
  1882. // 通知其他在线端
  1883. // wsss.send(
  1884. // JSON.stringify({
  1885. // type: 'forwardMsg',
  1886. // data: {
  1887. // code: 'phoneSizeChange',
  1888. // id: config.id,
  1889. // width: config.width,
  1890. // height: config.height,
  1891. // dpi: config.dpi,
  1892. // desc: '分辨率修改', // 可选
  1893. // },
  1894. // }),
  1895. // );
  1896. // 上报分辨率
  1897. window.currentPhoneSize = config;
  1898. }
  1899. // wsss.addEventListener('message', function (event) {
  1900. // console.log(
  1901. // '🚀 ~ file: WXtrialInterface.html ~ line 1476 ~ event',
  1902. // event,
  1903. // );
  1904. // });
  1905. $('#phone-size-list').on('click', '.phone-size-item', function (e) {
  1906. const data = $(e.currentTarget).data();
  1907. // console.log(
  1908. // '🚀 ~ file: WXtrialInterface.html ~ line 1494 ~ data',
  1909. // data,
  1910. // );
  1911. window.activePhoneSize = data;
  1912. updatePhoneSizeListHtml();
  1913. // setPhoneSize(data.width, data.height);
  1914. });
  1915. $('#set-phone-size-dialog .dialog-btn.confirm').on('click', function (e) {
  1916. try {
  1917. setPhoneSize(window.activePhoneSize);
  1918. $('#set-phone-size-dialog').removeClass('show');
  1919. } catch (error) {
  1920. $.toast(error.message, 'text');
  1921. }
  1922. });
  1923. </script>
  1924. <script type="text/javascript" src="WXdraw.js"></script>
  1925. <script type="text/javascript" src="aac.js"></script>
  1926. <script type="text/javascript" src="./timer.js"></script>
  1927. </body>
  1928. </html>