guide-bluetoothConnect.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <view>
  3. <uni-nav-bar id="nav-bar" status-bar="true" @clickLeft="onBack()" @clickRight="onNavUpdateDevice()"
  4. title="选择设备类型1" color="#000000" fixed="true" :border="false">
  5. <view slot="left">
  6. <view class=" flex align-center margin-left">
  7. <image class="p-left-arrow" src="../../../static/p-left-arrow.png"></image>
  8. </view>
  9. </view>
  10. <view slot="right">
  11. <view class=" flex align-center " style="margin-right: 10rpx;">
  12. <image style="width: 60rpx;height: 50rpx;" src="../../../static/devicesIconSimple/upgrade.png">
  13. </image>
  14. </view>
  15. </view>
  16. </uni-nav-bar>
  17. <view class="card-view padding-top padding-bottom" :style="{'z-index': threeZIndex}"
  18. v-for="(item,index) in devicesList" :key="index" :class="item.bRatio?'hardware-border':''"
  19. :id="'task_'+index">
  20. <view class="flex justify-between align-center">
  21. <view class="flex justify-start align-center">
  22. <image style="margin-left: 20rpx; width: 200rpx;height: 120rpx;" :src="item.icon" mode="aspectFit">
  23. </image>
  24. <view style="width: 350rpx;margin-left: 10rpx;">
  25. <view style="margin: 20rpx 0rpx; font-weight: bold; font-size: 18px; color: #565656;">
  26. {{item.cname}}
  27. </view>
  28. <view style="font-size: 12px; white-space:pre-wrap;" class="make-text-bPurple">{{item.describe}}
  29. </view>
  30. </view>
  31. </view>
  32. <!-- item.bRatio -->
  33. <image style="margin-right: 60rpx; width: 60rpx;height: 60rpx;"
  34. :src="threeZIndex == 1100?'/static/devicesOther/radio-b.png':'/static/devicesOther/radio-g.png'"
  35. mode="aspectFit"></image>
  36. </view>
  37. </view>
  38. <view class="position-absolute-center" style="z-index: 999; width: 750rpx;display: flex;">
  39. <swiper class="swiper" :style="{height:currentHeight+'px'}" :circular="circular" :vertical="true"
  40. @change="onSwiperChange">
  41. <!-- 1 -->
  42. <swiper-item class="flex justify-center align-center">
  43. <view style="width: 590rpx; height: 626rpx;" class="position-relative">
  44. <view class="bluetooth-guide-number" style="position: absolute;left: 94rpx;top: 8rpx;">1</view>
  45. <image style="width: 590rpx; height: 626rpx;"
  46. src="../../../static/guide/blutooth/guide-ble-1@2x.png">
  47. </image>
  48. </view>
  49. </swiper-item>
  50. <!-- 2 -->
  51. <swiper-item class="flex justify-center align-center flex-direction">
  52. <image style="width: 354rpx; height: 306rpx; margin-bottom: 28rpx;"
  53. src="../../../static/guide/blutooth/guide-ble-device.png">
  54. </image>
  55. <view class="position-relative">
  56. <image style="width: 520rpx; height:166rpx;" src="../../../static/guide/blutooth/boxMid@2x.png">
  57. </image>
  58. <view class="position-absolute-center text-regular"
  59. style="width: 438rpx;height: 96rpx;top: 26rpx;">长按游戏设备开关3秒,设备灯连续闪烁为可连接状态</view>
  60. </view>
  61. <view class="bluetooth-guide-number" style="margin-top: 36rpx;">2</view>
  62. </swiper-item>
  63. <!-- 3 -->
  64. <swiper-item class="flex justify-start align-center flex-direction">
  65. <view :style="{height:threeTipHeight+'px'}"></view>
  66. <view class="flex justify-end">
  67. <view class="bluetooth-guide-number" style="margin-top: 32rpx;">3</view>
  68. <view class="position-relative">
  69. <image style="width: 462rpx; height:206rpx;"
  70. src="../../../static/guide/blutooth/boxRight@2x.png">
  71. </image>
  72. <view class="position-absolute-center text-regular"
  73. style="width: 392rpx;height: 144rpx;top: 44rpx;">选择设备类型连接,按钮勾选上表示手柄连接成功。如果连接失败请重试</view>
  74. </view>
  75. </view>
  76. </swiper-item>
  77. <!-- 4 -->
  78. <swiper-item class="flex justify-center align-center flex-direction">
  79. <image style="width: 446rpx; height: 384rpx; margin-bottom: 28rpx;"
  80. src="../../../static/guide/blutooth/guide-ble-bind.png">
  81. </image>
  82. <view class="position-relative">
  83. <image style="width: 520rpx; height:166rpx;" src="../../../static/guide/blutooth/boxMid@2x.png">
  84. </image>
  85. <view class="position-absolute-center text-regular"
  86. style="width: 438rpx;height: 96rpx;top: 26rpx;">请将手柄十字键朝上插入绑带中,用绑带将手柄朝上绑在右脚脚踝上</view>
  87. </view>
  88. <view class="bluetooth-guide-number" style="margin-top: 36rpx;">4</view>
  89. </swiper-item>
  90. <!-- 5 -->
  91. <swiper-item class="flex justify-start align-center flex-direction">
  92. <view :style="{height:threeTipHeight+'px'}"></view>
  93. <view class="position-relative">
  94. <image style="width: 520rpx; height:162rpx;"
  95. src="../../../static/guide/blutooth/boxMid@2x.png">
  96. </image>
  97. <view class="position-absolute-center flex align-center justify-center" style="width: 438rpx;top: 32rpx;">
  98. <image style="width: 60rpx;height:60rpx;margin-right: 28rpx;" src="../../../static/guide/blutooth/guide-ble-finish@2x.png"></image>
  99. <view class=" text-regular " style="width: 336rpx;height: 90rpx;">
  100. 您已绑定成功,返回主界面选择关卡开始游戏吧</view>
  101. </view>
  102. </view>
  103. <button class="cu-btn make-bg-bPurple text-white " style="width: 520rpx; height:81rpx;margin-top: 100rpx;" @click="onBack()">返回上一页</button>
  104. </swiper-item>
  105. </swiper>
  106. </view>
  107. </view>
  108. </template>
  109. <script>
  110. import config from '@/common/config.js'
  111. import reqUtil from '@/util/util-js/requstUtil.js';
  112. import {
  113. mapState,
  114. mapMutations
  115. } from 'vuex';
  116. export default {
  117. computed: mapState(['BLEInfoList', 'systemInfo']),
  118. data() {
  119. return {
  120. devicesList: [],
  121. circular: true,
  122. videoList: [{
  123. id: "video0",
  124. src: "",
  125. img: ""
  126. },
  127. {
  128. id: "video1",
  129. src: "",
  130. img: ""
  131. },
  132. {
  133. id: "video2",
  134. src: "",
  135. img: ""
  136. }
  137. ],
  138. videoDataList: [],
  139. currentHeight: 0,
  140. threeTipHeight: 0,
  141. threeZIndex: 100,
  142. }
  143. },
  144. onLoad(op) {
  145. this.BLEInfoList.forEach((item, index, selfarr) => {
  146. //item.deviceType == 'BLEHandle' ||
  147. if (item.deviceType == 'BLERope') {
  148. let item = Object.assign({}, selfarr[index]);
  149. this.devicesList.push(item);
  150. }
  151. })
  152. this.currentHeight = this.systemInfo.windowHeight;
  153. // console.log(this.currentHeight);
  154. },
  155. onUnload() {
  156. },
  157. onShow() {
  158. },
  159. onReady() {
  160. let view = uni.createSelectorQuery().select('#task_0');
  161. view.boundingClientRect(data => {
  162. // console.log('参数:' + JSON.stringify(data));
  163. //13 是间隔
  164. this.threeTipHeight = data.top + data.height + 13;
  165. }).exec();
  166. },
  167. onHide() {},
  168. methods: {
  169. ...mapMutations([]),
  170. onBack() {
  171. uni.navigateBack({
  172. delta: 1
  173. })
  174. },
  175. onNavUpdateDevice() {
  176. uni.showToast({
  177. title: '点击此处升级硬件',
  178. icon: 'none'
  179. })
  180. },
  181. onSwiperChange(e) {
  182. let currentIndex = e.detail.current;
  183. // console.log(currentIndex);
  184. if (currentIndex === this._videoIndex) {
  185. return;
  186. }
  187. if (currentIndex === 2) {
  188. setTimeout(() => {
  189. this.threeZIndex = 1100;
  190. }, 200)
  191. } else {
  192. this.threeZIndex = 100;
  193. }
  194. // let isNext = false;
  195. // if (currentIndex === 0 && this._videoIndex === this.videoList.length - 1) {
  196. // isNext = true;
  197. // } else if (currentIndex === this.videoList.length - 1 && this._videoIndex === 0) {
  198. // isNext = false;
  199. // } else if (currentIndex > this._videoIndex) {
  200. // isNext = true;
  201. // }
  202. // if (isNext) {
  203. // this._videoDataIndex++;
  204. // } else {
  205. // this._videoDataIndex--;
  206. // }
  207. // if (this._videoDataIndex < 0) {
  208. // this._videoDataIndex = this.videoDataList.length - 1;
  209. // } else if (this._videoDataIndex >= this.videoDataList.length) {
  210. // this._videoDataIndex = 0;
  211. // }
  212. // this.circular = (this._videoDataIndex != 0);
  213. // if (this._videoIndex >= 0) {
  214. // this._videoContextList[this._videoIndex].pause();
  215. // this._videoContextList[this._videoIndex].seek(0);
  216. // }
  217. // this._videoIndex = currentIndex;
  218. },
  219. onNavtoHome(){
  220. uni.reLaunch({
  221. url:'../../personal-page/personal/personal'
  222. })
  223. }
  224. }
  225. }
  226. </script>
  227. <style>
  228. .hardware-border {
  229. border: 1rpx solid #9898FF;
  230. box-sizing: border-box;
  231. }
  232. .swiper {
  233. flex: 1;
  234. background-color: rgba(0, 0, 0, 0.32);
  235. }
  236. .swiper-item {
  237. flex: 1;
  238. }
  239. .video {
  240. flex: 1;
  241. /* #ifndef APP-PLUS */
  242. width: 100%;
  243. /* #endif */
  244. }
  245. .bluetooth-guide-number {
  246. border-radius: 18px;
  247. border-width: 1rpx;
  248. width: 30px;
  249. height: 30px;
  250. text-align: center;
  251. line-height: 30px;
  252. color: #000000;
  253. /* border-color: #FFFFFF; */
  254. background-color: #FFFFFF;
  255. margin-right: 13px;
  256. }
  257. </style>