connecting.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <div>
  3. <van-row class="padding">
  4. <van-col span="5">
  5. <div class="device_bg flex flex-direction align-center justify-center">
  6. <img src="https://img.shuimuai.com/web/phone.png" alt="" class="device_phone">
  7. <text class="text-gray device_text"> 我的手机</text>
  8. </div>
  9. </van-col>
  10. <van-col span="3" offset="1">
  11. <div class="dot_container flex align-center">
  12. <div class="dot_wait">
  13. <img src="https://img.shuimuai.com/m_sign_gou%402x.png" alt="" class="moving_dot">
  14. </div>
  15. </div>
  16. </van-col>
  17. <van-col span="5" offset="0">
  18. <div class="device_bg flex flex-direction align-center justify-center">
  19. <img src="https://img.shuimuai.com/web/sign_green.png" alt="" class="sign_green">
  20. <img src="https://img.shuimuai.com/web/brain.png" alt="" class="device_brain">
  21. <text class="text-gray device_text"> 已连接</text>
  22. </div>
  23. </van-col>
  24. <van-col span="3" offset="1">
  25. <div class="dot_container flex align-center">
  26. <div class="dot_wait">
  27. <img v-if="connect_toy == 1" src="https://img.shuimuai.com/web/dot.png" alt="" class="moving_dot"
  28. :class="{moving:connect_toy==1}"
  29. />
  30. <img v-if="connect_toy == 2" src="https://img.shuimuai.com/m_sign_gou%402x.png" alt="" class="moving_dot">
  31. <img v-if="connect_toy == 3" src="https://img.shuimuai.com/fail.png" alt="" class="moving_dot">
  32. </div>
  33. </div>
  34. </van-col>
  35. <van-col span="5" offset="0">
  36. <div class="device_bg flex flex-direction align-center justify-center">
  37. <img src="https://img.shuimuai.com/web/uav.png" alt="" class="uav_toy">
  38. <text class="text-gray device_text">
  39. <template v-if="connect_toy == 1 || connect_toy == 3">
  40. 智能喷雾恐龙
  41. </template>
  42. <template v-if="connect_toy == 2 || connect_toy == 4">
  43. 已连接
  44. </template>
  45. </text>
  46. </div>
  47. </van-col>
  48. </van-row>
  49. <!-- 按钮组合-->
  50. <van-row gutter="6">
  51. <van-col span="8">
  52. <button class="cu-btn bg-red lg text-white" @click="change_status">
  53. <img src="https://img.shuimuai.com/m_duankainaohuan.png" class="cut_brain_icon" alt="">
  54. <text class=" cut_text">断开脑环</text>
  55. </button>
  56. </van-col>
  57. <van-col span="12" offset="1" v-if="connect_toy == 1">
  58. <van-row class="text-center">
  59. <text class="text-gray text-lg">
  60. 连接中...
  61. </text>
  62. </van-row>
  63. </van-col>
  64. <!-- 已经连接玩具-->
  65. <div v-if="connect_toy == 2">
  66. <van-col span="8">
  67. <button class="cu-btn bg-red lg cu-btn-primary" @click="open_choose_toy">
  68. <img src="https://img.shuimuai.com/m_xuanzewanju.png" alt="" class="cut_brain_icon">
  69. <text class=" cut_text">选择玩具</text>
  70. </button>
  71. </van-col>
  72. <van-col span="8">
  73. <button class="cu-btn bg-red lg cu-btn-primary" @click="choose_pay_window">
  74. <img src="https://img.shuimuai.com/web/start_game_icon.png" alt="" class="cut_start_game_icon">
  75. <text class=" cut_text" style="padding: 0px;">开始游戏</text>
  76. </button>
  77. </van-col>
  78. </div>
  79. <!-- 玩具连接失败-->
  80. <div v-if="connect_toy == 3">
  81. <van-col span="8">
  82. <button class="cu-btn bg-red lg cu-btn-primary" @click="choose_pay_window">
  83. <img src="https://img.shuimuai.com/m_xuanzewanju.png" alt="" class="cut_brain_icon">
  84. <text class=" cut_text">选择玩具</text>
  85. </button>
  86. </van-col>
  87. <van-col span="8">
  88. <van-row class="text-center">
  89. <text class="text-gray text-lg">
  90. 连接失败
  91. </text>
  92. </van-row>
  93. </van-col>
  94. </div>
  95. <!-- 玩具连接中-->
  96. <div v-if="connect_toy == 4">
  97. <van-col span="8">
  98. <button class="cu-btn bg-red lg cu-btn-primary" @click="choose_pay_window">
  99. <img src="https://img.shuimuai.com/m_xuanzewanju.png" alt="" class="cut_brain_icon">
  100. <text class=" cut_text">选择玩具</text>
  101. </button>
  102. </van-col>
  103. <van-col span="8">
  104. <button class="cu-btn bg-green lg ">
  105. <img src="https://img.shuimuai.com/web/start_game_icon.png" alt="" class="cut_start_game_icon">
  106. <text class=" cut_text" style="padding: 0px;">游戏中</text>
  107. </button>
  108. </van-col>
  109. </div>
  110. </van-row>
  111. <!-- 选择消费方式的窗口 -->
  112. <van-overlay :show="pay_window" @click="onClickHide" z-index="5">
  113. <div class="pay_type_window">
  114. <div class="pay_type_title padding">
  115. <text class="text-bold pay_type_title_text">选择消费方式</text>
  116. </div>
  117. <van-row gutter="11">
  118. <van-col span="11" offset="1">
  119. <div class="pay_type_item flex flex-direction justify-center align-center" @click.prevent="choose_pay(1)">
  120. <view class="text-xl padding">
  121. <text class="text-white text-bold">消费时间</text>
  122. </view>
  123. </div>
  124. </van-col>
  125. <van-col span="11">
  126. <div class="pay_type_item flex flex-direction justify-center align-center" @click.prevent="choose_pay(2)">
  127. <view class="text-xl padding">
  128. <text class="text-white text-bold">消费次卡</text>
  129. </view>
  130. <view class="text-sm">
  131. <text class="text-white">次卡时间为10分钟</text>
  132. </view>
  133. </div>
  134. </van-col>
  135. </van-row>
  136. </div>
  137. <img src="https://img.shuimuai.com/web/boy2.png" alt="" class="connected_boy2">
  138. </van-overlay>
  139. </div>
  140. </template>
  141. <script>
  142. let $this;
  143. export default {
  144. name: "connected",
  145. props: ['connect_toy'],
  146. data() {
  147. return {
  148. pay_window: false,
  149. // 0:未选择 1:时间 2:次数
  150. pay_type: 0
  151. }
  152. },
  153. watch: {
  154. pay_type($new, $old) {
  155. if ($new > 0) {
  156. $this.change_toy_connect_status(4)
  157. $this.to_playing()
  158. }
  159. }
  160. },
  161. methods: {
  162. open_choose_toy() {
  163. $this.$emit('open_choose_toy', true)
  164. },
  165. //打开选择消费的选项框
  166. choose_pay_window() {
  167. $this.pay_window = true
  168. },
  169. //选择消费的时间或者次数
  170. choose_pay($event) {
  171. $this.pay_type = $event
  172. mpvue.navigateTo({
  173. url: "/pages/start/main?mode=" + $event
  174. })
  175. },
  176. //点击隐藏
  177. onClickHide() {
  178. $this.pay_window = false
  179. },
  180. // 前往正在玩的波动时间界面
  181. to_playing() {
  182. console.log('跳转')
  183. },
  184. //修改连接状态
  185. change_toy_connect_status($status) {
  186. $this.$emit('change_toy_connect_status', $status)
  187. },
  188. change_status() {
  189. $this.$emit('change_status', 0)
  190. }
  191. },
  192. created() {
  193. $this = this
  194. }
  195. }
  196. </script>
  197. <style scoped>
  198. @import url('../../static/connecting.css');
  199. </style>