WXtrialInterface.html 66 KB

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