WXtrialInterface.html 63 KB

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