device.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877
  1. <template>
  2. <div id="device_container">
  3. <view>
  4. <text class="cuIcon-titles text-primary"></text>
  5. <text class="">我的设备</text>
  6. </view>
  7. <div class="device padding">
  8. <!-- 未连接部分-->
  9. <div v-if="connect_toy == 0">
  10. <div
  11. class="connect_box"
  12. v-if="device_status == 0 && connect_show == false"
  13. >
  14. <device_unconnect @open_scan="open_scan"></device_unconnect>
  15. </div>
  16. <!-- 连接中-->
  17. <div
  18. class="connecting_box"
  19. v-if="device_status != 0 && connect_show == false"
  20. >
  21. <device_connecting :status="device_status"></device_connecting>
  22. </div>
  23. <!-- 已链接 -->
  24. <div class="connected_box" v-if="connect_show">
  25. <device_connected
  26. @open_choose_toy="open_choose_toy"
  27. @change_brain_status="change_device_status"
  28. :device_bg="device_bg"
  29. :device_power="device_power"
  30. :rssi="rssi"
  31. ></device_connected>
  32. </div>
  33. </div>
  34. <div v-else>
  35. <!-- 玩具模块-->
  36. <!-- 玩具连接中-->
  37. <div class="connecting_toy">
  38. <toy_connecting
  39. :connect_toy="connect_toy"
  40. :toy_id="toy_action"
  41. :toy="toy_item"
  42. :toy_sn="toy_sn"
  43. :device_bg="device_bg"
  44. :device_power="device_power"
  45. :toy_power="toy_power"
  46. @open_choose_toy="open_choose_toy"
  47. @change_toy_connect_status="change_toy_connect_status"
  48. @change_status="change_device_status"
  49. @gameStart="gameStart"
  50. ></toy_connecting>
  51. </div>
  52. </div>
  53. </div>
  54. <!-- 选择玩具-->
  55. <van-popup
  56. :show="choose_toy_window.show"
  57. @close="on_close"
  58. position="bottom"
  59. round
  60. closeable
  61. safe-area-inset-bottom
  62. >
  63. <!-- 标题 -->
  64. <div class="head padding">
  65. <div>
  66. <div class="line"></div>
  67. <div class="title">选择教具</div>
  68. </div>
  69. </div>
  70. <!-- 内容 -->
  71. <div class="padding toy_list">
  72. <van-row gutter="14" class="toy_list_content">
  73. <van-col
  74. v-for="(toy, index) in toy_list"
  75. :key="index"
  76. class="text-center"
  77. >
  78. <div
  79. class="toy_item flex flex-direction justify-center align-center"
  80. @click="choose_toy(index)"
  81. :class="
  82. toy_action == toy.id
  83. ? 'toy_item_action_bg'
  84. : 'toy_item_normal_bg'
  85. "
  86. >
  87. <img :src="toy.img" alt="" class="toy_img" />
  88. <text class="toy_text padding-top">{{ toy.name }}</text>
  89. </div>
  90. </van-col>
  91. </van-row>
  92. </div>
  93. <!-- 结尾 -->
  94. <div class="toy_actions padding text-center">
  95. <view class="text-gray toy_action_text padding"
  96. >选择你最感兴趣的项目,点击“选好了”以后将会自动连接
  97. </view>
  98. <button
  99. class="cu-btn lg cu-btn-primary text-white text-center padding"
  100. @click="choose_ok"
  101. >
  102. 选好了
  103. </button>
  104. </div>
  105. </van-popup>
  106. <van-toast id="van-toast" />
  107. <van-dialog id="van-dialog" />
  108. </div>
  109. </template>
  110. <script>
  111. //蓝牙未连接
  112. import device_unconnect from "@/components/device/unconnect";
  113. //蓝牙连接中
  114. import device_connecting from "@/components/device/connecting";
  115. //蓝牙完成链接
  116. import device_connected from "@/components/device/connected";
  117. //连接玩具
  118. import toy_connecting from "@/components/device/toy/connecting";
  119. //开始游戏的界面
  120. import gameIng from "@/pages/start/index";
  121. //获取个人信息
  122. import Toast from "../../../static/vant/toast/toast";
  123. import { game_devices, getDeviceBySn } from "../../requests/game";
  124. import game_store from "@/store/game";
  125. import { getNowDate } from "../../utils";
  126. import { LogInDb } from "@/requests/log";
  127. let $this;
  128. export default {
  129. name: "device",
  130. components: {
  131. device_unconnect,
  132. device_connecting,
  133. device_connected,
  134. toy_connecting,
  135. gameIng,
  136. },
  137. data() {
  138. return {
  139. rssi: 0,
  140. //设备状态 0为未连接,1:连接中,2:已连接 3:连接失败
  141. device_status: 0,
  142. // device_status: 2,
  143. connect_show: false,
  144. //设置图标的颜色
  145. device_bg: false,
  146. choose_toy_window: {
  147. show: false,
  148. // show: true,
  149. },
  150. //'水柱音箱', '喷雾恐龙(大)', '喷雾恐龙(小)', '轨道车', '碰碰车', '小车(大)', '小车(中)', '小车(小)', '飞行器(大)', '飞行器(小)', '水母灯'
  151. toy_list: [],
  152. toy_item: {},
  153. toy_action: 1,
  154. // connect_show: true,
  155. //连接玩具 0:未连接 1:连接中 2:已连接 3:连接失败 4:游戏中
  156. connect_toy: 0,
  157. code: "jellyfish1234",
  158. deviceId: "",
  159. _device_index: false,
  160. toy_id: 0,
  161. toy_hex: "",
  162. // 电量
  163. device_power: 0,
  164. //教具电量
  165. toy_power: 0,
  166. //教具名称
  167. toy_sn: "教具",
  168. //UUID
  169. toy_UUID: "",
  170. // 开始游戏模块
  171. start_show: false,
  172. game_status: 0,
  173. //当前发送的hex码
  174. current_hex: "",
  175. //判断是否已经连接教具
  176. toy_connected: false,
  177. device_finded: false,
  178. device_data: {
  179. //产品编码
  180. sn: "",
  181. //产品名称
  182. product_name: "",
  183. //产品型号 :"",
  184. product_model: "",
  185. //产品二维码
  186. product_qrcode: "",
  187. //生产年月日 :"",
  188. production_date: "",
  189. //制造工厂
  190. manufacturing_plan: "",
  191. //硬件版本 :"",
  192. hardware_version: "",
  193. //软件版本
  194. software_version: "",
  195. //蓝牙地址 mac_address
  196. device_id: "",
  197. //蓝牙PC地址
  198. pc_device_id: "",
  199. //ios蓝牙地址
  200. ios_device_id: "",
  201. //设备类型 1脑环 2玩具
  202. type: "",
  203. //UUID
  204. UUID: "",
  205. },
  206. };
  207. },
  208. methods: {
  209. //打开 扫描二维码
  210. open_scan() {
  211. // 打开蓝牙扫描 重置游戏状态
  212. game_store.setters.setGameStatus(0);
  213. wx.getSystemInfoAsync({
  214. success(res) {
  215. if (res.bluetoothEnabled == false) {
  216. wx.showToast({
  217. icon: "none",
  218. title: "请打开蓝牙",
  219. });
  220. } else if (res.locationEnabled == false) {
  221. // 如果是苹果系统则直接打开扫描
  222. if (res.system.indexOf("iOS") != -1) {
  223. $this.scan_to_bluetooth();
  224. } else {
  225. //如果是安卓系统 则提示打开位置信息 后 打开扫描
  226. wx.showToast({
  227. icon: "none",
  228. title: "请打开位置信息",
  229. });
  230. }
  231. } else {
  232. $this.scan_to_bluetooth();
  233. }
  234. },
  235. });
  236. },
  237. //扫描连接蓝牙
  238. scan_to_bluetooth() {
  239. wx.scanCode({
  240. onlyFromCamera: true,
  241. scanType: ["barCode", "qrCode"],
  242. success: (res) => {
  243. let $data = res;
  244. if ($data.result) {
  245. let url = decodeURIComponent($data.result);
  246. let $code = "";
  247. //二维码
  248. if (res.scanType == "QR_CODE") {
  249. $code = url.match(/\?ring=(.*)/)
  250. ? url.match(/\?ring=(.*)/)
  251. : url.match(/\?code=(.*)/);
  252. $code = $code[1].toUpperCase();
  253. } else {
  254. //一维码
  255. $code = res.result.toUpperCase();
  256. }
  257. // 判断新的标识值
  258. $this.code = $code;
  259. //判断是新还是旧
  260. game_store.setters.setIsNew($code.indexOf("AI") != -1);
  261. console.log("头环码", $code);
  262. game_store.setters.setDeviceSn($this.code);
  263. //设备信息
  264. $this.device_data.product_qrcode = url;
  265. $this.device_data.sn = $this.code;
  266. //产品名称、制造工厂
  267. $this.device_data.product_name = "水母智脑环";
  268. $this.device_data.manufacturing_plan = "深圳水母智脑科技有限公司";
  269. // 设备类型
  270. $this.device_data.type = 1;
  271. $this.device_data.production_date = getNowDate();
  272. //打开蓝牙设备
  273. wx.getSystemInfo({
  274. success(res) {
  275. // 判断ios 和 安卓
  276. if (res.platform == "ios") {
  277. wx.openBluetoothAdapter({
  278. //判断主机模式蓝牙是否打开
  279. mode: "central",
  280. success(res) {
  281. //判断已经打开连接了
  282. if (res["errMsg"] == "openBluetoothAdapter:ok") {
  283. // $this.startBluetoothDevicesDiscovery();
  284. wx.openBluetoothAdapter({
  285. //判断从机模式蓝牙是否打开
  286. mode: "peripheral",
  287. success(res) {
  288. if (res["errMsg"] == "openBluetoothAdapter:ok") {
  289. $this.startBluetoothDevicesDiscovery();
  290. }
  291. },
  292. fail(err) {
  293. let $msg =
  294. $this.$bluetooth.GetopenBluetoothAdapterError(
  295. err["errCode"]
  296. );
  297. setTimeout(() => {
  298. Toast.fail({
  299. message: $msg,
  300. });
  301. }, 3000);
  302. },
  303. });
  304. }
  305. },
  306. fail(err) {
  307. let $msg = $this.$bluetooth.GetopenBluetoothAdapterError(
  308. err["errCode"]
  309. );
  310. setTimeout(() => {
  311. Toast.fail({
  312. message: $msg,
  313. });
  314. }, 3000);
  315. },
  316. });
  317. } else {
  318. // 安卓手机
  319. wx.openBluetoothAdapter({
  320. mode: "peripheral",
  321. success(res) {
  322. //判断已经打开连接了
  323. if (res["errMsg"] == "openBluetoothAdapter:ok") {
  324. $this.startBluetoothDevicesDiscovery();
  325. }
  326. },
  327. fail(err) {
  328. let $msg = $this.$bluetooth.GetopenBluetoothAdapterError(
  329. err["errCode"]
  330. );
  331. setTimeout(() => {
  332. Toast.fail({
  333. message: $msg,
  334. });
  335. }, 3000);
  336. },
  337. });
  338. }
  339. },
  340. });
  341. }
  342. },
  343. fail(res) {
  344. console.log(res);
  345. },
  346. });
  347. },
  348. //关闭窗口的方法
  349. on_close() {
  350. $this.choose_toy_window.show = false;
  351. },
  352. //选择玩具
  353. choose_toy($index) {
  354. $this.toy_action = $this.toy_list[$index].id;
  355. },
  356. // 打开选择玩具窗口
  357. open_choose_toy() {
  358. // $this.choose_toy_window.show = false;
  359. $this.choose_toy_window.show = true;
  360. $this.toy_connected = false;
  361. $this.$bluetooth.SendOrder("09");
  362. },
  363. // 选好玩具
  364. choose_ok() {
  365. $this.on_close();
  366. $this.change_toy_connect_status(1);
  367. $this._device_index = $this.toy_action - 1;
  368. //获取玩具
  369. let $toy = {};
  370. $this.toy_list.forEach(($val, $index) => {
  371. if ($val["id"] == $this.toy_action) {
  372. $this.toy_item = $toy = $val;
  373. }
  374. });
  375. $this.toy_id = $toy.id;
  376. let $hex = ($this.toy_hex = $toy["hex"].substr(
  377. $toy["hex"].length - 2,
  378. 2
  379. ));
  380. //连接玩具
  381. $this.current_hex = `03 00 ${$hex} 00 0a`;
  382. $this.$bluetooth.sendConnectOneToMore($hex);
  383. //2022-5-25 09:07:59 设置10秒后是否已经连接
  384. setTimeout(() => {
  385. if ($this.toy_connected == false) {
  386. $this.change_toy_connect_status(3);
  387. }
  388. }, 10000);
  389. },
  390. //修改玩具连接状态
  391. change_toy_connect_status($status = 0) {
  392. $this.connect_toy = $status;
  393. if ($status == 1) {
  394. $this.connect_show = true;
  395. } else {
  396. $this.connect_show = false;
  397. }
  398. },
  399. // 修改设备连接状态
  400. change_device_status($status = 0) {
  401. $this.device_status = $status;
  402. //当蓝牙连接已断开
  403. //当脑环断开
  404. if ($status == 0) {
  405. game_store.setters.setGameStatus(0);
  406. // 清空链接得设备 三值
  407. $this.connect_toy = $status;
  408. $this.connect_show = false;
  409. $this.device_bg = false;
  410. $this.$bluetooth.SendOrder("09");
  411. let deviceId = game_store.getters.getDeviceId();
  412. $this.change_toy_connect_status(0);
  413. //断开蓝牙连接
  414. wx.closeBLEConnection({
  415. deviceId: deviceId,
  416. success(res) {
  417. Toast.success({
  418. message: "已成功断开",
  419. });
  420. game_store.setters.clearDeviceToy();
  421. wx.closeBluetoothAdapter();
  422. },
  423. fail(res) {
  424. console.log("断开连接error:", res);
  425. },
  426. complete(res) {
  427. $this.device = {};
  428. $this.toy_UUID = "";
  429. $this.$forceUpdate();
  430. },
  431. });
  432. } else if ($status == 2) {
  433. $this.connect_show = true;
  434. }
  435. },
  436. //开始蓝牙被发现
  437. startBluetoothDevicesDiscovery() {
  438. wx.startBluetoothDevicesDiscovery({
  439. allowDuplicatesKey: true,
  440. success: (res) => {
  441. //2021年10月21日15:07:57 通过sn 返回deviceId
  442. getDeviceBySn($this.code).then((res) => {
  443. let $data = res.data;
  444. console.log($data.code);
  445. $this.change_device_status(1);
  446. $data = $data.data;
  447. wx.getSystemInfo({
  448. success(res) {
  449. // 判断ios 和 安卓
  450. if (res.platform == "ios") {
  451. $this.onBluetoothDeviceFound();
  452. } else {
  453. if ($data.device_id) {
  454. console.log("finded");
  455. $this.device_finded = true;
  456. $this.createBLEConnection($data.device_id);
  457. } else {
  458. $this.device_finded = false;
  459. console.log("unfinded");
  460. $this.onBluetoothDeviceFound();
  461. }
  462. }
  463. },
  464. });
  465. });
  466. },
  467. fail(err) {
  468. $this.change_device_status(3);
  469. },
  470. });
  471. },
  472. //打开蓝牙搜索
  473. onBluetoothDeviceFound() {
  474. try {
  475. // 5秒后判断 这5秒在搜索设备,搜索到就赋值给_deviceId
  476. // setTimeout(() => {
  477. // if ($this.device_data.deviceId == "") {
  478. // wx.stopBluetoothDevicesDiscovery();
  479. // $this.change_device_status(0);
  480. // Toast.fail("未连接到设备");
  481. // }
  482. // }, 5000);
  483. // 小乌龟
  484. wx.onBluetoothDeviceFound((res) => {
  485. res.devices.forEach((device) => {
  486. if (!device.name && !device.localName) {
  487. return;
  488. }
  489. if (device.localName && device.localName != "") {
  490. device.name = device.localName;
  491. }
  492. if (device["name"].toUpperCase() == $this.code) {
  493. $this.stopBluetoothDevicesDiscovery();
  494. console.log("搜索设备", device);
  495. $this.createBLEConnection(device.deviceId);
  496. $this.device_data.deviceId = device.deviceId;
  497. }
  498. });
  499. });
  500. } catch (e) {
  501. console.log("打开蓝牙error", e);
  502. }
  503. },
  504. // 停止蓝牙搜索
  505. stopBluetoothDevicesDiscovery() {
  506. wx.stopBluetoothDevicesDiscovery();
  507. },
  508. //连接低功耗蓝牙设备。
  509. createBLEConnection(deviceId) {
  510. wx.createBLEConnection({
  511. deviceId: deviceId,
  512. success: (res) => {
  513. LogInDb(`${$this.code},连接成功`)
  514. $this.$bluetooth.current_device_sn = $this.code;
  515. game_store.setters.setDeviceId(deviceId);
  516. //成功连接脑环蓝牙
  517. $this.change_device_status(2);
  518. $this.$bluetooth.getBLEDeviceServices(deviceId);
  519. let $checkServices = setInterval(() => {
  520. let $serviceId = game_store.getters.getServiceId();
  521. if ($serviceId) {
  522. clearInterval($checkServices);
  523. $this.$bluetooth.openNotify($this);
  524. $this.$bluetooth.watchingDevice($this);
  525. $this.$bluetooth.watch_bluetooth_status($this);
  526. //录入库
  527. //读取信息逐个写入
  528. if (!$this.device_finded) {
  529. setTimeout(() => {
  530. $this.$bluetooth.SendOrder("02");
  531. }, 3000);
  532. }
  533. }
  534. }, 1500);
  535. },
  536. fail(err) {
  537. console.log(err);
  538. },
  539. });
  540. },
  541. // 获取游戏设备玩具
  542. get_toy_list() {
  543. // 清空toy_list
  544. $this.toy_list = [];
  545. game_devices().then((res) => {
  546. let $data = res.data;
  547. let $toylist = $data.data;
  548. let _item = {};
  549. $toylist.forEach(($val, $index) => {
  550. _item = {
  551. id: parseInt($val["device_id"]),
  552. name: $val["name"],
  553. img: "https://img.shuimuai.com/" + $val["img"],
  554. hex: $val["bluetooth"],
  555. };
  556. $this.toy_list.push(_item);
  557. });
  558. game_store.setters.setToyList($this.toy_list);
  559. });
  560. },
  561. onStartGameShowClose() {
  562. $this.start_show = false;
  563. $this.game_status = 0;
  564. },
  565. gameStart() {
  566. $this.game_status = 1;
  567. $this.connect_toy = 4;
  568. },
  569. },
  570. mounted() {
  571. $this.get_toy_list();
  572. },
  573. created() {
  574. $this = this;
  575. },
  576. onShow() {
  577. //判断是否游戏中
  578. let $game_status = game_store.getters.getGameStatus();
  579. // 游戏过程中关闭脑环状态
  580. let $game_close_status = game_store.getters.getGameCloseStatus();
  581. console.log("返回时:" + $game_status, $game_close_status);
  582. let $ble_status = wx.getStorageSync("ble_link_status");
  583. if ($ble_status == false) {
  584. //断开蓝牙连接
  585. $this.change_device_status(0);
  586. }
  587. if ($game_status == 3) {
  588. //不在游戏状态
  589. $this.connect_toy = 0;
  590. $this.connect_show = true;
  591. $this.$bluetooth.watchingDevice($this);
  592. $this.$bluetooth.watch_bluetooth_status($this);
  593. $this.toy_UUID = "";
  594. $this.$forceUpdate();
  595. // 状态为1的时候重置为1 小乌龟
  596. if ($game_close_status == 1) {
  597. // 重置默认条件
  598. $this.connect_toy = 0;
  599. $this.connect_show = false;
  600. $this.device_status = 0;
  601. $this.$bluetooth.watch_bluetooth_status($this);
  602. $this.toy_UUID = "";
  603. $this.$forceUpdate();
  604. // 清空链接的设备
  605. game_store.setters.clearDeviceToy();
  606. }
  607. }
  608. },
  609. onHide() {
  610. // game_store.setters.setGameStatus(0);
  611. },
  612. onLoad(options) {
  613. // 原有的code
  614. let $_code = wx.getStorageSync("code");
  615. if (options.q) {
  616. let url = decodeURIComponent(options.q);
  617. let $code = url.match(/\?code=(.*)/)[1];
  618. //判断新的code 和 旧的code 是否一致 不一致则重新登录
  619. console.log("1---" + $_code, "2---" + $code);
  620. if ($_code && $_code != $code) {
  621. Toast.fail("该用户已绑定邀请码");
  622. }
  623. }
  624. },
  625. };
  626. </script>
  627. <!--共有样式-->
  628. <style>
  629. .second_device_text {
  630. position: relative;
  631. bottom: 5px;
  632. }
  633. .connect_img {
  634. width: 85px;
  635. height: 80px;
  636. }
  637. /*玩具不同背景*/
  638. .toy_item_normal_bg {
  639. background-image: url("https://img.shuimuai.com/web/toy_bg.png");
  640. background-position: center;
  641. background-size: 100% 100%;
  642. }
  643. /*玩具选中背景*/
  644. .toy_item_action_bg {
  645. background-image: url("https://img.shuimuai.com/web/toy_bg_action.png");
  646. background-position: center;
  647. background-size: 100% 100%;
  648. }
  649. .ring_2 {
  650. width: 199px;
  651. height: 203px;
  652. background: rgba(93, 77, 184, 0);
  653. border: 2px solid #f7f7f7;
  654. opacity: 0.43;
  655. border-radius: 50%;
  656. }
  657. .ring_3 {
  658. width: 158px;
  659. height: 158px;
  660. background: rgba(93, 77, 184, 0);
  661. border: 3px solid #f6f6f6;
  662. opacity: 0.54;
  663. border-radius: 50%;
  664. }
  665. .dot_container {
  666. height: 100px;
  667. }
  668. .dot_wait {
  669. height: 5px;
  670. width: 80px;
  671. background-image: url("https://img.shuimuai.com/web/connect_line.png");
  672. background-position: center;
  673. background-size: 100% 100%;
  674. }
  675. .device_phone {
  676. width: 30px;
  677. height: 40px;
  678. bottom: 5px;
  679. }
  680. .device_brain {
  681. width: 40px;
  682. height: 40px;
  683. bottom: 10px;
  684. }
  685. .device_text {
  686. padding: 3px;
  687. font-size: 9px;
  688. }
  689. .moving_dot {
  690. width: 18px;
  691. height: 18px;
  692. position: relative;
  693. left: 15px;
  694. bottom: 7px;
  695. }
  696. .moving {
  697. animation: moving 2s linear infinite;
  698. }
  699. /*左右移动动画*/
  700. @keyframes moving {
  701. 0% {
  702. left: 0px;
  703. }
  704. 50% {
  705. left: 35px;
  706. }
  707. 100% {
  708. left: 0px;
  709. }
  710. }
  711. .cut_brain_icon {
  712. width: 11px;
  713. height: 11px;
  714. }
  715. .cut_text {
  716. font-size: 11px;
  717. }
  718. /*设备绿色信号灯*/
  719. .sign_green {
  720. width: 20px;
  721. height: 10px;
  722. position: relative;
  723. top: 9px;
  724. left: 0;
  725. }
  726. /*水母男孩*/
  727. .connected_boy {
  728. width: 110px;
  729. height: 110px;
  730. position: absolute;
  731. right: -60px;
  732. top: 63px;
  733. }
  734. .boy_session {
  735. background-image: url("https://img.shuimuai.com/web/boy_session.png");
  736. background-position: center;
  737. background-size: 100% 100%;
  738. width: 120px;
  739. height: 100px;
  740. position: absolute;
  741. top: 18px;
  742. right: 25px;
  743. z-index: 4;
  744. }
  745. .boy_session_text {
  746. font-size: 12px;
  747. color: #6b6b6b;
  748. }
  749. .device_electric {
  750. position: relative;
  751. width: 16px;
  752. height: 16px;
  753. top: 0px;
  754. right: 0px;
  755. z-index: 5;
  756. }
  757. /*设备连接模块*/
  758. .device_bg {
  759. width: 90px;
  760. height: 100px;
  761. background-position: center;
  762. background-size: 100% 100%;
  763. background-image: url("https://img.shuimuai.com/web/device_bg.png");
  764. }
  765. .left {
  766. line-height: 32px;
  767. }
  768. </style>
  769. <!--私有样式-->
  770. <style scoped>
  771. #device_container {
  772. position: relative;
  773. bottom: 80px;
  774. }
  775. .head .line {
  776. width: 4px;
  777. height: 14px;
  778. background-color: #5d4db8;
  779. margin-right: 7px;
  780. }
  781. .head view {
  782. display: flex;
  783. justify-self: start;
  784. align-items: center;
  785. }
  786. /*玩具列表*/
  787. .toy_list {
  788. overflow-x: scroll;
  789. }
  790. .toy_item {
  791. margin: 0px auto;
  792. /* width: 120px; */
  793. width: 140px;
  794. height: 130px;
  795. }
  796. /*玩具图片*/
  797. .toy_img {
  798. width: 65px;
  799. height: 65px;
  800. }
  801. .toy_text {
  802. font-size: 12px;
  803. }
  804. .toy_action_text {
  805. font-size: 11px;
  806. width: 100%;
  807. }
  808. /* 选择玩具 */
  809. .toy_list {
  810. width: 100%;
  811. overflow-x: auto;
  812. }
  813. .toy_list_content {
  814. width: 130%;
  815. display: inline-block;
  816. display: flex;
  817. flex-wrap: wrap;
  818. }
  819. /* padding toy_list */
  820. </style>