WXtrialInterface.html 62 KB

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