WXtrialInterface.html 63 KB

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