homeNew.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724
  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=102">
  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. text-align: center;
  147. font-size: 18px;
  148. /* background: #fff; */
  149. /* height: 667px; */
  150. height:100%;
  151. /* Center slide text vertically */
  152. display: -webkit-box;
  153. display: -ms-flexbox;
  154. display: -webkit-flex;
  155. display: flex;
  156. -webkit-box-pack: center;
  157. -ms-flex-pack: center;
  158. -webkit-justify-content: center;
  159. justify-content: center;
  160. -webkit-box-align: center;
  161. -ms-flex-align: center;
  162. -webkit-align-items: center;
  163. align-items: center;
  164. }
  165. .swiper-button-next{
  166. width: 15px;
  167. height: 15px;
  168. background: url(../static/img/xia_icon.png);
  169. }
  170. .swiper-button-prev{
  171. width: 15px;
  172. height: 15px;
  173. background: url(../static/img/shang_icon.png);
  174. }
  175. .swiper-button-next:after, .swiper-container-rtl .swiper-button-prev:after{
  176. content: "" !important;
  177. }
  178. .swiper-button-prev:after, .swiper-container-rtl .swiper-button-next:after{
  179. content: "" !important;
  180. }
  181. </style>
  182. </head>
  183. <body style="background: #F8F9FA;">
  184. <div style="width: 100%;height: 100%;">
  185. <!-- <div class="canvas" style="display: none;">
  186. <div id="wine" style="height: 90%;">
  187. </div>
  188. <div class="camvas-head">
  189. <div class="vip">
  190. <img class="vipimg" src="../static/img/vip_icon.png"></img>
  191. <text class="diskName"></text>
  192. </div>
  193. <div class="canvastime"></div>
  194. </div>
  195. </div> -->
  196. <!-- Swiper -->
  197. <div class="newhelp" style="z-index: 50;">
  198. <div class="helpImg">
  199. <img src="../static/img/bangzu_icon.png" />
  200. </div>
  201. <div class="font helpfont">使用帮助?</div>
  202. </div>
  203. <div class="buyIcon" style="z-index: 50;">
  204. <img src="../static/img/goumai_icon.png" />
  205. </div>
  206. <div class="swiper-container">
  207. <div class="swiper-wrapper">
  208. <div class="swiper-slide">
  209. <div class="canvas" style="display: none;z-index: 1;">
  210. <div id="wine" style="height: 100%;">
  211. </div>
  212. <div class="camvas-head" style="z-index: 5555;">
  213. <div class="tophead">
  214. <div class="th_left">
  215. <img src="../static/img/xingyao_icon.png" />
  216. </div>
  217. <div class="th_right">
  218. <div class="thl-font">是南瓜哥哥啊</div>
  219. <div class="thl-time">剩29天6小时</div>
  220. </div>
  221. </div>
  222. <div class="th_renew homeRenew" style="z-index: 5000;">
  223. 续费
  224. </div>
  225. <!-- <div class="vip">
  226. <img class="vipimg" src="../static/img/vip_icon.png"></img>
  227. <text class="diskName">885752258</text>
  228. </div>
  229. <div class="canvastime"></div> -->
  230. </div>
  231. </div>
  232. </div>
  233. <div class="swiper-slide">
  234. <div class="canvas" style="display: none;">
  235. <div id="wine" style="height: 100%;">
  236. </div>
  237. <div class="camvas-head">
  238. <div class="tophead">
  239. <div class="th_left">
  240. <img src="../static/img/xingyao_icon.png" />
  241. </div>
  242. <div class="th_right">
  243. <div class="thl-font">是南瓜哥哥啊</div>
  244. <div class="thl-time">剩29天6小时</div>
  245. </div>
  246. </div>
  247. <div class="th_renew">
  248. 续费
  249. </div>
  250. </div>
  251. </div>
  252. </div>
  253. <div class="swiper-slide">
  254. <div class="canvas" style="display: none;">
  255. <div id="wine" style="height: 100%;">
  256. </div>
  257. <div class="camvas-head">
  258. <div class="tophead">
  259. <div class="th_left">
  260. <img src="../static/img/xingyao_icon.png" />
  261. </div>
  262. <div class="th_right">
  263. <div class="thl-font">是南瓜哥哥啊</div>
  264. <div class="thl-time">剩29天6小时</div>
  265. </div>
  266. </div>
  267. <div class="th_renew">
  268. 续费
  269. </div>
  270. </div>
  271. </div>
  272. </div>
  273. <div class="swiper-slide">
  274. <div class="canvas" style="display: none;">
  275. <div id="wine" style="height: 100%;" class="kongWine">
  276. <div class="kphone">
  277. <div class="kp_img">
  278. <img src="../static/img/goumai_pic.png" />
  279. </div>
  280. <div class="kp_btn">
  281. 购买云手机
  282. </div>
  283. </div>
  284. </div>
  285. <!-- <div class="camvas-head">
  286. <div class="tophead">
  287. <div class="th_left">
  288. <img src="../static/img/xingyao_icon.png" />
  289. </div>
  290. <div class="th_right">
  291. <div class="thl-font">是南瓜哥哥啊</div>
  292. <div class="thl-time">剩29天6小时</div>
  293. </div>
  294. </div>
  295. <div class="th_renew">
  296. 续费
  297. </div>
  298. </div> -->
  299. </div>
  300. </div>
  301. </div>
  302. <!-- Add Arrows -->
  303. <div class="swiper-button-next"></div>
  304. <div class="swiper-button-prev"></div>
  305. </div>
  306. <!-- 没登录状态 -->
  307. <div class="canvasfalse" style="display: none;">
  308. <div class="notLoggedin">
  309. <image src="../static/img/tianjiashouji_pic.png"></image>
  310. </div>
  311. <!-- 审核-->
  312. <div id="showsuss">
  313. <div class="notLoggedin-text">
  314. <div>下载云手机</div>
  315. <div>体验更多功能</div>
  316. </div>
  317. <div class="notLoggedin-bt">
  318. 立即下载
  319. </div>
  320. </div>
  321. </div>
  322. <!--<div class="addto">
  323. <img class="addto-img" src="../static/img/tianjia_icon.png"></img>
  324. </div>-->
  325. <!-- <div class="help">使用帮助?</div>
  326. <div class="helps" data-id="1">
  327. <img class="helps-img" src="../static/img/bangzu_icon.png">
  328. </div> -->
  329. <div class="maxs" style="display: none;">
  330. <div class="mainbox" style="display: none;">
  331. <div class="boxTitle">提示</div>
  332. <div class="boxText">
  333. <div>由于小程序的功能限制,此功能暂时</div>
  334. <div>无法使用,请下载APP使用更多功能</div>
  335. </div>
  336. <!--<div class="boxbt" onclick="cp(document.getElementById('user_ref_id'));">立即前往下载</div>-->
  337. <div class="boxbt" onclick="cp(document.getElementById('user_ref_id'));">立即前往下载</div>
  338. <div class="boximg"><img src="../static/img/wx/guanbi_icon.png"></div>
  339. </div>
  340. </div>
  341. </div>
  342. <div id="copy-txt" style="position: absolute;opacity: 0;">
  343. <span id="user_ref_id">www.androidsCloud.com</span>
  344. </div>
  345. <script>
  346. var swiper = new Swiper('.swiper-container', {
  347. navigation: {
  348. nextEl: '.swiper-button-next',
  349. prevEl: '.swiper-button-prev',
  350. },
  351. });
  352. </script>
  353. <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.0.js"></script>
  354. <!-- 视频-->
  355. <script src="../static/js/jquery-1.11.0.min.js"></script>
  356. <script type="text/javascript" src="../static/js/Decoder.js"></script>
  357. <script type="text/javascript" src="../static/js/YUVCanvas.js"></script>
  358. <script type="text/javascript" src="../static/js/Player.js"></script>
  359. <script type="text/javascript">
  360. let hheight = document.body.clientHeight;
  361. let cheight = document.body.offsetHeight;
  362. console.log("获取网页高度", hheight, cheight, window.screen.height);
  363. $(".swiper-container").css("height", window.screen.height);
  364. var url = window.location.href;
  365. url = url.split('/')
  366. console.log(url)
  367. // var baseUrl = 'https://' + url[2] //'http://192.168.31.159'//'http://' + url[2]
  368. // var baseUrl = 'http://192.168.31.20'
  369. var baseUrl = 'https://test.androidscloud.com';
  370. var query = window.location.search.substring(1);
  371. var vars = query.split("&");
  372. // var urls = "https://xcx.androidscloud.com"
  373. // 审核
  374. $.ajax({
  375. url: baseUrl + "/api/user/v1/config/download/isShow",
  376. data: {},
  377. type: 'get',
  378. dataType: 'json',
  379. success: function(data) {
  380. if (data.data) {
  381. $("#showsuss").show()
  382. } else {
  383. $("#showsuss").hide()
  384. }
  385. //
  386. }
  387. })
  388. // var baseUrl = window.location.href; //"http://192.168.31.20"
  389. document.body.addEventListener('touchmove', function(e) {
  390. e.preventDefault()
  391. }, {
  392. passive: false
  393. })
  394. var data = {}
  395. var clientType = vars.find(e => {
  396. return e.startsWith('clientType')
  397. }) || ''
  398. var cardIp = vars.find(e => {
  399. return e.startsWith('cardIp')
  400. }) || ''
  401. var port = vars.find(e => {
  402. return e.startsWith('port')
  403. }) || ''
  404. var sn = vars.find(e => {
  405. return e.startsWith('sn')
  406. }) || ''
  407. var demoTime = vars.find(e => {
  408. return e.startsWith('demoTime')
  409. }) || ''
  410. var id = vars.find(e => {
  411. return e.startsWith('id')
  412. }) || ''
  413. var vip = vars.find(e => {
  414. return e.startsWith('vip')
  415. }) || ''
  416. var diskName = vars.find(e => {
  417. return e.startsWith('diskName')
  418. }) || ''
  419. var times = vars.find(e => {
  420. return e.startsWith('times')
  421. }) || ''
  422. var username = vars.find(e => {
  423. return e.startsWith('username')
  424. }) || ''
  425. var userCardId = vars.find(e => {
  426. return e.startsWith('userCardId')
  427. }) || ''
  428. var ip = vars.find(e => {
  429. return e.startsWith('ip')
  430. }) || ''
  431. // $(".aaa").text(clientType.substring(11, clientType.length))
  432. // let cardIp = getUrlParam('cardIp');
  433. // console.log(cardIp)
  434. getQueryString: (name) => {
  435. let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  436. let r = window.location.search.substr(1).match(reg);
  437. console.log(name)
  438. if (r != null) {
  439. return unescape(decodeURI(r[2]));
  440. return null;
  441. }
  442. }
  443. data.clientType = clientType.substring(11, clientType.length)
  444. data.cardIp = cardIp.substring(7, cardIp.length)
  445. data.port = port.substring(5, port.length)
  446. data.sn = sn.substring(3, sn.length)
  447. data.demoTime = demoTime.substring(9, demoTime.length)
  448. data.id = id.substring(3, id.length)
  449. data.vip = vip.substring(4, vip.length)
  450. data.diskName = diskName.substring(9, diskName.length)
  451. data.times = times.substring(6, times.length)
  452. data.username = username.substring(9, username.length)
  453. data.userCardId = userCardId.substring(11, userCardId.length)
  454. data.ip = ip.substring(3, ip.length)
  455. let timestext = "剩" + decodeURI(data.times) || data.demoTime / 3600 + "小时"
  456. $(".diskName").text(decodeURI(data.diskName) || data.username)
  457. console.log("timestext>>>>>>", timestext);
  458. $(".canvastime").text(timestext)
  459. if (data.vip == "0") {
  460. $(".canvasfalse").css({
  461. "display": "block"
  462. })
  463. $(".canvas").css({
  464. "display": "none"
  465. })
  466. } else {
  467. $(".canvas").css({
  468. "display": "block"
  469. })
  470. $(".canvasfalse").css({
  471. "display": "none"
  472. })
  473. }
  474. // 云手机相关逻辑
  475. var player = new Player({
  476. size: {
  477. width: 768,
  478. height: 1024
  479. }
  480. });
  481. // document.body.appendChild(player.canvas);
  482. // var urlss = url[2]
  483. var urlss = 'test.androidscloud.com'
  484. var secanv = document.getElementById("wine");
  485. secanv.appendChild(player.canvas);
  486. // 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;
  487. var strhost = "wss://" + urlss + "/videoWebSocket?clientType=" + data.clientType + "&cardIp=" + data.cardIp +
  488. "&port=" + data.port + "&sn=" + data.sn;
  489. var client = new WebSocket(strhost);
  490. console.log('wsssss==============', client)
  491. client.binaryType = 'arraybuffer';
  492. // debugger
  493. client.onopen = function(evt) {
  494. // onOpen(evt)
  495. };
  496. client.onclose = function(evt) {
  497. // onClose(evt)
  498. };
  499. client.onmessage = function(evt) {
  500. onMessage(evt)
  501. };
  502. client.onerror = function(evt) {
  503. // onError(evt)
  504. };
  505. function onMessage(evt) {
  506. console.log("onMessage==============", evt);
  507. var messageData = new Uint8Array(evt.data);
  508. player.decode(messageData);
  509. }
  510. $("canvas").on("click", function() {
  511. client.close()
  512. // ?clientType=0&cardIp=30.30.30.42&port=9100&sn=RK3930C2301900042&demoTime=3600&id=3
  513. setTimeout(() => {
  514. wx.miniProgram.navigateTo({
  515. url: '/pages/trialInterface/trialInterface?clientType=' + data.clientType + "&cardIp=" + data.cardIp +
  516. "&port=" + data.port + "&sn=" + data.sn + "&username=" + data.username + "&userCardId=" + data.userCardId +
  517. "&demoTime=3600&id=" + data.id + "&diskName=" + decodeURI(data.diskName)
  518. })
  519. }, 100);
  520. })
  521. $(".helps").click(function() {
  522. // wx.miniProgram.navigateTo({
  523. // url: '/pages/viewurl/viewurl'
  524. // })
  525. //按点击处理
  526. var set = $('.helps').attr("data-id")
  527. if (set == '1') {
  528. $('.helps').attr({
  529. "data-id": "2"
  530. })
  531. $(".helps").hide();
  532. $(".help").css({
  533. "right": "0"
  534. })
  535. } else {
  536. $('.helps').attr({
  537. "data-id": "1"
  538. })
  539. $(".help").css({
  540. "right": "-4rem"
  541. })
  542. }
  543. });
  544. function stopPropagation(e) {
  545. if (e.stopPropagation)
  546. e.stopPropagation();
  547. else
  548. e.cancelBubble = true;
  549. }
  550. $(document).bind('click', function() {
  551. $(".help").css({
  552. "right": "-4rem"
  553. })
  554. $('.helps').attr({
  555. "data-id": "1"
  556. })
  557. $(".helps").show();
  558. });
  559. $('.helpfont').bind('click', function(e) {
  560. console.log("帮助啊啊");
  561. // stopPropagation(e);
  562. wx.miniProgram.navigateTo({
  563. url: '/pages/viewurl/viewurl'
  564. })
  565. });
  566. $('.buyIcon').bind('click', function(e) {
  567. console.log("购买");
  568. // stopPropagation(e);
  569. wx.miniProgram.navigateTo({
  570. url: '/pages/order/buy/index'
  571. })
  572. });
  573. // $('.homeRenew').bind('click', function(e) {
  574. // console.log("续费啊");
  575. // // stopPropagation(e);
  576. // wx.miniProgram.navigateTo({
  577. // url: '/pages/order/buy/index'
  578. // })
  579. // });
  580. $(".homeRenew").on("click", function() {
  581. console.log("续费啊");
  582. });
  583. $('.helps').bind('click', function(e) {
  584. stopPropagation(e);
  585. });
  586. //
  587. // var player = new Player({
  588. // size: {
  589. // width: 1280,
  590. // height: 720
  591. // }
  592. // });
  593. // var secanv = document.getElementById("wine");
  594. // secanv.appendChild(player.canvas);
  595. // var players = AV.Player.fromWebSocket("ws://" + urlss + '/videoWebSocket?' + "clientType=" + data.clientType +
  596. // "&cardIp=" + data.cardIp + "&port=" + data.port + "&sn=" + data.sn);
  597. // players.play();
  598. $(".boximg").on("click", function() {
  599. $(".mainbox").css({
  600. "display": "none"
  601. })
  602. $(".maxs").css({
  603. "display": "none"
  604. })
  605. })
  606. $(".maxs").on("click", function() {
  607. $(".mainbox").css({
  608. "display": "none"
  609. })
  610. $(".maxs").css({
  611. "display": "none"
  612. })
  613. })
  614. $(".addto").on("click", function() {
  615. $(".mainbox").css({
  616. "display": "block"
  617. })
  618. $(".maxs").css({
  619. "display": "block"
  620. })
  621. })
  622. $(".notLoggedin-bt").on("click", function() {
  623. // $(".mainbox").css({
  624. // "display": "block"
  625. // })
  626. // $(".maxs").css({
  627. // "display": "block"
  628. // })
  629. })
  630. function selectText(x) {
  631. if (document.selection) {
  632. var range = document.body.createTextRange();
  633. range.moveToElementText(x);
  634. range.select();
  635. } else if (window.getSelection) {
  636. var selection = window.getSelection();
  637. var range = document.createRange();
  638. selection.removeAllRanges();
  639. range.selectNodeContents(x);
  640. selection.addRange(range);
  641. }
  642. }
  643. function cp(x) {
  644. $(".mainbox").css({
  645. "display": "none"
  646. })
  647. $(".sbox").css({
  648. "display": "block"
  649. })
  650. selectText(x);
  651. document.execCommand("copy");
  652. alert("复制成功")
  653. }
  654. </script>
  655. </body>
  656. </html>