guide.nvue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  1. <template>
  2. <view class="guide-wrapper">
  3. <view v-if="currentType == 'level-button-tip'" class="guide-container position-relative"
  4. @click="buttonMessage('confirm')">
  5. <!-- top: 55px; 相当于 上间隔 -->
  6. <view class="mask-bg-07" :style="{height:guideHeight+'px'}"></view>
  7. <!-- 中心位置 225 -->
  8. <view style="width: 750rpx;height: 231px;">
  9. <view style="height: 200px;" class="mask-bg-07">
  10. <view class="position-absolute-center" style="top: 0;left:100rpx;">
  11. <image style="width: 488rpx;height: 366rpx;"
  12. src="../../../static/modal/level-tip/level-tip-box@2x.png">
  13. </image>
  14. </view>
  15. <view class="position-absolute-center">
  16. <text class="text-white text-14px text-lines2"
  17. style="top: -80rpx;left:70rpx; width: 300rpx;">点击此按钮选择关卡</text>
  18. <view v-if="hiddenType != 'firstInstallation'" class="flex flex-direction-row"
  19. style="top: -50rpx;left:50rpx;" @click="switchSelected()">
  20. <image v-if="!isSelected" style="width: 40rpx;height: 40rpx; margin-right: 20rpx;"
  21. src="../../../static/common/subNVue/guide/check-box.png"></image>
  22. <image v-else style="width: 40rpx;height: 40rpx; margin-right: 20rpx;"
  23. src="../../../static/common/subNVue/guide/check-box-selected.png"></image>
  24. <text class="text-15px text-white">不再提示</text>
  25. </view>
  26. </view>
  27. </view>
  28. <view style="width: 750rpx;height: 82rpx;" class="flex flex-direction-row">
  29. <view class="flex-sub mask-bg-07"></view>
  30. <view class="position-relative justify-center align-center"
  31. style="width: 147px;height: 82rpx; background-color: rgba(0,0,0,0.7);">
  32. <image style="width: 147px;height: 31px;" class="position-absolute-center"
  33. src="../../../static/modal/level-tip/level-tip-bg@2x.png"></image>
  34. <image style="width: 30px;height: 23px; "
  35. src="../../../static/modal/level-tip/level-tip-logo@2x.png"></image>
  36. </view>
  37. <view class="flex-sub mask-bg-07"></view>
  38. </view>
  39. </view>
  40. <!-- 计算剩余空白 -->
  41. <view class="mask-bg-07 flex-sub"></view>
  42. </view>
  43. <view v-if="currentType == 'device-tip'"
  44. class="guide-container justify-center align-center position-relative mask-bg-07"
  45. @click="buttonMessage('confirm')">
  46. <view class="mid">
  47. <image class="bind-tip-image" src="../../../static/modal/tip/bind-tip-bg.png"></image>
  48. <text class="text-16px text-center text-white"
  49. style="width: 500rpx;margin-bottom: 130rpx;">请将手柄十字键朝上插入绑带中,佩戴在右侧小腿侧面</text>
  50. <view v-if="hiddenType != 'firstInstallation'" class="flex flex-direction-row"
  51. @click="switchSelected()">
  52. <image v-if="!isSelected" style="width: 40rpx;height: 40rpx; margin-right: 20rpx;"
  53. src="../../../static/common/subNVue/guide/check-box.png"></image>
  54. <image v-else style="width: 40rpx;height: 40rpx; margin-right: 20rpx;"
  55. src="../../../static/common/subNVue/guide/check-box-selected.png"></image>
  56. <text class="text-15px text-white">不再提示</text>
  57. </view>
  58. </view>
  59. </view>
  60. <view v-if="currentType == 'plan'" class="guide-container position-relative" @click="buttonMessage('confirm')">
  61. <!-- top: 55px; 相当于 上间隔 -->
  62. <view class="mask-bg-07" :style="{height:guideHeight+'px'}"></view>
  63. <!-- 中心位置 225 -->
  64. <view style="width: 750rpx;height: 284px;">
  65. <view style="height: 200px;" class="mask-bg-07">
  66. <view class="position-absolute-center" style="top: 0;left:100rpx;">
  67. <image style="width: 488rpx;height: 366rpx;"
  68. src="../../../static/common/subNVue/guide/guide-plan@3x.png">
  69. </image>
  70. </view>
  71. <view class="position-absolute-center">
  72. <text class="text-white text-14px text-lines2"
  73. style="top: -30rpx;left:90rpx; width: 300rpx;">请先定制属于您的专属计划,好的开始是成功的一半。</text>
  74. </view>
  75. </view>
  76. <view style="width: 750rpx;height: 120px;" class="flex flex-direction-row">
  77. <!-- 32+ 60/2 -->
  78. <view style="width: 62px;" class="mask-bg-07"></view>
  79. <image style="width: 90px;height: 150px; opacity: 0.7;"
  80. src="../../../static/common/subNVue/guide/guide-rect-mask.png"></image>
  81. <view class="mask-bg-07 flex-sub"></view>
  82. </view>
  83. </view>
  84. <!-- 计算剩余空白 -->
  85. <view class="mask-bg-07 flex-sub"></view>
  86. </view>
  87. <view v-if="currentType == 'actionJumpPlay'" class="guide-container position-relative"
  88. @click="buttonMessage('confirm')">
  89. <!-- top: 55px; 相当于 上间隔 -->
  90. <view class="mask-bg-07" :style="{height:guideHeight+'px'}"></view>
  91. <!-- 中心位置 275 -->
  92. <view style="width: 750rpx;height: 350px;">
  93. <view style="height: 200px;" class="mask-bg-07">
  94. <view class="position-absolute-center" style="top: 0;left:100rpx;">
  95. <image style="width: 488rpx;height: 366rpx;"
  96. src="../../../static/common/subNVue/guide/guide-mid.png">
  97. </image>
  98. </view>
  99. <view class="position-absolute-center">
  100. <text class="text-white text-14px" style="top: -30rpx;left:80rpx;">点击播放体验关卡对应关卡</text>
  101. </view>
  102. </view>
  103. <view style="width: 750rpx;height: 150px;" class="flex flex-direction-row">
  104. <view style="width: 166rpx;" class="mask-bg-07"></view>
  105. <image style="width: 200px;height: 200px; opacity: 0.7;top: -63rpx;"
  106. src="../../../static/common/subNVue/guide/guide-circle-mask.png"></image>
  107. <view class="mask-bg-07 flex-sub"></view>
  108. </view>
  109. </view>
  110. <!-- 计算剩余空白 -->
  111. <view class="mask-bg-07 flex-sub"></view>
  112. </view>
  113. <view v-if="currentType == 'bluetoothConnect'" class="guide-container position-relative"
  114. @click="buttonMessage('confirm')">
  115. <!-- top: 55px; 相当于 上间隔 -->
  116. <view class="mask-bg-07" :style="{height:guideHeight+'px'}"></view>
  117. <!-- 中心位置 225 -->
  118. <view style="width: 750rpx;height: 764rpx;">
  119. <view style="height: 596rpx;" class="mask-bg-07">
  120. <view class="position-absolute-center" style="top: 0;left:31rpx;">
  121. <image style="width: 442rpx;height: 372rpx;"
  122. src="../../../static/common/subNVue/guide/guide-bluetooth@3x.png">
  123. </image>
  124. </view>
  125. <view class="position-absolute-center" >
  126. <text class="text-white text-14px" style="left: 20px;top: -5px;">请先连接蓝牙设备.</text>
  127. <!-- <text class="text-left text-white text-14px"
  128. style="width: 542rpx;">1、长按开关键3秒,绿灯连续闪烁为可连接状态.</text>
  129. <text class="text-left text-white text-14px" style="width: 542rpx;">2、选择设备类型进行连接.</text>
  130. <text class="text-left text-white text-14px"
  131. style="width: 542rpx;">3、手柄连接成功后,将手柄十字键朝上插入绑带中.</text>
  132. <text class="text-left text-white text-14px" style="width: 542rpx;">4、用绑带将手柄朝上绑在右脚脚踝上.</text>
  133. -->
  134. </view>
  135. </view>
  136. <view style="width: 750rpx;height: 168rpx;" class="flex flex-direction-row">
  137. <!-- 这里width 当做 left -->
  138. <view class="mask-bg-07" :style="{width:guideLeft+'px'}"></view>
  139. <image style="width: 100px;height: 100px; opacity: 0.7;top: -12px;"
  140. src="../../../static/common/subNVue/guide/guide-circle-mask.png"></image>
  141. <view class="mask-bg-07 flex-sub"></view>
  142. </view>
  143. </view>
  144. <!-- 计算剩余空白 -->
  145. <view class="mask-bg-07 flex-sub"></view>
  146. </view>
  147. <view v-if="currentType == 'level-game-tip'"
  148. class="guide-container justify-center align-center position-relative mask-bg-07"
  149. @click="buttonMessage('confirm')">
  150. <view class="game-mid">
  151. <view style="height: 278rpx;width: 750rpx;" class="position-relative">
  152. <view class="position-absolute-center" style="top: 0;left:0rpx;">
  153. <image style="width: 442rpx;height: 278rpx;"
  154. src="../../../static/common/subNVue/guide/level-game-title@2x.png"></image>
  155. </view>
  156. <view class="position-absolute-center">
  157. <text class="text-white text-14px"
  158. style="top: 0rpx;left:20rpx;">{{unlockLevelInfo.title}}</text>
  159. </view>
  160. </view>
  161. <view class="flex flex-direction-row align-center justify-center margin-17px">
  162. <text class="game-number">1</text>
  163. <text class="text-16px text-left text-white " style="width:476rpx;">{{unlockLevelInfo.firstText}}</text>
  164. </view>
  165. <image
  166. :style="{ width: unlockLevelInfo.firstWidth + 'rpx', height: unlockLevelInfo.firstHeight + 'rpx' ,transform:'scaleX('+unlockLevelInfo.firstDirection +')' }"
  167. :src="unlockLevelInfo.firstImage"></image>
  168. <view class="flex flex-direction-row align-center justify-center margin-17px">
  169. <text class="game-number">2</text>
  170. <text class="text-16px text-left text-white " style="width:476rpx;">{{unlockLevelInfo.secondText}}</text>
  171. </view>
  172. <image
  173. :style="{ width: unlockLevelInfo.secondWidth + 'rpx', height: unlockLevelInfo.secondHeight + 'rpx' ,transform:'scaleX('+unlockLevelInfo.secondDirection +')' }"
  174. :src="unlockLevelInfo.secondImage">
  175. </image>
  176. <!-- <image style="width: 232rpx;height: 78rpx;margin-top: 48rpx;"
  177. src="../../../static/common/subNVue/guide/level-game-next@2x.png"></image>
  178. -->
  179. </view>
  180. </view>
  181. </view>
  182. </template>
  183. <script>
  184. import {
  185. mapState,
  186. mapMutations
  187. } from 'vuex';
  188. export default {
  189. computed: mapState(['systemInfo', 'navHeight', 'tabbarHeight']),
  190. data() {
  191. return {
  192. title: '',
  193. content: '',
  194. lists: [],
  195. isSelected: false,
  196. currentType: 'none',
  197. /**
  198. * 隐藏guide时候,随后的操作类型
  199. */
  200. hiddenType: 'none',
  201. operationItem: null,
  202. guideHeight: 55,
  203. guideLeft: 166,
  204. //三个关卡的对应信息
  205. unlockLevelInfo: {
  206. title: '',
  207. firstText: '',
  208. firstImage: '',
  209. firstWidth: 0,
  210. firstHeight: 0,
  211. secondText: '',
  212. secondImage: '',
  213. secondWidth: 0,
  214. secondHeight: 0
  215. },
  216. midJumpInfo: {
  217. title: '解锁向上跳',
  218. firstText: '请先确保手柄已经连接成功。',
  219. firstImage: '../../../static/common/subNVue/guide/level-game-fab@2x.png',
  220. firstDirection: 1,
  221. firstWidth: 102,
  222. firstHeight: 108,
  223. secondText: '通过向上跳的方式消除标志块',
  224. secondImage: '../../../static/modal/action-jump/midJumpWhite.png',
  225. secondDirection: 1,
  226. secondWidth: 68,
  227. secondHeight: 68
  228. },
  229. directionJumpInfo: {
  230. title: '解锁左右跳',
  231. firstText: '此为左跳图标,通过向左跳的方式消除标志块',
  232. firstImage: '../../../static/modal/action-jump/directionJumpWhite.png',
  233. firstDirection: -1,
  234. firstWidth: 68,
  235. firstHeight: 68,
  236. secondText: '此为右跳图标,通过向右跳的方式消除标志块',
  237. secondImage: '../../../static/modal/action-jump/directionJumpWhite.png',
  238. secondDirection: 1,
  239. secondWidth: 68,
  240. secondHeight: 68
  241. },
  242. rotationJumpInfo: {
  243. title: '解锁左右旋跳',
  244. firstText: '此为左旋跳图标,通过向左旋跳的方式消除标志块',
  245. firstImage: '../../../static/modal/action-jump/directionJumpWhite.png',
  246. firstDirection: -1,
  247. firstWidth: 68,
  248. firstHeight: 68,
  249. secondText: '此为右旋跳图标,通过向右旋跳的方式消除标志块',
  250. secondImage: '../../../static/modal/action-jump/directionJumpWhite.png',
  251. secondDirection: 1,
  252. secondWidth: 68,
  253. secondHeight: 68
  254. }
  255. }
  256. },
  257. created() {
  258. console.log('*********一个guide created')
  259. const vm = this;
  260. // for (let i = 1; i < 20; i++) {
  261. // this.lists.push('item' + i);
  262. // }
  263. uni.$on('guide-popup', (data) => {
  264. vm.title = data.title;
  265. vm.content = data.content;
  266. vm.currentType = data.type;
  267. vm.operationItem = data.operationItem;
  268. let _viewData = data.item;
  269. //获取类型
  270. vm.hiddenType = (_viewData && _viewData.hiddenType) || 'none';
  271. console.log("vm.hiddenType:", vm.hiddenType);
  272. if (vm.currentType == "actionJumpPlay") {
  273. // _viewData.height/4 = 27.5
  274. vm.guideHeight = _viewData.top + _viewData.height - _viewData.height / 4 - vm.systemInfo
  275. .statusBarHeight - 275;
  276. } else if (vm.currentType == "bluetoothConnect") {
  277. //+ _viewData.height - _viewData.height / 4 - vm.systemInfo.statusBarHeight
  278. vm.guideHeight = _viewData.top - 298;
  279. vm.guideLeft = _viewData.left - _viewData.width / 2 + 5;
  280. } else if (vm.currentType == "plan") {
  281. vm.guideHeight = vm.systemInfo.screenHeight - 284 - 32;
  282. // vm.guideLeft = 55;
  283. } else if (vm.currentType == "level-button-tip") {
  284. //首页提示选择关卡
  285. vm.guideHeight = vm.systemInfo.screenHeight - 284 - 32 + 3;
  286. const value = uni.getStorageSync('levelButtonPrompt');
  287. if (value) {
  288. vm.isSelected = value.isSelected;
  289. } else {
  290. vm.isSelected = false;
  291. }
  292. } else if (vm.currentType == "device-tip") {
  293. //提示绑带
  294. const value = uni.getStorageSync('deviceDirectionPrompt');
  295. if (value) {
  296. vm.isSelected = value.isSelected;
  297. } else {
  298. vm.isSelected = false;
  299. }
  300. } else if (vm.currentType == "level-game-tip") {
  301. if (_viewData.levelType == 'midJump') {
  302. vm.unlockLevelInfo = Object.assign({}, vm.midJumpInfo);
  303. } else if (_viewData.levelType == 'directionJump') {
  304. vm.unlockLevelInfo = Object.assign({}, vm.directionJumpInfo);
  305. } else if (_viewData.levelType == 'rotationJump') {
  306. vm.unlockLevelInfo = Object.assign({}, vm.rotationJumpInfo);
  307. }
  308. }
  309. })
  310. },
  311. beforeDestroy() {
  312. uni.$off('guide-popup')
  313. },
  314. methods: {
  315. switchSelected() {
  316. console.log('switchSelected', this.isSelected, !this.isSelected);
  317. this.isSelected = !this.isSelected;
  318. uni.$emit('guide-popup-page', {
  319. type: 'selected',
  320. messageType: this.currentType,
  321. isSelected: this.isSelected,
  322. operationItem: this.operationItem
  323. })
  324. // if (this.isSelected) {
  325. // uni.setStorage({
  326. // key: 'deviceDirectionPrompt',
  327. // data: {
  328. // isSelected: true
  329. // }
  330. // })
  331. // } else {
  332. // uni.setStorage({
  333. // key: 'deviceDirectionPrompt',
  334. // data: {
  335. // isSelected: false
  336. // }
  337. // })
  338. // }
  339. },
  340. buttonMessage(buttonEvent) {
  341. setTimeout(() => {
  342. const subNVue = uni.getCurrentSubNVue()
  343. uni.$emit('guide-popup-page', {
  344. type: 'button',
  345. messageType: this.currentType,
  346. hiddenType: this.hiddenType,
  347. confirm: buttonEvent == 'confirm' ? true : false,
  348. cancel: buttonEvent == 'cancel' ? true : false,
  349. info: buttonEvent + ' 该元素被点击了!',
  350. operationItem: this.operationItem
  351. })
  352. }, 260);
  353. this.hidePupup();
  354. },
  355. hidePupup() {
  356. console.log('hidePupup');
  357. uni.getCurrentSubNVue().hide('auto', 250);
  358. setTimeout(() => {
  359. this.currentType = 'none';
  360. }, 250);
  361. }
  362. }
  363. }
  364. </script>
  365. <style scoped lang="scss">
  366. .guide-wrapper {
  367. justify-content: center;
  368. align-items: center;
  369. }
  370. .guide-container {
  371. /* background-color: rgba(0, 0, 0, 0.3); */
  372. width: 750rpx;
  373. flex: 1;
  374. }
  375. .transparents-container {}
  376. .mid {
  377. justify-content: center;
  378. align-items: center;
  379. height: 700rpx;
  380. width: 300rpx;
  381. }
  382. .game-mid {
  383. justify-content: center;
  384. align-items: center;
  385. height: 850rpx;
  386. width: 750rpx;
  387. }
  388. .bind-tip-image {
  389. border-width: 14rpx;
  390. border-style: solid;
  391. border-color: #E5E5FF;
  392. background-color: #FFFFFF;
  393. width: 226rpx;
  394. height: 260rpx;
  395. margin-bottom: 50rpx;
  396. }
  397. .title {
  398. height: 100rpx;
  399. line-height: 100rpx;
  400. border-bottom-style: solid;
  401. border-bottom-width: 1rpx;
  402. border-bottom-color: #CBCBCB;
  403. flex: 0;
  404. font-size: 30rpx;
  405. }
  406. .scroller {
  407. height: 400rpx;
  408. padding: 8rpx 15rpx;
  409. }
  410. .content {
  411. color: #555555;
  412. font-size: 32rpx;
  413. }
  414. .message-wrapper {
  415. flex: 0;
  416. border-top-style: solid;
  417. border-top-width: 1rpx;
  418. border-top-color: #CBCBCB;
  419. height: 80rpx;
  420. align-items: flex-end;
  421. }
  422. .send-message {
  423. font-size: 30rpx;
  424. line-height: 80rpx;
  425. color: #00CE47;
  426. margin-left: 20rpx;
  427. }
  428. .cell {
  429. margin: 10rpx;
  430. padding: 20rpx 0;
  431. top: 10rpx;
  432. align-items: center;
  433. justify-content: center;
  434. border-radius: 10rpx;
  435. background-color: #5989B9;
  436. }
  437. .text {
  438. font-size: 30rpx;
  439. text-align: center;
  440. color: white;
  441. }
  442. .circle {
  443. width: 50px;
  444. height: 50px;
  445. border-width: 1rpx;
  446. border-color: #FF0000;
  447. border-style: solid;
  448. border-radius: 50%;
  449. position: absolute;
  450. top: 200rpx;
  451. left: 200rpx;
  452. background-color: rgba(255, 255, 255, 0);
  453. /* box-sizing: border-box; */
  454. }
  455. .su {
  456. position: relative;
  457. width: 750px;
  458. flex: 1;
  459. border-width: 1rpx;
  460. border-color: #FF0000;
  461. border-style: solid;
  462. }
  463. .lk {
  464. position: absolute;
  465. width: 100px;
  466. height: 200px;
  467. /* border-radius: 10px; */
  468. // border-width: 10px;
  469. // border-color: rgba(0, 0, 0, 0.4);
  470. // border-style: solid;
  471. border-top-color: #000000;
  472. border-top-width: 10px;
  473. border-bottom: 1rpx solid #000;
  474. top: 150px;
  475. /* margin-top: -250px; */
  476. left: 150px;
  477. /* margin-left: -250px; */
  478. }
  479. .game-number {
  480. border-radius: 18px;
  481. border-width: 1rpx;
  482. width: 22px;
  483. height: 22px;
  484. text-align: center;
  485. color: #FFFFFF;
  486. border-color: #FFFFFF;
  487. margin-right: 13px;
  488. }
  489. </style>