guide.nvue 17 KB

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