WXtrialInterface.html 63 KB

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