WXtrialInterface.html 63 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017
  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 ?? localStorage.getItem('auth._token.password'),
  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. if (window.history.length > 1) {
  1764. window.history.back();
  1765. }
  1766. }
  1767. }
  1768. function updatePhoneSizeListHtml() {
  1769. const templatePhoneSizeItem = doT.template(
  1770. $('#template-phone-size-item').html().replace(/&amp;/g, '&'),
  1771. );
  1772. // console.log({
  1773. // list: window.phoneSizeList,
  1774. // active: window.activePhoneSize,
  1775. // resolving,
  1776. // });
  1777. const phoneSizeListItemsHtml = templatePhoneSizeItem({
  1778. list: window.phoneSizeList,
  1779. active: window.activePhoneSize,
  1780. resolving,
  1781. });
  1782. $('#phone-size-list').html(phoneSizeListItemsHtml);
  1783. }
  1784. $('#open-set-phone-size-dialog-btn').on('click', async function (e) {
  1785. !window.phoneSizeList.length && (await getPhoneSizeList());
  1786. window.activePhoneSize = window.currentPhoneSize;
  1787. updatePhoneSizeListHtml();
  1788. $('#set-phone-size-dialog').addClass('show');
  1789. $('.control-right-img').attr({
  1790. 'data-id': '1',
  1791. });
  1792. $('.leftmains').css({
  1793. right: '-4rem',
  1794. });
  1795. });
  1796. // $('#set-phone-size-dialog').addClass('show');
  1797. $('.dialog .dialog-mask')
  1798. .add('.dialog .dialog-btn.cancel')
  1799. .on('click', function (e) {
  1800. $(e.currentTarget).parents('.dialog').removeClass('show');
  1801. });
  1802. // 分辨率列表
  1803. window.phoneSizeList = [];
  1804. // 当前生效的分辨率
  1805. // 选中的分辨率
  1806. // window.activePhoneSize = window.currentPhoneSize;
  1807. async function getPhoneSizeList() {
  1808. const response = await $.ajax({
  1809. url:
  1810. baseUrl + '/api/resources/v5/machine/resolution/getResolvingPower',
  1811. headers: {
  1812. Authorization: token,
  1813. },
  1814. type: 'get',
  1815. dataType: 'json',
  1816. data: {
  1817. userCardId,
  1818. },
  1819. });
  1820. const phoneSizeList = response.data.map(function (v) {
  1821. return {
  1822. id: v.id,
  1823. dpi: v.dpi,
  1824. width: v.width,
  1825. height: v.high,
  1826. };
  1827. });
  1828. window.phoneSizeList = phoneSizeList;
  1829. // 关联上当前云机分辨率
  1830. const currentPhoneSize = phoneSizeList.find(function (v) {
  1831. return (
  1832. window.currentPhoneSize &&
  1833. v.width === window.currentPhoneSize.width &&
  1834. v.height === window.currentPhoneSize.height &&
  1835. v.dpi === window.currentPhoneSize.dpi
  1836. );
  1837. });
  1838. window.currentPhoneSize = currentPhoneSize || window.currentPhoneSize;
  1839. }
  1840. /*
  1841. getPhoneSizeList().then(function (phoneSizeList) {
  1842. window.phoneSizeList = phoneSizeList;
  1843. // window.phoneSizeListBack = phoneSizeList; // 备份下数据,用户横竖切换时。
  1844. const currentPhoneSize = window.phoneSizeList.find(function (v) {
  1845. return (
  1846. window.currentPhoneSize &&
  1847. v.width === window.currentPhoneSize.width &&
  1848. v.height === window.currentPhoneSize.height &&
  1849. v.dpi === window.currentPhoneSize.dpi
  1850. );
  1851. });
  1852. window.currentPhoneSize = currentPhoneSize || window.currentPhoneSize;
  1853. // return updatePhoneSizeListHtml();
  1854. });
  1855. */
  1856. // const phoneSizeListSwiper = new Swiper('#phone-size-list-swiper', {
  1857. // direction: 'vertical',
  1858. // slidesPerView: 'auto',
  1859. // loop: false,
  1860. // centeredSlides: true,
  1861. // });
  1862. let lastSetPhone = 0;
  1863. function setPhoneSize(config) {
  1864. if (config.id === currentPhoneSize.id) {
  1865. return;
  1866. }
  1867. if (Date.now() <= lastSetPhone + 1000 * 5) {
  1868. throw new Error('请勿频繁操作');
  1869. }
  1870. lastSetPhone = Date.now();
  1871. // config = Object.assign({}, config, {
  1872. // width: config.width,
  1873. // height: config.height,
  1874. // });
  1875. // 修改云机分辨率
  1876. wsss.send(
  1877. JSON.stringify({
  1878. type: 'setPhoneSize',
  1879. data: {
  1880. id: config.id,
  1881. width: config.width,
  1882. height: config.height,
  1883. dpi: config.dpi,
  1884. },
  1885. }),
  1886. );
  1887. // XXX: 去除了,改为中台发送
  1888. // 通知其他在线端
  1889. // wsss.send(
  1890. // JSON.stringify({
  1891. // type: 'forwardMsg',
  1892. // data: {
  1893. // code: 'phoneSizeChange',pause
  1894. // id: config.id,
  1895. // width: config.width,
  1896. // height: config.height,
  1897. // dpi: config.dpi,
  1898. // desc: '分辨率修改', // 可选
  1899. // },
  1900. // }),
  1901. // );
  1902. // 上报分辨率
  1903. window.currentPhoneSize = config;
  1904. }
  1905. // wsss.addEventListener('message', function (event) {
  1906. // console.log(
  1907. // '🚀 ~ file: WXtrialInterface.html ~ line 1476 ~ event',
  1908. // event,
  1909. // );
  1910. // });
  1911. $('#phone-size-list').on('click', '.phone-size-item', function (e) {
  1912. const data = $(e.currentTarget).data();
  1913. // console.log(
  1914. // '🚀 ~ file: WXtrialInterface.html ~ line 1494 ~ data',
  1915. // data,
  1916. // );
  1917. window.activePhoneSize = data;
  1918. updatePhoneSizeListHtml();
  1919. // setPhoneSize(data.width, data.height);
  1920. });
  1921. $('#set-phone-size-dialog .dialog-btn.confirm').on('click', function (e) {
  1922. try {
  1923. setPhoneSize(window.activePhoneSize);
  1924. $('#set-phone-size-dialog').removeClass('show');
  1925. } catch (error) {
  1926. $.toast(error.message, 'text');
  1927. }
  1928. });
  1929. </script>
  1930. <script type="text/javascript" src="WXdraw.js"></script>
  1931. <script type="text/javascript" src="aac.js"></script>
  1932. <script type="text/javascript" src="./timer.js"></script>
  1933. </body>
  1934. </html>