homeNew.html 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="initial-scale=1,maximum-scale=1, minimum-scale=1,user-scalable=no">
  7. <meta name="x5-orientation" content="portrait" />
  8. <meta name="screen-orientation" content="portrait" />
  9. <meta name="viewport" content="width=device-width, minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
  10. <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
  11. <meta name="apple-mobile-web-app-capable" content="yes">
  12. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  13. <meta name="format-detection" content="telephone=no, email=no">
  14. <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
  15. <meta name="apple-mobile-web-app-capable" content="yes">
  16. <!-- 删除苹果默认的工具栏和菜单栏 -->
  17. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  18. <!-- 设置苹果工具栏颜��? -->
  19. <meta name="format-detection" content="telphone=no, email=no">
  20. <!-- 忽略页面中的数字识别为电话,忽略email识别 -->
  21. <!-- 启用360浏览器的极速模��?(webkit) -->
  22. <meta name="renderer" content="webkit">
  23. <!-- 避免IE使用兼容模式 -->
  24. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  25. <!-- 针对手持设备优化,主要是针对一些老的不识别viewport的浏览器,比如黑��? -->
  26. <meta name="HandheldFriendly" content="true">
  27. <!-- 微软的老式浏览��? -->
  28. <meta name="MobileOptimized" content="320">
  29. <!-- uc强制竖屏 -->
  30. <!-- <meta name="screen-orientation" content="portrait"> -->
  31. <!-- QQ强制竖屏 -->
  32. <!-- <meta name="x5-orientation" content="portrait"> -->
  33. <!-- 不能旋转,问题出在这 -->
  34. <!-- UC强制全屏 -->
  35. <meta name="full-screen" content="yes">
  36. <!-- QQ强制全屏 -->
  37. <meta name="x5-fullscreen" content="true">
  38. <!-- UC应用模式 -->
  39. <meta name="browsermode" content="application">
  40. <!-- QQ应用模式 -->
  41. <meta name="x5-page-mode" content="app">
  42. <!-- windows phone 点击无高��? -->
  43. <meta name="msapplication-tap-highlight" content="no">
  44. <title></title>
  45. <link rel="stylesheet" href="../static/css/homeNew.css?id=103">
  46. <link rel="stylesheet" type="text/css" href="../static/css/swiper-bundle.min.css" />
  47. <script src="../static/css/swiper-bundle.min.js"></script>
  48. <style>
  49. canvas {
  50. display: block;
  51. width: 100%;
  52. height: 100%;
  53. z-index: 999;
  54. border-radius: 1.25rem;
  55. }
  56. .wine{
  57. width: 100%;
  58. height: 100%;
  59. }
  60. .mainbox {
  61. width: 18rem;
  62. height: 10rem;
  63. background: #fff;
  64. position: fixed;
  65. top: 38%;
  66. left: 12%;
  67. border-radius: 5px;
  68. }
  69. .boxTitle {
  70. text-align: center;
  71. font-size: 18px;
  72. padding: 10px 0px;
  73. }
  74. .boxText {
  75. text-align: center;
  76. font-size: 16px;
  77. }
  78. .boxbt {
  79. width: 60%;
  80. height: 2.5rem;
  81. background: #0886F5;
  82. margin: 0 auto;
  83. font-size: 16px;
  84. text-align: center;
  85. line-height: 2.5rem;
  86. color: #fff;
  87. border-radius: 5px;
  88. margin-top: 1rem;
  89. }
  90. .sbox {
  91. width: 18rem;
  92. height: 5.5rem;
  93. background: #fff;
  94. position: fixed;
  95. top: 38%;
  96. left: 5%;
  97. border-radius: 5px;
  98. }
  99. .sboxText {
  100. padding: 17px;
  101. font-size: 16px;
  102. }
  103. .boximg {
  104. position: absolute;
  105. width: 1rem;
  106. height: 1rem;
  107. left: 45%;
  108. bottom: -22%;
  109. }
  110. .maxs{
  111. width: 100%;
  112. height: 100%;
  113. position: fixed;
  114. background:rgba(0,0,0,0.5);
  115. }
  116. .helps{
  117. width: 35px;
  118. height: 30px;
  119. background: rgba(187,187,187,1);
  120. border-radius: 30px 0px 0px 30px;
  121. font-size: 13px;
  122. line-height: 30px;
  123. color: rgba(255,255,255,1);
  124. position: absolute;
  125. right: 0;
  126. bottom: 181px;
  127. text-align: center;
  128. }
  129. .helps-img{
  130. width: 50%;
  131. height: 50%;
  132. margin: 0 auto;
  133. margin-top: 0.5rem;
  134. }
  135. .diskName{
  136. margin-left: 6px;
  137. }
  138. #showsuss{
  139. display: none;
  140. }
  141. .swiper-container {
  142. width: 100%;
  143. height: 100%;
  144. }
  145. .swiper-slide {
  146. /* padding: 43px 53px; */
  147. padding: 12% 14%;
  148. box-sizing: border-box;
  149. text-align: center;
  150. font-size: 18px;
  151. /* background: #fff; */
  152. /* height: 667px; */
  153. height:100%;
  154. /* Center slide text vertically */
  155. display: -webkit-box;
  156. display: -ms-flexbox;
  157. display: -webkit-flex;
  158. display: flex;
  159. -webkit-box-pack: center;
  160. -ms-flex-pack: center;
  161. -webkit-justify-content: center;
  162. justify-content: center;
  163. -webkit-box-align: center;
  164. -ms-flex-align: center;
  165. -webkit-align-items: center;
  166. align-items: center;
  167. }
  168. .swiper-button-next{
  169. width: 15px;
  170. height: 15px;
  171. background: url(../static/img/xia_icon.png);
  172. right: 15px;
  173. }
  174. .swiper-button-prev{
  175. width: 15px;
  176. height: 15px;
  177. background: url(../static/img/shang_icon.png);
  178. left: 15px;
  179. }
  180. .swiper-button-next:after, .swiper-container-rtl .swiper-button-prev:after{
  181. content: "" !important;
  182. }
  183. .swiper-button-prev:after, .swiper-container-rtl .swiper-button-next:after{
  184. content: "" !important;
  185. }
  186. .thl-time{
  187. text-align: left;
  188. margin-left: -0.4rem !important;
  189. }
  190. </style>
  191. </head>
  192. <body style="background: #F8F9FA;overflow:scroll;overflow-y: hidden;overflow-x: hidden;">
  193. <div style="width: 100%;height: 100%;" id="homeapp">
  194. <!-- <div class="canvas" style="display: none;">
  195. <div id="wine" style="height: 90%;">
  196. </div>
  197. <div class="camvas-head">
  198. <div class="vip">
  199. <img class="vipimg" src="../static/img/vip_icon.png"></img>
  200. <text class="diskName"></text>
  201. </div>
  202. <div class="canvastime"></div>
  203. </div>
  204. </div> -->
  205. <!-- Swiper -->
  206. <div class="newhelp" style="z-index: 50;">
  207. <div class="helpImg">
  208. <img src="../static/img/bangzu_icon.png" />
  209. </div>
  210. <div class="font helpfont">使用帮助?</div>
  211. </div>
  212. <div class="buyIcon" style="z-index: 50;">
  213. <img src="../static/img/goumai_icon.png" />
  214. </div>
  215. <div class="swiper-container">
  216. <div class="swiper-wrapper">
  217. <div class="swiper-slide" v-for="(item,index) in homeList" :key="item.id" :class="[index==0 ? 'swiper-slide-active' : '' , index==1 ? 'swiper-slide-next' : '']">
  218. <div class="canvas" style="z-index: 1;" @click="homeinfo(item)">
  219. <div style="height: 100%;" class="wine" :id="'wine'+index">
  220. </div>
  221. <div class="camvas-head" style="z-index: 5555;">
  222. <div class="tophead">
  223. <div class="th_left">
  224. <!-- {{item.buyVipType}} -->
  225. <img src="../static/img/xingyao_icon.png" v-if="item.buyVipType='SVIP'" />
  226. <img src="../static/img/xingdong_icon.png" v-else />
  227. </div>
  228. <div class="th_right">
  229. <div class="thl-font">{{item.diskName}}</div>
  230. <div class="thl-time">{{remainTime(item.ctime,item.exceptTime)}}</div>
  231. </div>
  232. </div>
  233. <div class="th_renew homeRenew" style="z-index: 5000;" @click="renew(item)">
  234. 续费
  235. </div>
  236. </div>
  237. </div>
  238. </div>
  239. <div class="swiper-slide">
  240. <div class="canvas" style="display: none;">
  241. <div style="height: 100%;" class="kongWine">
  242. <div class="kphone">
  243. <div class="kp_img">
  244. <img src="../static/img/goumai_pic.png" />
  245. </div>
  246. <div class="kp_btn" style="z-index: 5000;">
  247. 购买云手机
  248. </div>
  249. </div>
  250. </div>
  251. </div>
  252. </div>
  253. </div>
  254. <!-- Add Arrows -->
  255. <div class="swiper-button-next" @click="swiperNext()"></div>
  256. <div class="swiper-button-prev" @click="swiperPrev()"></div>
  257. </div>
  258. <!-- 没登录状态 -->
  259. <div class="canvasfalse" style="display: none;">
  260. <div class="notLoggedin">
  261. <image src="../static/img/tianjiashouji_pic.png"></image>
  262. </div>
  263. <!-- 审核-->
  264. <div id="showsuss">
  265. <div class="notLoggedin-text">
  266. <div>下载云手机</div>
  267. <div>体验更多功能</div>
  268. </div>
  269. <div class="notLoggedin-bt">
  270. 立即下载
  271. </div>
  272. </div>
  273. </div>
  274. <!--<div class="addto">
  275. <img class="addto-img" src="../static/img/tianjia_icon.png"></img>
  276. </div>-->
  277. <!-- <div class="help">使用帮助?</div>
  278. <div class="helps" data-id="1">
  279. <img class="helps-img" src="../static/img/bangzu_icon.png">
  280. </div> -->
  281. <div class="maxs" style="display: none;">
  282. <div class="mainbox" style="display: none;">
  283. <div class="boxTitle">提示</div>
  284. <div class="boxText">
  285. <div>由于小程序的功能限制,此功能暂时</div>
  286. <div>无法使用,请下载APP使用更多功能</div>
  287. </div>
  288. <!--<div class="boxbt" onclick="cp(document.getElementById('user_ref_id'));">立即前往下载</div>-->
  289. <div class="boxbt" onclick="cp(document.getElementById('user_ref_id'));">立即前往下载</div>
  290. <div class="boximg"><img src="../static/img/wx/guanbi_icon.png"></div>
  291. </div>
  292. </div>
  293. </div>
  294. <div id="copy-txt" style="position: absolute;opacity: 0;">
  295. <span id="user_ref_id">www.androidsCloud.com</span>
  296. </div>
  297. <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.0.js"></script>
  298. <!-- 视频-->
  299. <script src="../static/js/jquery-1.11.0.min.js"></script>
  300. <script type="text/javascript" src="../static/js/Decoder.js"></script>
  301. <script type="text/javascript" src="../static/js/YUVCanvas.js"></script>
  302. <script type="text/javascript" src="../static/js/Player.js"></script>
  303. <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
  304. <script src="https://cdn.bootcss.com/vConsole/3.2.0/vconsole.min.js"></script>
  305. <script type="text/javascript">
  306. var app = new Vue({
  307. el: '#homeapp',
  308. data: {
  309. message: 'Hello Vue!',
  310. homeList: [],
  311. urlData: {},
  312. rbdData: {},
  313. activeIndexData: "",
  314. swipeDirection: "",
  315. },
  316. mounted() {
  317. // //初始化一下就可以了,
  318. let vConsole = new VConsole();
  319. // //你打印的数据 比如
  320. console.log('test');
  321. //就可像小程序一样的看了和调试了。
  322. this.$nextTick(function() {
  323. this.gethomeList();
  324. });
  325. var that = this;
  326. var swiper = new Swiper('.swiper-container', {
  327. observer: true, //修改swiper自己或子元素时,自动初始化swiper
  328. observeParents: true, //修改swiper的父元素时,自动初始化swiper
  329. navigation: {
  330. nextEl: '.swiper-button-next',
  331. prevEl: '.swiper-button-prev',
  332. },
  333. on: {
  334. touchEnd: function(event) {
  335. console.log('触摸停止');
  336. console.log(swiper.swipeDirection);
  337. this.swipeDirection = swiper.swipeDirection;
  338. },
  339. transitionStart: function() {
  340. console.log("transitionStart", this.activeIndex)
  341. this.activeIndexData = this.activeIndex;
  342. },
  343. slideChangeTransitionStart: function() {
  344. console.log("slideChangeTransitionStart", this.activeIndex)
  345. this.activeIndexData = this.activeIndex;
  346. },
  347. slideChangeTransitionEnd: function() {
  348. console.log("slideChangeTransitionEnd", this.activeIndex)
  349. this.activeIndexData = this.activeIndex;
  350. if (this.swipeDirection == "next") {
  351. that.getSwiperInfo("nextSlide");
  352. } else if (this.swipeDirection == "prev") {
  353. that.getSwiperInfo("prevSlide");
  354. }
  355. },
  356. // slideChangeStart: function() {
  357. // alert(this.activeIndext);
  358. // },
  359. // slideChangeEnd: function() {
  360. // console.log("下标啊", this)
  361. // },
  362. // ransitionStart: function(activeIndex) {
  363. // console.log("下标啊", this, activeIndex)
  364. // },
  365. // slideChangeEnd: function(swiperHere) {
  366. // var txt = $('.swiper-slide-active').html();
  367. // console.log("打印索引值", txt)
  368. // }
  369. }
  370. });
  371. },
  372. methods: {
  373. homeinfo(data) {
  374. wx.miniProgram.navigateTo({
  375. url: '/pages/trialInterface/trialInterface?record=' + JSON.stringify(data),
  376. })
  377. },
  378. renew(data) {
  379. console.log("续费啊", data);
  380. wx.miniProgram.navigateTo({
  381. url: '/pages/order/renew/index?record=' + JSON.stringify(data),
  382. })
  383. },
  384. remainTime(ctime, exceptTime) {
  385. var date1 = ctime;
  386. var date2 = exceptTime; //结束时间
  387. var date3 = new Date(date2.replace(/-/g, '/')).getTime() - new Date(date1.replace(/-/g, '/')).getTime(); //时间差的毫秒数
  388. console.log("时间戳===========》", date3)
  389. //------------------------------
  390. var tmiss = ''
  391. //计算出相差天数
  392. var days = Math.floor(date3 / (24 * 3600 * 1000))
  393. // console.log(days + "天");
  394. //计算出小时数
  395. var leave1 = date3 % (24 * 3600 * 1000) //计算天数后剩余的毫秒数
  396. var hours = Math.floor(leave1 / (3600 * 1000))
  397. //计算相差分钟数
  398. var leave2 = leave1 % (3600 * 1000) //计算小时数后剩余的毫秒数
  399. var minutes = Math.floor(leave2 / (60 * 1000))
  400. //计算相差秒数
  401. var leave3 = leave2 % (60 * 1000) //计算分钟数后剩余的毫秒数
  402. var seconds = Math.round(leave3 / 1000)
  403. var times = ""
  404. if (Number(days) == 0) {
  405. // console.log(hours + "小时" + minutes + "分")
  406. tmiss = Number(hours) + "小时" + Number(minutes) + "分"
  407. } else {
  408. if (Number(hours) == 0 && Number(minutes) == 0) {
  409. // console.log(days + "天")
  410. tmiss = Number(days) + "天"
  411. } else {
  412. // console.log(days + "天" + hours + "小时 ")
  413. tmiss = Number(days) + "天" + Number(hours) + "小时 "
  414. }
  415. }
  416. // console.log("tmiss>>>>>>", tmiss);
  417. return tmiss
  418. },
  419. swiperNext(data) {
  420. this.getSwiperInfo("next");
  421. },
  422. swiperPrev() {
  423. this.getSwiperInfo("prev");
  424. },
  425. getSwiperInfo(data) {
  426. console.log("方向=======", data, $('.swiper-slide-active').index());
  427. // return
  428. if (data == "next") {
  429. var activeIndex = $('.swiper-slide-active').index() + 1;
  430. } else if (data == "prev") {
  431. var activeIndex = $('.swiper-slide-active').index() - 1;
  432. } else if (data == "prevSlide") {
  433. var activeIndex = $('.swiper-slide-active').index();
  434. } else if (data == "nextSlide") {
  435. var activeIndex = $('.swiper-slide-active').index();
  436. }
  437. var ids = "#wine" + $('.swiper-slide-active').index();
  438. var domprev = $(ids);
  439. console.log("下标id======", activeIndex);
  440. domprev.empty();
  441. let rbdData = {
  442. "userCardId": this.homeList[activeIndex].id,
  443. "deviceStatus": 1,
  444. };
  445. // var baseUrl = "http://192.168.31.20";
  446. var baseUrl = "https://test.androidscloud.com";
  447. var urlss = 'test.androidscloud.com'
  448. let that = this;
  449. var player = new Player({
  450. size: {
  451. width: 768,
  452. height: 1024
  453. }
  454. });
  455. var id = 'wine' + activeIndex;
  456. var secanv = document.getElementById(id);
  457. secanv.appendChild(player.canvas);
  458. // setTimeout(() => {
  459. $.ajax({
  460. url: baseUrl + "/api/storage/v1/cardStatus/getRbd",
  461. data: JSON.stringify(rbdData),
  462. type: 'post',
  463. dataType: 'json',
  464. // async: false,
  465. contentType: "application/json;charset=UTF-8",
  466. headers: {
  467. 'token': tokens.substring(6, tokens.length),
  468. "Authorization": tokens.substring(6, tokens.length)
  469. },
  470. success: function(data) {
  471. that.urlData = data.data;
  472. console.log("挂载安卓卡成功", that.urlData);
  473. //
  474. }
  475. })
  476. // var strhost = "wss://" + urlss + "/videoWebSocket?clientType=1&cardIp=" +
  477. // that.urlData.exIp +
  478. // "&port=" + that.urlData.exPort + "&sn=" + that.urlData.sn;
  479. // var strhost = "ws://192.168.11.66:9101";
  480. // var strhost = "ws://" + that.urlData.exIp + ":" + that.urlData.exPort
  481. // var strhost="wss://www.ted2018.com:9101";
  482. var strhost = "wss://test.androidscloud.com:9105";
  483. // var strhost="wss://test.androidscloud.com/videoWebSocket?clientType=1&cardIp=14.215.128.96&port=2005&sn=RK3930C2301900005";
  484. var client = new WebSocket(strhost);
  485. console.log('wsssss==============', client)
  486. client.binaryType = 'arraybuffer';
  487. // debugger
  488. client.onopen = function(evt) {
  489. // onOpen(evt)
  490. console.log("开始链接==============", evt);
  491. };
  492. client.onclose = function(evt) {
  493. // onClose(evt)
  494. };
  495. client.onmessage = function(evt) {
  496. // onMessage(evt)
  497. // console.log("onMessage==============", evt);
  498. var messageData = new Uint8Array(evt.data);
  499. player.decode(messageData);
  500. };
  501. client.onerror = function(evt) {
  502. // onError(evt)
  503. };
  504. // }, 1)
  505. },
  506. gethomeList() {
  507. var baseUrl = 'https://test.androidscloud.com';
  508. // var baseUrl = "http://192.168.31.20";
  509. var query = window.location.search.substring(1);
  510. var vars = query.split("&");
  511. var tokens = vars.find(e => {
  512. return e.startsWith('token')
  513. }) || ''
  514. var data = {}
  515. var clientType = vars.find(e => {
  516. return e.startsWith('clientType')
  517. }) || ''
  518. var cardIp = vars.find(e => {
  519. return e.startsWith('cardIp')
  520. }) || ''
  521. var port = vars.find(e => {
  522. return e.startsWith('port')
  523. }) || ''
  524. var sn = vars.find(e => {
  525. return e.startsWith('sn')
  526. }) || ''
  527. var demoTime = vars.find(e => {
  528. return e.startsWith('demoTime')
  529. }) || ''
  530. var id = vars.find(e => {
  531. return e.startsWith('id')
  532. }) || ''
  533. var vip = vars.find(e => {
  534. return e.startsWith('vip')
  535. }) || ''
  536. var diskName = vars.find(e => {
  537. return e.startsWith('diskName')
  538. }) || ''
  539. var times = vars.find(e => {
  540. return e.startsWith('times')
  541. }) || ''
  542. var username = vars.find(e => {
  543. return e.startsWith('username')
  544. }) || ''
  545. var userCardId = vars.find(e => {
  546. return e.startsWith('userCardId')
  547. }) || ''
  548. var ip = vars.find(e => {
  549. return e.startsWith('ip')
  550. }) || ''
  551. var windowHeight = vars.find(e => {
  552. return e.startsWith('windowHeight')
  553. }) || ''
  554. var tokens = vars.find(e => {
  555. return e.startsWith('token')
  556. }) || ''
  557. data.clientType = clientType.substring(11, clientType.length)
  558. data.cardIp = cardIp.substring(7, cardIp.length)
  559. data.port = port.substring(5, port.length)
  560. data.sn = sn.substring(3, sn.length)
  561. data.demoTime = demoTime.substring(9, demoTime.length)
  562. data.id = id.substring(3, id.length)
  563. data.vip = vip.substring(4, vip.length)
  564. data.diskName = diskName.substring(9, diskName.length)
  565. data.times = times.substring(6, times.length)
  566. data.username = username.substring(9, username.length)
  567. data.userCardId = userCardId.substring(11, userCardId.length)
  568. data.ip = ip.substring(3, ip.length)
  569. console.log("data====", data);
  570. this.urlData = data;
  571. let that = this;
  572. $.ajax({
  573. url: baseUrl + "/api/user/v1/client/disk/info",
  574. data: {},
  575. type: 'get',
  576. dataType: 'json',
  577. headers: {
  578. 'token': tokens.substring(6, tokens.length),
  579. "Authorization": tokens.substring(6, tokens.length)
  580. },
  581. success: function(data) {
  582. console.log("云手机信息=======", data);
  583. if (data.data) {
  584. that.homeList = data.data.diskInfo;
  585. console.log("云手机this.homeListthis.homeListthis.homeList=======", that.homeList);
  586. var urlss = 'test.androidscloud.com'
  587. let rbdData = {
  588. "userCardId": that.homeList[0].id,
  589. "deviceStatus": 1,
  590. };
  591. let activeIndex = $('.swiper-slide-active').index();
  592. // let that = this;
  593. setTimeout(() => {
  594. $.ajax({
  595. url: baseUrl + "/api/storage/v1/cardStatus/getRbd",
  596. data: JSON.stringify(rbdData),
  597. // data:rbdData,
  598. type: 'post',
  599. dataType: 'json',
  600. contentType: "application/json;charset=UTF-8",
  601. async: false,
  602. headers: {
  603. 'token': tokens.substring(6, tokens.length),
  604. "Authorization": tokens.substring(6, tokens.length)
  605. },
  606. success: function(data) {
  607. that.urlData = data.data;
  608. console.log("挂载安卓卡成功", that.urlData);
  609. //
  610. }
  611. })
  612. console.log("that.urlDatathat.urlDatathat.urlDatathat.urlData", that.urlData);
  613. var player = new Player({
  614. size: {
  615. width: 768,
  616. height: 1024
  617. }
  618. });
  619. var id = 'wine' + activeIndex;
  620. console.log("首页=====", id);
  621. var secanv = document.getElementById(id);
  622. secanv.appendChild(player.canvas);
  623. console.log("首页=====", secanv);
  624. // var strhost = "wss://" + urlss + "/videoWebSocket?clientType=1&cardIp=" +
  625. // that.urlData.exIp +
  626. // "&port=" + that.urlData.exPort + "&sn=" + that.urlData.sn;
  627. // var strhost = "ws://192.168.11.66:9101";
  628. // var strhost="wss://192.168.11.242:9104";
  629. // var strhost="wss://www.ted2018.com:9101";
  630. var strhost = "wss://test.androidscloud.com:9105";
  631. // var strhost="wss://test.androidscloud.com/videoWebSocket?clientType=1&cardIp=14.215.128.96&port=2005&sn=RK3930C2301900005";
  632. // var strhost="ws://192.168.11.242:9101";
  633. // var strhost="ws://"+that.urlData.exIp+":"+that.urlData.exPort
  634. // var client = new WebSocket(strhost.replace("wss","ws"));
  635. var client = new WebSocket(strhost);
  636. console.log('wsssss==============', client)
  637. client.binaryType = 'arraybuffer';
  638. // debugger
  639. client.onopen = function(evt) {
  640. // onOpen(evt)
  641. console.log("开始链接==============", evt);
  642. };
  643. client.onclose = function(evt) {
  644. // onClose(evt)
  645. };
  646. client.onmessage = function(evt) {
  647. // onMessage(evt)
  648. // console.log("onMessage==============", evt);
  649. var messageData = new Uint8Array(evt.data);
  650. player.decode(messageData);
  651. };
  652. client.onerror = function(evt) {
  653. // onError(evt)
  654. };
  655. }, 1)
  656. } else {
  657. }
  658. //
  659. }
  660. })
  661. }
  662. }
  663. })
  664. var homeList = []; //云手机列表信息
  665. var url = window.location.href;
  666. url = url.split('/')
  667. console.log(url)
  668. // var baseUrl = 'https://' + url[2] //'http://192.168.31.159'//'http://' + url[2]
  669. // var baseUrl = 'http://192.168.31.20'
  670. var baseUrl = 'https://test.androidscloud.com';
  671. var query = window.location.search.substring(1);
  672. var vars = query.split("&");
  673. // var urls = "https://xcx.androidscloud.com"
  674. // 审核
  675. $.ajax({
  676. url: baseUrl + "/api/user/v1/config/download/isShow",
  677. data: {},
  678. type: 'get',
  679. dataType: 'json',
  680. contentType: "application/json;charset=UTF-8",
  681. success: function(data) {
  682. if (data.data) {
  683. $("#showsuss").show()
  684. } else {
  685. $("#showsuss").hide()
  686. }
  687. //
  688. }
  689. })
  690. // var baseUrl = window.location.href; //"http://192.168.31.20"
  691. document.body.addEventListener('touchmove', function(e) {
  692. e.preventDefault()
  693. }, {
  694. passive: false
  695. })
  696. var data = {}
  697. var clientType = vars.find(e => {
  698. return e.startsWith('clientType')
  699. }) || ''
  700. var cardIp = vars.find(e => {
  701. return e.startsWith('cardIp')
  702. }) || ''
  703. var port = vars.find(e => {
  704. return e.startsWith('port')
  705. }) || ''
  706. var sn = vars.find(e => {
  707. return e.startsWith('sn')
  708. }) || ''
  709. var demoTime = vars.find(e => {
  710. return e.startsWith('demoTime')
  711. }) || ''
  712. var id = vars.find(e => {
  713. return e.startsWith('id')
  714. }) || ''
  715. var vip = vars.find(e => {
  716. return e.startsWith('vip')
  717. }) || ''
  718. var diskName = vars.find(e => {
  719. return e.startsWith('diskName')
  720. }) || ''
  721. var times = vars.find(e => {
  722. return e.startsWith('times')
  723. }) || ''
  724. var username = vars.find(e => {
  725. return e.startsWith('username')
  726. }) || ''
  727. var userCardId = vars.find(e => {
  728. return e.startsWith('userCardId')
  729. }) || ''
  730. var ip = vars.find(e => {
  731. return e.startsWith('ip')
  732. }) || ''
  733. var windowHeight = vars.find(e => {
  734. return e.startsWith('windowHeight')
  735. }) || ''
  736. var tokens = vars.find(e => {
  737. return e.startsWith('token')
  738. }) || ''
  739. $(".swiper-container").css("height", windowHeight.substring(13, windowHeight.length));
  740. console.log("获取网页高度", windowHeight.substring(13, windowHeight.length));
  741. // $(".aaa").text(clientType.substring(11, clientType.length))
  742. // let cardIp = getUrlParam('cardIp');
  743. // console.log(cardIp)
  744. $.ajax({
  745. url: baseUrl + "/api/user/v1/client/disk/info",
  746. data: {},
  747. type: 'get',
  748. dataType: 'json',
  749. headers: {
  750. 'token': tokens.substring(6, tokens.length),
  751. "Authorization": tokens.substring(6, tokens.length)
  752. },
  753. success: function(data) {
  754. console.log("云手机信息=======", data);
  755. if (data.data) {
  756. homeList = data.data.diskInfo;
  757. } else {
  758. }
  759. //
  760. }
  761. })
  762. getQueryString: (name) => {
  763. let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  764. let r = window.location.search.substr(1).match(reg);
  765. console.log(name)
  766. if (r != null) {
  767. return unescape(decodeURI(r[2]));
  768. return null;
  769. }
  770. }
  771. data.clientType = clientType.substring(11, clientType.length)
  772. data.cardIp = cardIp.substring(7, cardIp.length)
  773. data.port = port.substring(5, port.length)
  774. data.sn = sn.substring(3, sn.length)
  775. data.demoTime = demoTime.substring(9, demoTime.length)
  776. data.id = id.substring(3, id.length)
  777. data.vip = vip.substring(4, vip.length)
  778. data.diskName = diskName.substring(9, diskName.length)
  779. data.times = times.substring(6, times.length)
  780. data.username = username.substring(9, username.length)
  781. data.userCardId = userCardId.substring(11, userCardId.length)
  782. data.ip = ip.substring(3, ip.length)
  783. let timestext = "剩" + decodeURI(data.times) || data.demoTime / 3600 + "小时"
  784. $(".diskName").text(decodeURI(data.diskName) || data.username)
  785. console.log("timestext>>>>>>", timestext);
  786. $(".canvastime").text(timestext)
  787. if (data.vip == "0") {
  788. $(".canvasfalse").css({
  789. "display": "block"
  790. })
  791. $(".canvas").css({
  792. "display": "none"
  793. })
  794. } else {
  795. $(".canvas").css({
  796. "display": "block"
  797. })
  798. $(".canvasfalse").css({
  799. "display": "none"
  800. })
  801. }
  802. // // 云手机相关逻辑
  803. // var player = new Player({
  804. // size: {
  805. // width: 768,
  806. // height: 1024
  807. // }
  808. // });
  809. // console.log("player====", player, player.canvas);
  810. // // document.body.appendChild(player.canvas);
  811. // // var urlss = url[2]
  812. // var urlss = 'test.androidscloud.com'
  813. // for (var i = 0; i <= homeList; i++) {
  814. // console.log("i=============",i,homeList);
  815. // }
  816. // var secanv = document.getElementById("wine");
  817. // secanv.appendChild(player.canvas);
  818. // // var strhost = Number(data.clientType) ===2? "wss://"+ urlss +"/shareWebSocket?clientType=2&username="+data.username+"&userCardId="+data.userCardId+"&ip="+data.ip : Number(data.clientType) ===3?"wss://"+ urlss +"/authVideoWebSocket?clientType=3&username="+data.username+"&userCardId="+data.userCardId :"wss://"+ urlss +"/videoWebSocket?clientType="+ data.clientType +"&cardIp="+data.cardIp +"&port="+ data.port +"&sn="+data.sn;
  819. // var strhost = "wss://" + urlss + "/videoWebSocket?clientType=" + data.clientType + "&cardIp=" + data.cardIp +
  820. // "&port=" + data.port + "&sn=" + data.sn;
  821. // var client = new WebSocket(strhost);
  822. // console.log('wsssss==============', client)
  823. // client.binaryType = 'arraybuffer';
  824. // // debugger
  825. // client.onopen = function(evt) {
  826. // // onOpen(evt)
  827. // };
  828. // client.onclose = function(evt) {
  829. // // onClose(evt)
  830. // };
  831. // client.onmessage = function(evt) {
  832. // onMessage(evt)
  833. // };
  834. // client.onerror = function(evt) {
  835. // // onError(evt)
  836. // };
  837. function onMessage(evt) {
  838. console.log("onMessage==============", evt);
  839. var messageData = new Uint8Array(evt.data);
  840. player.decode(messageData);
  841. }
  842. $("canvas").on("click", function() {
  843. client.close()
  844. // ?clientType=0&cardIp=30.30.30.42&port=9100&sn=RK3930C2301900042&demoTime=3600&id=3
  845. setTimeout(() => {
  846. wx.miniProgram.navigateTo({
  847. url: '/pages/trialInterface/trialInterface?clientType=' + data.clientType + "&cardIp=" + data.cardIp +
  848. "&port=" + data.port + "&sn=" + data.sn + "&username=" + data.username + "&userCardId=" + data.userCardId +
  849. "&demoTime=3600&id=" + data.id + "&diskName=" + decodeURI(data.diskName)
  850. })
  851. }, 100);
  852. })
  853. $(".helps").click(function() {
  854. // wx.miniProgram.navigateTo({
  855. // url: '/pages/viewurl/viewurl'
  856. // })
  857. //按点击处理
  858. var set = $('.helps').attr("data-id")
  859. if (set == '1') {
  860. $('.helps').attr({
  861. "data-id": "2"
  862. })
  863. $(".helps").hide();
  864. $(".help").css({
  865. "right": "0"
  866. })
  867. } else {
  868. $('.helps').attr({
  869. "data-id": "1"
  870. })
  871. $(".help").css({
  872. "right": "-4rem"
  873. })
  874. }
  875. });
  876. function stopPropagation(e) {
  877. if (e.stopPropagation)
  878. e.stopPropagation();
  879. else
  880. e.cancelBubble = true;
  881. }
  882. $(document).bind('click', function() {
  883. $(".help").css({
  884. "right": "-4rem"
  885. })
  886. $('.helps').attr({
  887. "data-id": "1"
  888. })
  889. $(".helps").show();
  890. });
  891. $('.helpfont').bind('click', function(e) {
  892. console.log("帮助啊啊");
  893. // stopPropagation(e);
  894. wx.miniProgram.navigateTo({
  895. url: '/pages/viewurl/viewurl'
  896. })
  897. });
  898. $('.buyIcon,.kp_btn').bind('click', function(e) {
  899. console.log("购买");
  900. // stopPropagation(e);
  901. wx.miniProgram.navigateTo({
  902. url: '/pages/order/buy/index'
  903. })
  904. });
  905. // $('.homeRenew').bind('click', function(e) {
  906. // console.log("续费啊");
  907. // // stopPropagation(e);
  908. // wx.miniProgram.navigateTo({
  909. // url: '/pages/order/buy/index'
  910. // })
  911. // });
  912. $(".homeRenew").on("click", function() {
  913. console.log("续费啊");
  914. wx.miniProgram.navigateTo({
  915. url: '/pages/order/renew/index'
  916. })
  917. });
  918. $('.helps').bind('click', function(e) {
  919. stopPropagation(e);
  920. });
  921. //
  922. // var player = new Player({
  923. // size: {
  924. // width: 1280,
  925. // height: 720
  926. // }
  927. // });
  928. // var secanv = document.getElementById("wine");
  929. // secanv.appendChild(player.canvas);
  930. // var players = AV.Player.fromWebSocket("ws://" + urlss + '/videoWebSocket?' + "clientType=" + data.clientType +
  931. // "&cardIp=" + data.cardIp + "&port=" + data.port + "&sn=" + data.sn);
  932. // players.play();
  933. $(".boximg").on("click", function() {
  934. $(".mainbox").css({
  935. "display": "none"
  936. })
  937. $(".maxs").css({
  938. "display": "none"
  939. })
  940. })
  941. $(".maxs").on("click", function() {
  942. $(".mainbox").css({
  943. "display": "none"
  944. })
  945. $(".maxs").css({
  946. "display": "none"
  947. })
  948. })
  949. $(".addto").on("click", function() {
  950. $(".mainbox").css({
  951. "display": "block"
  952. })
  953. $(".maxs").css({
  954. "display": "block"
  955. })
  956. })
  957. $(".notLoggedin-bt").on("click", function() {
  958. // $(".mainbox").css({
  959. // "display": "block"
  960. // })
  961. // $(".maxs").css({
  962. // "display": "block"
  963. // })
  964. })
  965. function selectText(x) {
  966. if (document.selection) {
  967. var range = document.body.createTextRange();
  968. range.moveToElementText(x);
  969. range.select();
  970. } else if (window.getSelection) {
  971. var selection = window.getSelection();
  972. var range = document.createRange();
  973. selection.removeAllRanges();
  974. range.selectNodeContents(x);
  975. selection.addRange(range);
  976. }
  977. }
  978. function cp(x) {
  979. $(".mainbox").css({
  980. "display": "none"
  981. })
  982. $(".sbox").css({
  983. "display": "block"
  984. })
  985. selectText(x);
  986. document.execCommand("copy");
  987. alert("复制成功")
  988. }
  989. </script>
  990. </body>
  991. </html>