WXtrialInterface.html 62 KB

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