device.vue 21 KB

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