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' && hiddenType != 'normal'"
  19. class="flex flex-direction-row" 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 "
  164. style="width:476rpx;">{{unlockLevelInfo.firstText}}</text>
  165. </view>
  166. <image
  167. :style="{ width: unlockLevelInfo.firstWidth + 'rpx', height: unlockLevelInfo.firstHeight + 'rpx' ,transform:'scaleX('+unlockLevelInfo.firstDirection +')' }"
  168. :src="unlockLevelInfo.firstImage"></image>
  169. <view v-if="!unlockLevelInfo.secondHidden" class="flex flex-direction-row align-center justify-center margin-17px">
  170. <text class="game-number">2</text>
  171. <text class="text-16px text-left text-white "
  172. style="width:476rpx;">{{unlockLevelInfo.secondText}}</text>
  173. </view>
  174. <image v-if="!unlockLevelInfo.secondHidden"
  175. :style="{ width: unlockLevelInfo.secondWidth + 'rpx', height: unlockLevelInfo.secondHeight + 'rpx' ,transform:'scaleX('+unlockLevelInfo.secondDirection +')' }"
  176. :src="unlockLevelInfo.secondImage">
  177. </image>
  178. <!-- <image style="width: 232rpx;height: 78rpx;margin-top: 48rpx;"
  179. src="../../../static/common/subNVue/guide/level-game-next@2x.png"></image>
  180. -->
  181. </view>
  182. </view>
  183. </view>
  184. </template>
  185. <script>
  186. import {
  187. mapState,
  188. mapMutations
  189. } from 'vuex';
  190. export default {
  191. computed: mapState(['systemInfo', 'navHeight', 'tabbarHeight']),
  192. data() {
  193. return {
  194. title: '',
  195. content: '',
  196. lists: [],
  197. isSelected: false,
  198. currentType: 'none',
  199. /**
  200. * 隐藏guide时候,随后的操作类型
  201. */
  202. hiddenType: 'none',
  203. operationItem: null,
  204. guideHeight: 55,
  205. guideLeft: 166,
  206. //三个关卡的对应信息
  207. unlockLevelInfo: {
  208. title: '',
  209. firstText: '',
  210. firstImage: '',
  211. firstWidth: 0,
  212. firstHeight: 0,
  213. secondText: '',
  214. secondImage: '',
  215. secondWidth: 0,
  216. secondHeight: 0,
  217. secondHidden: false
  218. },
  219. midJumpInfo: {
  220. title: '解锁向上跳',
  221. // firstText: '请先确保手柄已经连接成功。',
  222. // firstImage: '../../../static/common/subNVue/guide/level-game-fab@2x.png',
  223. firstText: '通过向上跳的方式消除标志块',
  224. firstImage: '../../../static/modal/action-jump/midJumpWhite.png',
  225. firstDirection: 1,
  226. firstWidth: 68, //102,
  227. firstHeight: 68, //108,
  228. secondText: '通过向上跳的方式消除标志块',
  229. secondImage: '../../../static/modal/action-jump/midJumpWhite.png',
  230. secondDirection: 1,
  231. secondWidth: 68,
  232. secondHeight: 68,
  233. secondHidden: true,
  234. },
  235. directionJumpInfo: {
  236. title: '解锁左右跳',
  237. firstText: '此为左跳图标,通过向左跳的方式消除标志块',
  238. firstImage: '../../../static/modal/action-jump/directionJumpWhite.png',
  239. firstDirection: -1,
  240. firstWidth: 68,
  241. firstHeight: 68,
  242. secondText: '此为右跳图标,通过向右跳的方式消除标志块',
  243. secondImage: '../../../static/modal/action-jump/directionJumpWhite.png',
  244. secondDirection: 1,
  245. secondWidth: 68,
  246. secondHeight: 68,
  247. secondHidden: false
  248. },
  249. rotationJumpInfo: {
  250. title: '解锁左右旋跳',
  251. firstText: '此为左旋跳图标,通过向左旋跳的方式消除标志块',
  252. firstImage: '../../../static/modal/action-jump/directionJumpWhite.png',
  253. firstDirection: -1,
  254. firstWidth: 68,
  255. firstHeight: 68,
  256. secondText: '此为右旋跳图标,通过向右旋跳的方式消除标志块',
  257. secondImage: '../../../static/modal/action-jump/directionJumpWhite.png',
  258. secondDirection: 1,
  259. secondWidth: 68,
  260. secondHeight: 68,
  261. secondHidden: false
  262. }
  263. }
  264. },
  265. created() {
  266. console.log('*********一个guide created')
  267. const vm = this;
  268. uni.$on('guide-popup', (data) => {
  269. vm.title = data.title;
  270. vm.content = data.content;
  271. vm.currentType = data.type || 'none';
  272. vm.operationItem = data.operationItem;
  273. let _viewData = data.item;
  274. //获取类型
  275. vm.hiddenType = (_viewData && _viewData.hiddenType) || 'none';
  276. console.log("vm.hiddenType:", vm.hiddenType);
  277. if (vm.currentType == "actionJumpPlay") {
  278. // _viewData.height/4 = 27.5
  279. vm.guideHeight = _viewData.top + _viewData.height - _viewData.height / 4 - vm.systemInfo
  280. .statusBarHeight - 275;
  281. } else if (vm.currentType == "bluetoothConnect") {
  282. //+ _viewData.height - _viewData.height / 4 - vm.systemInfo.statusBarHeight
  283. vm.guideHeight = _viewData.top - 298;
  284. vm.guideLeft = _viewData.left - _viewData.width / 2 + 5;
  285. } else if (vm.currentType == "plan") {
  286. vm.guideHeight = vm.systemInfo.screenHeight - 284 - 32;
  287. // vm.guideLeft = 55;
  288. } else if (vm.currentType == "level-button-tip") {
  289. //首页提示选择关卡
  290. vm.guideHeight = vm.systemInfo.screenHeight - 284 - 32 + 3;
  291. const value = uni.getStorageSync('levelButtonPrompt');
  292. if (value) {
  293. vm.isSelected = value.isSelected;
  294. } else {
  295. vm.isSelected = false;
  296. }
  297. } else if (vm.currentType == "device-tip") {
  298. //提示绑带
  299. const value = uni.getStorageSync('deviceDirectionPrompt');
  300. if (value) {
  301. vm.isSelected = value.isSelected;
  302. } else {
  303. vm.isSelected = false;
  304. }
  305. } else if (vm.currentType == "level-game-tip") {
  306. if (_viewData.levelType == 'midJump') {
  307. vm.unlockLevelInfo = Object.assign({}, vm.midJumpInfo);
  308. } else if (_viewData.levelType == 'directionJump') {
  309. vm.unlockLevelInfo = Object.assign({}, vm.directionJumpInfo);
  310. } else if (_viewData.levelType == 'rotationJump') {
  311. vm.unlockLevelInfo = Object.assign({}, vm.rotationJumpInfo);
  312. }
  313. }
  314. })
  315. },
  316. beforeDestroy() {
  317. uni.$off('guide-popup')
  318. },
  319. methods: {
  320. switchSelected() {
  321. console.log('switchSelected', this.isSelected, !this.isSelected);
  322. this.isSelected = !this.isSelected;
  323. uni.$emit('guide-popup-page', {
  324. type: 'selected',
  325. messageType: this.currentType,
  326. isSelected: this.isSelected,
  327. operationItem: this.operationItem
  328. })
  329. // if (this.isSelected) {
  330. // uni.setStorage({
  331. // key: 'deviceDirectionPrompt',
  332. // data: {
  333. // isSelected: true
  334. // }
  335. // })
  336. // } else {
  337. // uni.setStorage({
  338. // key: 'deviceDirectionPrompt',
  339. // data: {
  340. // isSelected: false
  341. // }
  342. // })
  343. // }
  344. },
  345. buttonMessage(buttonEvent) {
  346. setTimeout(() => {
  347. const subNVue = uni.getCurrentSubNVue()
  348. uni.$emit('guide-popup-page', {
  349. type: 'button',
  350. messageType: this.currentType,
  351. hiddenType: this.hiddenType,
  352. confirm: buttonEvent == 'confirm' ? true : false,
  353. cancel: buttonEvent == 'cancel' ? true : false,
  354. info: buttonEvent + ' 该元素被点击了!',
  355. operationItem: this.operationItem
  356. })
  357. }, 260);
  358. this.hidePupup();
  359. },
  360. hidePupup() {
  361. uni.getCurrentSubNVue().hide('auto', 250);
  362. }
  363. }
  364. }
  365. </script>
  366. <style scoped lang="scss">
  367. .guide-wrapper {
  368. justify-content: center;
  369. align-items: center;
  370. }
  371. .guide-container {
  372. /* background-color: rgba(0, 0, 0, 0.3); */
  373. width: 750rpx;
  374. flex: 1;
  375. }
  376. .transparents-container {}
  377. .mid {
  378. justify-content: center;
  379. align-items: center;
  380. height: 700rpx;
  381. width: 300rpx;
  382. }
  383. .game-mid {
  384. justify-content: center;
  385. align-items: center;
  386. height: 850rpx;
  387. width: 750rpx;
  388. }
  389. .bind-tip-image {
  390. border-width: 14rpx;
  391. border-style: solid;
  392. border-color: #E5E5FF;
  393. background-color: #FFFFFF;
  394. width: 226rpx;
  395. height: 260rpx;
  396. margin-bottom: 50rpx;
  397. }
  398. .title {
  399. height: 100rpx;
  400. line-height: 100rpx;
  401. border-bottom-style: solid;
  402. border-bottom-width: 1rpx;
  403. border-bottom-color: #CBCBCB;
  404. flex: 0;
  405. font-size: 30rpx;
  406. }
  407. .scroller {
  408. height: 400rpx;
  409. padding: 8rpx 15rpx;
  410. }
  411. .content {
  412. color: #555555;
  413. font-size: 32rpx;
  414. }
  415. .message-wrapper {
  416. flex: 0;
  417. border-top-style: solid;
  418. border-top-width: 1rpx;
  419. border-top-color: #CBCBCB;
  420. height: 80rpx;
  421. align-items: flex-end;
  422. }
  423. .send-message {
  424. font-size: 30rpx;
  425. line-height: 80rpx;
  426. color: #00CE47;
  427. margin-left: 20rpx;
  428. }
  429. .cell {
  430. margin: 10rpx;
  431. padding: 20rpx 0;
  432. top: 10rpx;
  433. align-items: center;
  434. justify-content: center;
  435. border-radius: 10rpx;
  436. background-color: #5989B9;
  437. }
  438. .text {
  439. font-size: 30rpx;
  440. text-align: center;
  441. color: white;
  442. }
  443. .circle {
  444. width: 50px;
  445. height: 50px;
  446. border-width: 1rpx;
  447. border-color: #FF0000;
  448. border-style: solid;
  449. border-radius: 50%;
  450. position: absolute;
  451. top: 200rpx;
  452. left: 200rpx;
  453. background-color: rgba(255, 255, 255, 0);
  454. /* box-sizing: border-box; */
  455. }
  456. .su {
  457. position: relative;
  458. width: 750px;
  459. flex: 1;
  460. border-width: 1rpx;
  461. border-color: #FF0000;
  462. border-style: solid;
  463. }
  464. .lk {
  465. position: absolute;
  466. width: 100px;
  467. height: 200px;
  468. /* border-radius: 10px; */
  469. // border-width: 10px;
  470. // border-color: rgba(0, 0, 0, 0.4);
  471. // border-style: solid;
  472. border-top-color: #000000;
  473. border-top-width: 10px;
  474. border-bottom: 1rpx solid #000;
  475. top: 150px;
  476. /* margin-top: -250px; */
  477. left: 150px;
  478. /* margin-left: -250px; */
  479. }
  480. .game-number {
  481. border-radius: 18px;
  482. border-width: 1rpx;
  483. width: 22px;
  484. height: 22px;
  485. text-align: center;
  486. color: #FFFFFF;
  487. border-color: #FFFFFF;
  488. margin-right: 13px;
  489. }
  490. </style>